Viewing File: /usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyc


)hc@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
m
Z
ddlmZddlTddlZddlmZmZmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddlm3Z3ddlm4Z4ddlm5Z5ddl6m7Z7ddlm8Z8ddlm9Z9ddlm:Z:ddl;m<Z<e:j=a=d Z>d!Z?d"Z@yeAeBfWneCk
rd#ZAd$ZBnXd%e,e&e.e e(e0e$e*e"e2e3j3fd&YZDdS('sUThe class representing a Mailman mailing list.

Mixes in many task-specific classes.
iN(tStringIO(tUserDict(turlparse(t*(tgetaddressest
formataddrt	parseaddr(tHeader(tmm_cfg(tUtils(tErrors(tLockFile(tUserDesc(tArchiver(t
Autoresponder(tBouncer(t	Deliverer(tDigester(tGatewayManager(t
HTMLFormatter(t	ListAdmin(tSecurityManager(tTopicMgr(tPending(tGui(t
MemberAdaptor(tOldStyleMemberships(tMessage(tSite(ti18n(tsyslogcCs|S(N((ts((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytD_Kstt|iitMailListcBsWeZd9ddZdZdZddZdZdZdZ	d	Z
d9d
ZdZdZ
d
dZdZdZdZdZdZdddZdddZd9ddZdZd9d
d
d9dZdZdZd9dZd9d9d9dZdZdZd Ze d!Z!d"Z"d#Z#d$Z$e%d%Z&d
d&Z'd9d'Z(d9d9d
d
d(Z)d9d9e d)Z*d9d9d9d*Z+d+Z,d,Z-d-Z.d.Z/d9d/Z0d9d9d0Z1d1Z2d2Z3d3Z4d9d4Z5d5Z6d6Z7d9d7Z8d8Z9RS(:icCsx3|jjD]%}t|dr
|j|q
q
W|j|t||_|dkrbdStj	j
|jd}i}yt||Wn8t
k
r}|jtjkrqtdd|n#X|jd}|r||n|r|jn
|jdS(Nt__init__s	extend.pyterrors"IOError reading list extension: %stextend(t	__class__t	__bases__thasattrR$tInitTempVarsRt_memberadaptortNonetostpathtjointfullpathtexecfiletIOErrorterrnotENOENTRtgettLocktLoad(tselftnametlockt	baseclasstfilenametdicttetfunc((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR$as*


cCsnyt|j|SWnStk
rixC|jD]+}yt||SWq.tk
rXq.Xq.Wt|nXdS(N(tgetattrR+tAttributeErrort_gui(R8R9tguicomponent((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt__getattr__s

cCs8|jrd}nd}d|j|t|fS(Ns(locked)s
(unlocked)s<mailing list "%s" %s at %x>(tLockedt
internal_nametid(R8tstatus((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt__repr__s
	icCsC|jj|y|jWntk
r>|jnXdS(N(t_MailList__lockR:R7t	ExceptiontUnlock(R8ttimeout((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR6s

cCs|jjdddS(Ntunconditionallyi(RJtunlock(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRLscCs
|jjS(N(RJtlocked(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyREscCs|jS(N(t_internal_name(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRFscCs|jS(N(t
_full_path(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR0scCs|j}|jd}|dkr|dkr`|d|!}||d}|d|}|S|d|!}||d}d|||fS|dkrd|j|jfSd|j||jfS(Nt_iit@s%s-%s@%ss%s@%s(RFtrfindR,t	host_name(R8textratlistfullnametlast_underscoret	listbegintlistendtmylistnamebegint
mylistnameend((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytgetListAddresss

cCs
|jdS(Ntbounces(R^(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetBouncesEmailscCs
|jdS(Ntowner(R^(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt
GetOwnerEmailsR!cCs-tjr|r|j|S|jdSdS(Ntrequest(RtVERP_CONFIRMATIONStGetConfirmEmailR^(R8tcookie((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetRequestEmails
cCs.tjid|jd6|d6d|jS(Ns
%s-confirmtaddrRfRT(RtVERP_CONFIRM_FORMATRFRV(R8Rf((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRescCs^tjrR|rRtjjp0tj|j}tt	d|dd}|Sd|SdS(NsCYour confirmation is required to join the %(listname)s mailing listtheader_nametsubjectsconfirm (
RRdRtget_translationtcharsetR	t
GetCharSettpreferred_languageRRS(R8tlistnameRftcsettsubj((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetConfirmJoinSubjects	cCs^tjrR|rRtjjp0tj|j}tt	d|dd}|Sd|SdS(NsDYour confirmation is required to leave the %(listname)s mailing listRjRksconfirm (
RRdRRlRmR	RnRoRRS(R8RpRfRqRr((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetConfirmLeaveSubjects	cCs
|jS(N(R^(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetListEmailscCs@|js
|St|jd\}}d||j|fSdS(sUsually the member addr, but modified for umbrella lists.

        Umbrella lists have other mailing lists as members, and so admin stuff
        like confirmation requests and passwords must not be sent to the
        member addresses - the sublists - but rather to the administrators of
        the sublists.  This routine picks the right address, considering
        regular member address to be their own administrative addresses.

        RTs%s%s@%sN(t
umbrella_listttupletsplittumbrella_member_suffix(R8tmembertacctthost((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetMemberAdminEmails
	cCs'tj||j||d|jS(Nt/(R	t	ScriptURLtweb_page_urlRF(R8t
scriptnametabsolutetforce_vhost((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetScriptURLscCsG|jd|}|r*tj|}nd|tj|jfS(Ntoptionss%s/%s(RR	tObscureEmailturllibtquotetlower(R8tusertobscureRturl((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt
GetOptionsURLstxmlcharrefreplacecCstj|j}|dkrZtj}|dkr?d}q`tjjpTd}n|}t|jt	r|jj
||S||kr|jStj|j|j
||S(Nsus-ascii(R	RnRoR,RRlRmt
isinstancetdescriptiontunicodetencodetxml_to_unicode(R8Rqterrorstmcsetttrnstccset((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetDescriptions	cCsd|_tjtjjtj|p'dddtjdtj|_	||_
|rmtj||_
n	d|_
x3|jjD]%}t|dr|j|qqWg|_xEttD]7}|jdrqn|jjtt|qWd	S(
s6Set transient variables of this and inherited classes.is<site>s.locktlifetimetwithloggingR!R*RSN(t_MailList__timestampRR-R.R/RtLOCK_DIRtLIST_LOCK_LIFETIMEtLIST_LOCK_DEBUGGINGRJRQRtget_listpathRRR'R(R)R*RBtdirRt
startswithtappendR@(R8R9R;t	component((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR*/s"	"				cCs|r||_ntj|_d|_i|_tj|_d|_d|_	i|_
i|_i|_i|_
tj|_tj|_tj|_tj|_tj|_tjptj|_tjptj|ptj|_|g|_g|_ tj!|_"d|_#tj$|_%tj&|_'tj(|_)tj*|_+tj,|_-tj.|_/tj0|_1tj2|_3tj4|_5tj6|_7tj8|_9tj:|_;tj<|_=tj>|_?g|_@tjA|_BtjC|_D|jE}|djF|d|_Gd|_Hd|_Id|_Jd|_KtjL|_MtjN|_OtjP|_QtjR|_StjT|_UtjV|_WtjX|_YtjZ|_[tj\|_]g|_^d|__d|_`d|_atjb|_ctjd|_etjf|_gtjh|_itjj|_ktjl|_mtjn|_otjp|_qtjr|_sd|_ttju|_vd|_wtjx|_ytjz|_{d|_|d|_}tj~|_tj|_tj|_d|_g|_tj|_tj|_g|_g|_g|_g|_tj|_tj|_d|_g|_||_i|_x3|jjD]%}t|dr%|j|q%q%Wtj|j|_tj|_tj|_tj|j]dkrd|_n	d|_tj|_tj|_dS(	s?Assign default values - some will be overriden by stored state.iig?R!tInitVarssus-asciiiN(RQttimet
created_attvolumetmembersRtDATA_FILE_VERSIONtdata_versiontlast_post_timetpost_idtuser_optionstlanguaget	usernamest	passwordstDEFAULT_NEW_MEMBER_OPTIONStnew_member_optionst DEFAULT_RESPOND_TO_POST_REQUESTStrespond_to_post_requeststDEFAULT_LIST_ADVERTISEDt
advertisedtDEFAULT_MAX_NUM_RECIPIENTStmax_num_recipientstDEFAULT_MAX_MESSAGE_SIZEtmax_message_sizetDEFAULT_HOST_NAMEtDEFAULT_EMAIL_HOSTRVtDEFAULT_URLtDEFAULT_URL_PATTERNtDEFAULT_URL_HOSTRRat	moderatortDEFAULT_REPLY_GOES_TO_LISTtreply_goes_to_listtreply_to_addresstDEFAULT_FIRST_STRIP_REPLY_TOtfirst_strip_reply_totDEFAULT_ADMIN_IMMED_NOTIFYtadmin_immed_notifytDEFAULT_ADMIN_NOTIFY_MCHANGEStadmin_notify_mchangest$DEFAULT_REQUIRE_EXPLICIT_DESTINATIONtrequire_explicit_destinationtDEFAULT_ACCEPTABLE_ALIASEStacceptable_aliasestDEFAULT_UMBRELLA_LISTRvt$DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIXRytDEFAULT_REGULAR_EXCLUDE_LISTStregular_exclude_liststDEFAULT_REGULAR_EXCLUDE_IGNOREtregular_exclude_ignoretDEFAULT_REGULAR_INCLUDE_LISTStregular_include_liststDEFAULT_SEND_REMINDERStsend_reminderstDEFAULT_SEND_WELCOME_MSGtsend_welcome_msgtDEFAULT_SEND_GOODBYE_MSGtsend_goodbye_msgtDEFAULT_BOUNCE_MATCHING_HEADERStbounce_matching_headerstheader_filter_rulestDEFAULT_FROM_IS_LISTtfrom_is_listtDEFAULT_ANONYMOUS_LISTtanonymous_listRFtuppert	real_nameRtinfotwelcome_msgtgoodbye_msgtDEFAULT_SUBSCRIBE_POLICYtsubscribe_policytDEFAULT_SUBSCRIBE_AUTO_APPROVALtsubscribe_auto_approvaltDEFAULT_UNSUBSCRIBE_POLICYtunsubscribe_policytDEFAULT_PRIVATE_ROSTERtprivate_rostertDEFAULT_OBSCURE_ADDRESSEStobscure_addressestDEFAULT_ADMIN_MEMBER_CHUNKSIZEtadmin_member_chunksizetDEFAULT_ADMINISTRIVIAt
administriviatDEFAULT_DROP_CCtdrop_cctDEFAULT_SERVER_LANGUAGERotavailable_languagestinclude_rfc2369_headerstinclude_list_post_headertinclude_sender_headertDEFAULT_FILTER_MIME_TYPEStfilter_mime_typestDEFAULT_PASS_MIME_TYPEStpass_mime_typest"DEFAULT_FILTER_FILENAME_EXTENSIONStfilter_filename_extensionst DEFAULT_PASS_FILENAME_EXTENSIONStpass_filename_extensionstDEFAULT_FILTER_CONTENTtfilter_contenttDEFAULT_COLLAPSE_ALTERNATIVEStcollapse_alternativest!DEFAULT_CONVERT_HTML_TO_PLAINTEXTtconvert_html_to_plaintexttDEFAULT_FILTER_ACTIONt
filter_actiontDEFAULT_NONDIGESTABLEt
nondigestabletpersonalizet!DEFAULT_DEFAULT_MEMBER_MODERATIONtdefault_member_moderationt	emergencyt"DEFAULT_MEMBER_VERBOSITY_THRESHOLDtmember_verbosity_thresholdt!DEFAULT_MEMBER_VERBOSITY_INTERVALtmember_verbosity_intervaltmember_moderation_actiontmember_moderation_noticetDEFAULT_DMARC_MODERATION_ACTIONtdmarc_moderation_actiont*DEFAULT_DMARC_QUARANTINE_MODERATION_ACTIONt"dmarc_quarantine_moderation_actiont$DEFAULT_DMARC_NONE_MODERATION_ACTIONtdmarc_none_moderation_actiontdmarc_moderation_noticetdmarc_moderation_addressest"DEFAULT_DMARC_WRAPPED_MESSAGE_TEXTtdmarc_wrapped_message_texttDEFAULT_EQUIVALENT_DOMAINStequivalent_domainstaccept_these_nonmembersthold_these_nonmemberstreject_these_nonmemberstdiscard_these_nonmemberstDEFAULT_FORWARD_AUTO_DISCARDStforward_auto_discardst DEFAULT_GENERIC_NONMEMBER_ACTIONtgeneric_nonmember_actiontnonmember_rejection_noticetban_listtpasswordthold_and_cmd_autoresponsesR'R(R)RtDEFAULT_SUBJECT_PREFIXt__dict__tsubject_prefixtDEFAULT_MSG_HEADERt
msg_headertDEFAULT_MSG_FOOTERt
msg_footerR	Rntencode_ascii_prefixestDEFAULT_SCRUB_NONDIGESTtscrub_nondigesttDEFAULT_MAX_DAYS_TO_HOLDtmax_days_to_hold(R8R9tadmintcrypted_passwordturlhosttinternalnameR;((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRJs																																			cCsYdtfdY}|}x3|jD](}|j\}}||f||<q)W|S(NtCategoryDictcBs,eZdZdZdZdZRS(cSstj|tj|_dS(N(RR$RtADMIN_CATEGORIEStkeysinorder(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR$s
cSs|jS(N(RC(R8((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytkeysscSs8g}x+tjD] }|j||j|fqW|S(N(RRBRtdata(R8titemstk((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRFscSs2g}x%tjD]}|j|j|qW|S(N(RRBRRE(R8tvaluesRG((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRHs(t__name__t
__module__R$RDRFRH(((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRAs			(RRBtGetConfigCategory(R8RAt
categoriestguiRGtv((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetConfigCategoriess	cCsIxB|jD]7}t|dr
|j|}|dk	rA|Sq
q
WdS(NtGetConfigSubCategories(RBR)RPR,(R8tcategoryRMtsubcat((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRPscCsIxB|jD]7}t|dr
|j|||}|rA|Sq
q
WdS(Nt
GetConfigInfo(RBR)RS(R8RQRRRMtvalue((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRSs
cCsT||jkstdtj|r<tj|nttjt	j
d|dkrotj|n|dkrt	j
}nd||f}ytj|Wn tjk
rtj|nXtj|||_tj|dd|_|jj|j|||d||j|dkrG|jg|_n	||_dS(Ns!List name must be all lower case.R!is%s@%stcreateiR?(RtAssertionErrorR	tlist_existsR
tMMListAlreadyExistsErrortlentretsubRtACCEPTABLE_LISTNAME_CHARACTERStBadListNameErrorR,Rt
ValidateEmailtEmailAddressErrorRQRRRRRJR:RtCheckValuesRoR(R8R9R=R>tlangst	emailhostR?tpostingaddr((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytCreates*$
	

cCstjj|jd}|dtjtjf}|d}d}yYt|d}t	j
||d|jtj
rtj|jn|jWnBtk
r}tdd||dk	rtj|nnXytj|Wn+tk
r'}|jtjkr(q(nXytj||Wn+tk
ri}|jtjkrjqjnXtj||tjj||_dS(Ns
config.pcks
.tmp.%s.%ds.lasttwiR%s0Failed config.pck write, retaining old state.
%s(R-R.R/R0tsockettgethostnametgetpidR,topentcPickletdumptflushRtSYNC_AFTER_WRITEtfsynctfilenotcloseR2RtunlinktOSErrorR3R4tlinktrenametgetmtimeR(R8R=tfnamet	fname_tmpt
fname_lasttfpR>((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt__save<s: 

	


cCs|jji}xO|jjD]>\}}|ddks#t|tkrWq#n|||<q#Wtjd}z|j|Wdtj||j	X|j
dS(NiRSi(RJtrefreshR2RFttypet
MethodTypeR-tumaskt_MailList__savetSaveRequestsDbtCheckHTMLArchiveDir(R8R=tkeyRTtomask((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytSaveds
"
cCsb|jds|jdr*tj}n<|jdsH|jdrTtj}ndsftdy5tjj|}||jkrdSt
|}Wn2tk
r}|jtj
krnd|fSXttj}z_y&||}t|tkr
d	SWn2tttttjtjfk
r?}d|fSXWd|jX||_|dfS(
Ns.dbs.db.lasts.pcks	.pck.lastisBad database file names&Load() expected to return a dictionary(NN(Ns&Load() expected to return a dictionary(tendswithtmarshaltloadRjRVR-R.RuRR,RitEnvironmentErrorR3R4tintRR|tDictTypetEOFErrort
ValueErrort	TypeErrortMemoryErrort
PicklingErrortUnpicklingErrorRp(R8tdbfiletloadfunctmtimeRyR>tnowR=((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt__loadzs4
	c
Cstj|js!tjntjj|jd}|d}tjj|jd}|d}x||||fD]Q}|j	|\}}|dkr|dk	rtdd||qdSq~Pq~Wtdd|jtj|||ks
||krtdd|t
}	zKy|jjWntjk
rSt}	nX|j|||||Wd|	r|jjnXn|jj||r|j||jndS(Ns
config.pcks.lasts	config.dbR%scouldn't load config file %s
%ss(All %s fallbacks were corrupt, giving ups%fixing corrupt config file, using: %s(R	RWRFR
tMMUnknownListErrorR-R.R/R0t_MailList__loadR,RtMMCorruptListDatabaseErrortTrueRJR:RtAlreadyLockedErrortFalset_MailList__fix_corrupt_pckfileROR2tupdatetCheckVersionR`(
R8t
check_versiontpfiletplasttdfiletdlasttfileR=R>RO((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR7s@

	
	


cCs|||krytj||dWn+tk
rQ}|jtjkrRqRnXytj|dWn+tk
r}|jtjkrqnXtj||tj||dn||krxytj||dWn+tk
r
}|jtjkrqnXytj|dWn+tk
rP}|jtjkrQqQnXtj||tj||dndS(Ns.corrupts.safety(R-RtRrR3R4tremovetshutiltcopy(R8RRRRRR>((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt__fix_corrupt_pckfiles4



cCs|jtjkrdS|jd|_|jdd|j}|sX|jnz7ddlm	}|||tj|_|j
Wd|s|jnXdS(s Auto-update schema if necessary.NiRi(tUpdate(RRRRRR7RER6tversionsRRRL(R8tstored_statet	waslockedR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRs
	

c
Csdt|jd kr8tjp/tjtj|_n|jrg|jddkrg|jd|_ny/|jjr|jrt	j
|jnWnBtjk
rt
dd|j|jd|_d|_nXg}x|jD]}y|\}}}}Wn-tk
r6t
dd||jqnXy&tj|j}tj|Wn3tjtfk
rt
dd	||jqX|j||||fqW||_d
S(s+Normalize selected values to known formats.R!iiR~R%s.Bad reply_to_address "%s" cleared for list: %sisBad topic "%s" for list: %ss#Bad topic pattern "%s" for list: %sN(RRRRRRRtstripRR	R^R
R_RRFttopicsRtORR/t
splitlinesRZtcompileR%RR(R8t
goodtopicsRTR9tpatterntdesct	emptyflagt	orpattern((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR`#s:			

		cCstjs
tS|j}|j||j}x|jD]\}}|dkr]q?n|d \}}|tjkr|r|jj	|j	ks|tj
kr?|r?|j	|j	kr?tSq?WtS(s`Check if there is already an unexpired pending (un)subscription for
        this email.
        t	evictionstversioni(Rsversion(RtREFUSE_SECOND_PENDINGRt_Pending__loadt_Pending__saveRFRtSUBSCRIPTIONtaddressRtUNSUBSCRIPTIONR(R8temailtunsubtpendsRGRNtopRE((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytCheckPendingQs	
cCsy|j}tj||j|}|rStdd|j||tj|n|j|_	|j
tj|}|j
d}d|jddd|f}|j}|tjdi|d	6|d
6|jd6|d6|d
6|d6|jd6d|7}|j|}	tj||	d|d|j}
|j||}|
d=||
d<|
d=d|
d<|
j|dS(sInvite a new member to the list.

        This is done by creating a subscription pending for the user, and then
        crafting a message to the member informing them of the invitation.
        tvettes&%s banned invitation: %s (matched: %s)Rcs%s/%stconfirmRis
invite.txtRRpthostnamet
confirmurltrequestaddrRft	listownertmlistttexttlangRktSubjectsauto-submittedsauto-generatedsAuto-SubmittedN(RR	R^tGetBannedPatternRRR
tMembershipIsBannedRFt
invitationtpend_newRRR^RtmaketextRVRbRgRtUserNotificationRoRstsend(R8tuserdescRtinviteeRRfRRRptsendertmsgRr((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytInviteNewMemberfsB	
	
		


	

cCs|jsttj|j}t|dd}t|d|j}t|dd-}t|dtj}|d-kr|j	rd}qd}ntj
||j|rtj
|n|j|rtj|n|j|jjkrtjn|j}|j|}	|	rn|r@d|}
nd}
td	d
|||
|	tj|	n|rtjrtj|rd|}
td	d|||
tjdqn|rtjrtj|rtd	d
||tjdqn|r|jrtjn|r:|j	r:tjn||_||_||_ ||_!||_"|j#dkr|j$|d|pdn(|j#dks|j#dkrp|j%t&j'|}|d-krd}}
}n|}d|}
t(d}|j)|}d|j*ddd|f}tj+di|d6|jd6|d6|d6|j,dd6|d6|j-d6|d6d |d!|}t.j/||j0|d"|d |}|d#=|j1|||d$<|j0||d%<|jj2|jrd&}nd'}|d(=||d)<|j3|t4||f}td*d+|j5||
tj6nJ|j7|r|j$|n+|j8|||||tj9t(d,d-S(.sFront end to member subscription.

        This method enforces subscription policy, validates values, sends
        notifications, and any other grunt work involved in subscribing a
        user.  It eventually calls ApprovedAddMember() to do the actual work
        of subscribing the user.

        userdesc is an instance with the following public attributes:

            address  -- the unvalidated email address of the member
            fullname -- the member's full name (i.e. John Smith)
            digest   -- a flag indicating whether the user wants digests or not
            language -- the requested default language for the user
            password -- the user's password

        Other attributes may be defined later.  Only address is required; the
        others all have defaults (fullname='', digests=0, language=list's
        preferred language, password=generated).

        remote is a string which describes where this add request came from.
        tfullnameR!RtdigestR/iis from %sRs*%s banned subscription: %s%s (matched: %s)s*%s banned subscription: %s%s (Spamhaus IP)sSpamhaus IPs)%s banned subscription: %s (Spamhaus DBL)sSpamhaus DBLtwhenceit s from %(remote)ss%s/%sRRs
verify.txtRtlistaddrRpRfRcRtremotet	listadminRRRRRkRsReply-Tosauto-repliedsauto-generatedsauto-submittedsAuto-Submittedt	subscribes%s: pending %s %ss8subscriptions to %(realname)s require moderator approvalN(:RERVR	tLCDomainRR@RoR,tMakeRandomPasswordRR^tisMemberR
tMMAlreadyAMemberRtMMAlreadyPendingRRutMMBadEmailErrorRRRRRt"BLOCK_SPAMHAUS_LISTED_IP_SUBSCRIBEt	banned_ipt#BLOCK_SPAMHAUS_LISTED_DBL_SUBSCRIBEt
banned_domaint
digestabletMMCantDigestErrortMMMustDigestErrorRRRR/RtApprovedAddMemberRRRRSR}RRR^RbRRRgRsRRRRFtMMSubscribeNeedsConfirmationtHasAutoApprovedSendertHoldSubscriptiontMMNeedApproval(R8RRRR9RRR/trealnameRRRftoremotetbyt	recipientRRRtautosubtwho((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt	AddMembers			
	
	
	
	
					





	

		c
CsQ|jst|dkr*|j}n|dkrB|j}ntj|j}t|dd}t|d|j	}t|dd}	t|dtj
}
|	dkr|jrd}	qd}	ntj||j
|rtj|n|j|}|rP|rd|}nd}td	d
|j|||tj|n|j|d|d|	d|
d||j|tjd|j|j|tj|j|	rd}
nd}
td
d|j|
t||f||rJ|j	}tj}tj|z#|j ||j!||	|Wdtj"|Xn|rM|j	}tj}tj|z?|dkrdndt#|d}|j}t#d}Wdtj"|Xt$|t%r|j&tj'|d}ntj(di|d6t||fd6|d6d|}t)j*|||}|j+|ndS(sAdd a member right now.

        The member's subscription must be approved by what ever policy the
        list enforces.

        userdesc is as above in AddMember().

        ack is a flag that specifies whether the user should get an
        acknowledgement of their being subscribed.  Default is to use the
        list's default flag value.

        admin_notif is a flag that specifies whether the list owner should get
        an acknowledgement of this subscription.  Default is to use the list's
        default flag value.
        RR!RRR/iis from %sRs*%s banned subscription: %s%s (matched: %s)Rs	 (digest)Rs%s: new%s %s, %sNt(t)s&%(realname)s subscription notificationtreplacesadminsubscribeack.txtRpRzRR(,RERVR,RRR	RRR@RoRRR^RR
RRRRRtaddNewMembertsetMemberOptionRtDisableMimetmime_is_default_digesttModerateRRFRRRltset_languagetSendSubscribeAcktgetMemberPasswordtset_translationRSRtUnicodeTypeRRnRRtOwnerNotificationR(R8Rtacktadmin_notifRRRR9RRR/RtsourcetkindtotransRRkR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR#s~			

	

		
	
&	

	cCs]t|\}}|jdkr:|j||||n|j|tjtddS(Nis*unsubscriptions require moderator approval(RRtApprovedDeleteMembertHoldUnsubscriptionR
RRS(R8R9RR
tuserackRR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytDeleteMembers
	cCsP|dkr|j}n|dkr0|j}nt|\}}|j|}|j||rw|j||ntj|j	|r|j
}td}	tj
di|d6|j
d6|dkrdndt|dd6d	|}
tj||	|
}|j|n|r*d
|}nd}tdd|j||dS(
Ns%%(realname)s unsubscribe notificationsadminunsubscribeack.txtRzRpR!RRRRs; %sRs%s: deleted %s%s(R,RRRtgetMemberLanguagetremoveMembertSendUnsubscribeAckRRRoRRSR	RRRRRRF(R8R9RR
RRt	emailaddrtuserlangRRkRR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRs4
	

*	
	cCs|j|||sdSxtjD]}||jkrEq'nt|dd}|j|jkroq'n|j|sq'n|jz|j|||jWd|j	Xq'WdS(NR:i(
t
setMemberNameR	t
list_namesRFR#RVRR6RRL(R8RhR9tgloballyRpR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytChangeMemberNames 
c	Cstj|}tj||rS|j|rS||j|krStjn||jjkrwtj	n|j
}|j|}|rtdd||||tj
|n|jtj|||}d|jddd|f}|j|}tjdi|d6|jd	6|d
6|d6|jdd
6dd6|jd6|d6d|d|}	tj||j|d|	d|}
|
d=|j|||
d<|j||
d<|
j|dS(NRs0%s banned address change: %s -> %s (matched: %s)s%s/%sRRis
verify.txtRRRpRfRcRR!RRRRRRRkRsReply-To(R	RR^RtgetMemberCPAddressR
RRuRRRRRRRRtCHANGE_OF_ADDRESSRRRR^RbRRRgRsR(R8toldaddrtnewaddrRRRRfRRRR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytChangeMemberAddresssJ
	




cCs|j|}|r@tdd|j|||tj|n|j|}|j|r|j||kr||kr|j|qn |j|||j	|||sdSxt
jD]
}||jkrqnt
|dd}|j|jkrqn|j|s&qn|j|r;qn|jz|j|}|j|r|j||kr||kr|j|qn |j|||j	|||jWd|jXqWdS(NRs0%s banned address change: %s -> %s (matched: %s)R:i(RRRR
RRRRtchangeMemberAddresstlog_and_notify_adminR	RRFR#RVR6RRL(R8RRRRt	cpoldaddrRpR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytApprovedChangeMemberAddresssH		
c
Cs"tdd|j|||jr|j}tj}tj|z|j}td}Wdtj	|X|j
|}|dkrd}nt|t
r|jtj|d}ntjdi|d6|d	6|d
6|jd6d|}tj|||}	|	j|ndS(
s8Log member address change and notify admin if requested.Rs(%s: changed member address from %s to %ss(%(realname)s address change notificationNR!Rsadminaddrchgack.txtR9RRRpR(RRFRRoRRlRRRSRt
getMemberNameR,RRRR	RnRRRR(
R8RRRR
RRkR9RR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR!3s0			
		

	cCs|j|}|dkr.tjd|ny|d}|d}Wn$tk
rltjd|fnX|tjkrtatd}yc|d}t	|t
r||7}td}n|j}|j}	|j
}
|j}|j}Wn$tk
rtjd|fnXtjat|dt}
|
rj|
|jkr|j|
|tjqnV|jdkr|j|r|j||	|
|||j}tjtdn|j|d||||
||fS|tjkrX|d}tat	|tjr&td
}ntd}tja|j|d|||fS|tjkr|\}}}|j ||||||fS|tj!kr|d}d}t	|tjr|j"d|j"d}|sy&t#t$j%j&|ddd}Wnt'k
r'd}nX|rt(|j)dt*}xt*r|j+}|sePn|j,swqIn|j-d}|dkr|| j,j.dks|| j,j.dkr||dj,}qnPqIWqqn|dk	rM|j/t0j1t0j2g|t0j3kr1t0j4}qV|j5||tj6n	t0j7}y|j8||Wn!t9k
rt:dd|nX||fS|tj;kr|d}|j<|t=j>||fSdst?d|dS(NsNo cookie record for %siisop-less data %ssvia email confirmationsvia web confirmationsbad subscr data %sRiis8subscriptions to %(name)s require administrator approvalRsemail confirmationsweb confirmationtApprovedtApproveRtplaintdecodet:tapprovetapprovedR%s"Could not process HELD_MESSAGE: %ss
Bad op: %s(ii(@tpend_confirmR,R
tMMBadConfirmationRRRR RSRRRRR/RRRR@RRFtSendHostileSubscriptionNoticetHostileSubscriptionErrorRRRRRRRRRRR#tHELD_MESSAGER5tlistRt	Iteratorsttyped_subpart_iteratort
IndexErrorRtget_payloadRtreadlineRtfindRtAuthenticateRt
AuthListAdmintAuthListModeratortUnAuthorizedtAPPROVEtpend_rependtMMBadPasswordErrortDISCARDt
HandleRequesttKeyErrorRt	RE_ENABLEtsetDeliveryStatusRtENABLEDRV(R8RftcontexttrecRRERRRhRR/RRRR9RRRRGR+tsubpartRtlinetitactionRz((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytProcessConfirmationSs



				

			
	




			



c
Cs|j|dtr$tjtn|dkrB|j|}n|jtj	|}d|j
ddd|f}|j}|dk	rd|}td}nd}d}t
jd	i|d
6|jd6|d6|d
6|jdd6|d6|jd6|d6d|d|}tj||j|d|d|}	|	d=|j|||	d<|j||	d<|	d=d|	d<|	j|dS(NRs%s/%sRRiRs from %(remote)sR!s	unsub.txtRRRpRfRcRRRRRRRRkRsReply-Tosauto-submittedsauto-generatedsAuto-Submitted(RRR
RRR,RRRRRRRSR	RRuR^RbRRRgRtR(
R8RhRRRfRRRRR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytConfirmUnsubscriptionsB
	





cCs|j}|jd}|dkrb|d|!}||d}|d|}|jj}n%d|j|jf}|j}g}g}x-dD]%}	|jt|j|	gqWxt|D]l\}
}|dkrqn|j}|j	dd}||ks||kr#t
S|j||fqWd
}
|jj
}xo|D]g\}}xX|D]P}|j}|sqlnd|kr|
||rt
S|
||rlt
SqlWqYWtS(
stTrue if list name or any acceptable_alias is included among the
        addresses in the recipient headers.
        RSiiRTs%s@%sttotccs	resent-tos	resent-cccSs`y tj||tjrtSWn9tjk
r[tjtj||tjr\tSnXtS(N(RZtmatcht
IGNORECASERR%tescapeR(RRh((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytdomatch$s!(stosccs	resent-tos	resent-ccN(RFRURRRVR&Rtget_allR,RxRRRRRR(R8RRXRYRZR[tlistrealnametrecipsRMtheaderRRht	localpartRRtaliasestaliaststripped((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytHasExplicitDestsD

#	
cCsg}x|jjdD]}|j}|s|ddkrHqn|jd}|dkr|tdd|j|q|| }||dj}ytj|tj	}Wn/tj
k
r}tdd|j||qX|j|||fqW|S(	s:Return a list of triples [(field name, regex, line), ...].s
it#R)tconfigs&bad bounce_matching_header line: %s
%sis=bad regexp in bounce_matching_header line: %s

%s (cause: %s)(RRxRR7RRtlstripRZRRPR%R(R8tallRHRIRVRTtcreR>((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytparse_matching_header_optCs$	
cCsTxM|jD]?\}}}x-|j|gD]}|j|r/|Sq/Wq
WdS(sReturn true if named header field matches a regexp in the
        bounce_matching_header list variable.

        Returns constraint line which matches or empty string for no
        matches.
        i(RaRStsearch(R8RRVR`RHRT((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pythasMatchingHeadercs
c	Cs|dkr|j}ntj|tjdkr8dStjd }|jj	|}|dksv|d|kr|df|j|<dS|\}}|dkrt
dd|dS|tjkrpt
dd||df|j|<tjdi|d	6d
|j
|jfd6|d6|jd
6d|}tj||jtd|d|}|j|dS||df|j|<dS(sReturn true if Mailman should auto-respond to this sender.

        This is only consulted for messages sent to the -request address, or
        for posting hold notifications, and serves only as a safety value for
        mail loops with email 'bots.
        iiiRs,-request/hold autoresponse discarded for: %ss,-request/hold autoresponse limit hit for: %sisnomoretoday.txtRs%s@%sRptnumt
owneremailRs(Last autoresponse notification for todayN(R,RoRRRtMAX_AUTORESPONSES_PER_DAYRt	localtimeR0R5RR	RRRVRbRRRSR(	R8RRttodayRtdatetcountRR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytautorespondToSenderpsD
		
		
cCs(|j||jp'|j|tjS(s\Returns matched entry in ban_list if email matches.
        Otherwise returns None.
        (t
GetPatternR.RtGLOBAL_BAN_LIST(R8R((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRscCsGt}|j||jddrCt}tdd|j|n|S(sReturns True and logs if sender matches address or pattern
        or is a member of a referenced list in subscribe_auto_approval.
        Otherwise returns False.
        tat_listRRs#%s: auto approved subscribe from %s(RRlRRRRF(R8Rtauto_approve((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRs				c

Csd}g|D]=}|jr
|jdp:|jdr
|j^q
}tj|dd}|j|jr~|SxZ|D]R}|jdr
y&tj||tj	r|}PnWqtj
k
r	}	|pd}
tdd|
|j|t
|	qXq|r|jdr|djj}||jkritdd||jqnyt|d	t}Wn3tjk
rtdd
||j|qnX|j|jr|}PqqqW|S(sReturns matched entry in pattern_list if email matches.
        Otherwise returns None.  The at_list argument, if "true",
        says process the @listname syntax and provides the name of
        the list attribute for log messages.
        t^RTtfoldcaseiR.R%s %s in %s has bad regexp "%s": %ss%s in %s references own listR:s(%s in %s references non-existent list %sN(R,RRR	t	List2Dictthas_keyRRZRbRPR%RRFtstrR#RR
RR(
R8Rtpattern_listRntmatchedtxt
plainaddrstaddrdictRR>t	attr_nametmnametmother((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyRlsR1
	
	cCsT|j}tj|kr+|jtjng|D]}tjj|r2|^q2S(N(RRRRtLC_DESCRIPTIONSRs(R8RaR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pytGetAvailableLanguagess	N(:RIRJR,R$RDRIR6RLRERFR0R^R`RbRgReRsRtRuR}RRRR*RRORPRSRdRRRRR7RRR`RRRRRRRRRR#R!RKRLR[RaRcRkRRRlR~(((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyR#Zsp&		
																(	(		:6	"		..	\	!		:	:	 )	D	 	
1		B(Et__doc__tsysR-RRR3RZRRfRRjt	cStringIORRRttypestemail.IteratorsRtemail.UtilsRRRtemail.HeaderRtMailmanRR	R
RtMailman.UserDescRtMailman.ArchiverR
tMailman.AutoresponderRtMailman.BouncerRtMailman.DelivererRtMailman.DigesterRtMailman.GatewayManagerRtMailman.HTMLFormatterRtMailman.ListAdminRtMailman.SecurityManagerRtMailman.TopicMgrRRRRtMailman.OldStyleMembershipsRRRRtMailman.Logging.SyslogRRSR tEMPTYSTRINGRRRt	NameErrorR#(((s6/usr/local/cpanel/3rdparty/mailman/Mailman/MailList.pyt<module>sh
		


Back to Directory File Manager