das.py

来自「ftam等标准协议服务器和客户端的源代码。」· Python 代码 · 共 1,594 行 · 第 1/3 页

PY
1,594
字号
-- das.py-- $Header: /xtel/isode/isode/dsap/x500as/RCS/das.py,v 9.0 1992/06/16 12:14:33 isode Rel $------ $Log: das.py,v $-- Revision 9.0  1992/06/16  12:14:33  isode-- Release 8.0--------				  NOTICE----    Acquisition, use, and distribution of this module and related--    materials are subject to the restrictions of a license agreement.--    Consult the Preface in the User's Manual for the full terms of--    this agreement.----DAS	{	joint-iso-ccitt	ds(5)	modules(1)	directoryAbstractService(2)	}DEFINITIONS ::=PREFIXES encode decode printBEGIN-- EXPORTS--	DirectoryBindArgument ,--	ReadArgument ,--	ReadResult ,--	AbandonArgument ,--	AbandonResult ,--	CompareArgument ,--	CompareResult ,--	ListArgument ,--	ListResult ,--	SearchArgument ,--	SearchResult ,--	AddEntryArgument ,--	AddEntryResult ,--	RemoveEntryArgument ,--	RemoveEntryResult ,--	ModifyEntryArgument ,--	ModifyEntryResult ,--	ModifyRDNArgument ,--	ModifyRDNResult ,--	AbandonFailedParm ,--	AttributeErrorParm ,--	NameErrorParm ,--	ReferralParm ,--	SecurityErrorParm ,--	ServiceErrorParm ,--	UpdateErrorParm;IMPORTS	Attribute ,	AttributeType ,	AttributeValue ,	AttributeValueAssertion ,	DistinguishedName ,	Name ,	RelativeDistinguishedName		FROM IF			{			joint-iso-ccitt			ds(5)			modules(1)			informationFramework(1)			}	OperationProgress ,	ContinuationReference ,	InvokeID		FROM DO			{			joint-iso-ccitt			ds(5)			modules(1)			distributedOperations(3)			}	Certificate ,	CertificationPath ,	AlgorithmIdentifier		FROM AF			{			joint-iso-ccitt			ds(5)			modules(1)			authenticationFramework(7)			};ENCODER encodeSimpleCredentials [[P struct ds_bind_arg *]]	::=	SEQUENCE	{	name		[0] DistinguishedName [[p dba_dn]],	validity		[1] SET [[ T struct ds_bind_arg * $ * ]]		{		time1			[0] UTCTime [[s dba_time1]] OPTIONAL,		time2			[1] UTCTime [[s dba_time2]] OPTIONAL,		random1			[2] BIT STRING [[x dba_r1.value $ dba_r1.n_bits]] 			OPTIONAL,		random2			[3] BIT STRING [[x dba_r2.value $ dba_r2.n_bits]]			OPTIONAL		}		OPTIONAL <E<parm -> dba_auth_type > DBA_AUTH_SIMPLE>>			 <D<0>>,		%E{			parm->dba_vtmp = parm->dba_passwd;		%}	password		[2] OCTET STRING [[o dba_vtmp $ dba_passwd_len]]		%D{		if ((*parm)->dba_vtmp) {			bcopy((*parm)->dba_vtmp, (*parm)->dba_passwd, (*parm)->dba_passwd_len);			free((*parm)->dba_vtmp);			if ((*parm)->dba_auth_type == DBA_AUTH_NONE)			   (*parm)->dba_auth_type = DBA_AUTH_SIMPLE;		}		%}		OPTIONAL <E<parm->dba_auth_type != DBA_AUTH_NONE>><D<0>>	}-- Two temp labels to aid Pepsy parameter passingTAlgorithmIdentifier [[P struct signature *]]	::= AlgorithmIdentifier [[ p &parm->alg]]TBitString [[P struct signature *]]	::= BIT STRING	[[x parm->encrypted $ parm->n_bits ]]TokenToSign [[P struct ds_bind_arg *]]	::=	SEQUENCE	{	algorithm		[0] AlgorithmIdentifier [[p &parm->dba_alg]],	name		[1] DistinguishedName [[p dba_dn]] ,	time		[2] UTCTime [[s dba_time1]],	random		[3] BIT STRING [[x dba_r1.value $ dba_r1.n_bits]]	}Token [[P struct ds_bind_arg *]]	::=	SEQUENCE	{		TokenToSign [[p *]]		%D{			if ( (*parm)->dba_sig == (struct signature *)NULL)			     (*parm)->dba_sig = (struct signature *) malloc					        (sizeof (struct signature));		%},		TAlgorithmIdentifier [[p dba_sig]],		TBitString [[p dba_sig]]	}StrongCredentials [[P struct ds_bind_arg *]]	::=	SET	{	certificationPath		[0] CertificationPath [[p dba_cpath]]		    OPTIONAL,	bindToken		[1] Token [[p *]]	}Credentials [[P struct ds_bind_arg *]]	::=	CHOICE <E< parm->dba_auth_type == DBA_AUTH_STRONG ? 2 : 1 >>	       <D< (*parm)->dba_auth_type >>	{	simple		[0] SimpleCredentials [[p *]]		%D{		   if ((*parm)->dba_time1)		     (*parm)->dba_auth_type = DBA_AUTH_PROTECTED;		%},	strong		[1] StrongCredentials [[p *]],	externalProcedure 		[2] EXTERNAL [[p dba_vtmp]]	}-- Pulled upVersions  ::=  BIT STRING	{	v1988(0)	}-- Pulled upSecurityProblem	::=	INTEGER	{	inappropriateAuthentication(1) ,	invalidCredentials(2) ,	insufficientAccessRights(3) ,	invalidSignature(4) ,	protectionRequired(5) ,	noInformation(6)	}-- Pulled upServiceProblem	::=	INTEGER	{	busy(1) ,	unavailable(2) ,	unwillingToPerform(3) ,	chainingRequired(4) ,	unableToProceed(5) ,	invalidReference(6) ,	timeLimitExceeded(7) ,	administrativeLimitExceeded(8) ,	loopDetected(9) ,	unavailableCriticalExtension(10) ,	outOfScope(11) ,	ditError(12)	}EntryInformationSelection [[P struct entryinfoselection *]]	::=	SET	{	attributeTypes		CHOICE [[ T struct entryinfoselection * $ *]]		<D< (*parm)->eis_allattributes>>		<E< parm->eis_allattributes ? 1 : 2>>		{		allAttributes			[0] NULL,		select			[1] SET OF [[ T struct attrcomp * $ eis_select ]] <<attr_link>>				AttributeType [[p attr_type]]		}		%D{			if ((*parm)->eis_allattributes == 1)			   (*parm)->eis_allattributes = TRUE;			else			   (*parm)->eis_allattributes = FALSE;		%}		    -- DEFAULT allAttributes NULL,		    OPTIONAL <E<parm->eis_allattributes != TRUE>><D<0>>,	infoTypes		[2] INTEGER [[i eis_infotypes]]		{		attributeTypesOnly(0) ,		attributeTypesAndValues(1)		}		    DEFAULT attributeTypesAndValues	}ServiceControls [[P struct svccontrol *]]	::=	SET	{	%E{	if (parm->svc_options != 0) {		parm->svc_len = 5;		parm->svc_tmp = int2strb_alloc (parm->svc_options,parm->svc_len);	}	%}	options		[0] BIT STRING [[x svc_tmp $ svc_len]]		{		preferChaining(0) ,		chainingProhibited(1) ,		localScope(2) ,		dontUseCopy(3) ,		dontDereferenceAliases(4)		}		%E{		if (parm->svc_tmp)			free (parm->svc_tmp);		%}		%D{		if ((*parm)->svc_len) {			(*parm)->svc_options = strb2int((*parm)->svc_tmp,(*parm)->svc_len);			free ((*parm)->svc_tmp);		}		%}		-- DEFAULT {},		OPTIONAL <D<0>> <E<parm->svc_options != 0>>,	priority		[1] INTEGER [[i svc_prio]]		{		low(0) ,		medium(1) ,		high(2)		}		DEFAULT medium,	timeLimit		[2] INTEGER [[i svc_timelimit]]		    OPTIONAL <E<parm->svc_timelimit != SVC_NOTIMELIMIT>>			     <D<0>>,	sizeLimit		[3] INTEGER [[i svc_sizelimit]]		    OPTIONAL <E<parm->svc_sizelimit != SVC_NOSIZELIMIT>>			     <D<0>>,	scopeOfReferral		[4] INTEGER [[i svc_scopeofreferral]]		{		dmd(0) ,		country(1)		}		OPTIONAL <E<parm->svc_scopeofreferral != SVC_REFSCOPE_NONE>>			 <D<0>>	}-- Pulled upProtectionRequest 	::=	INTEGER	{	none (0) ,	signed (1)	}-- Pespy tempDBitString [[P struct random_number * ]] ::=	BIT STRING [[ x value $ n_bits ]]SecurityParameters [[P struct security_parms *]]	::=	SET	{	certificationPath		[0] CertificationPath [[p sp_path]]		    OPTIONAL,	name		[1] DistinguishedName [[p sp_name]]		    OPTIONAL,	time		[2] UTCTime [[s sp_time]]		    OPTIONAL,	random		[3] TBitString [[p sp_random]]		    OPTIONAL,	target		[4] ProtectionRequest [[i sp_target]]		    -- OPTIONAL		    DEFAULT 0	}Extension [[P struct extension *]]	::=	SET	{	identifier		[0] INTEGER [[i ext_id]] ,	critical		[1] BOOLEAN [[b ext_critical]]		    DEFAULT FALSE,	item		[2] ANY DEFINED BY identifier [[a ext_item]]	}EntryInformation [[P struct entrystruct *]]	::=	SEQUENCE	{		DistinguishedName [[p ent_dn]],		%E{			if (parm->ent_iscopy == INFO_MASTER)			   parm->ent_pepsycopy = TRUE;				else			   parm->ent_pepsycopy = FALSE;		%}	fromEntry		BOOLEAN [[b ent_pepsycopy]]		%D{			if ( (*parm)->ent_pepsycopy)			   (*parm)->ent_iscopy = INFO_MASTER;			else			   (*parm)->ent_iscopy = INFO_COPY;		%}		DEFAULT TRUE,		SET OF [[ T struct attrcomp * $ ent_attr ]] <<attr_link>>			CHOICE [[ T struct attrcomp * $ *]] 			<D<0>>			<E< parm->attr_value == NULLAV ? 1 : 2>>			{				AttributeType [[p attr_type]],				Attribute [[p *]]			} OPTIONAL		}	    %D{		   /* Order them */		   		   Attr_Sequence as;		   Attr_Sequence as_next;		   Attr_Sequence newas = NULLATTR;		   		   for (as=(*parm)->ent_attr; as != NULLATTR; as = as_next) {		       as_next = as->attr_link;		       as->attr_link = NULLATTR;		       newas = as_merge (newas,as);		   }		   (*parm)->ent_attr = newas;	    %}-- Pulled upLimitProblem	::=	INTEGER 	{	timeLimitExceeded(0) ,	sizeLimitExceeded(1) ,	administrativeLimitExceeded(2)	}PartialOutcomeQualifier [[P struct part_outcome *]]	::=	SET	{	limitProblem		[0] LimitProblem [[i parm->poq_limitproblem]]		    OPTIONAL <E<parm->poq_limitproblem != LSR_NOLIMITPROBLEM>> 			     <D<0>>,					 	unexplored		[1] SET OF [[ T struct continuation_ref * $ poq_cref ]] <<cr_next>>		       ContinuationReference [[p *]]			    OPTIONAL,	unavailableCriticalExtensions		[2] BOOLEAN [[b poq_no_ext]]		    DEFAULT FALSE	}FilterItem [[P struct filter_item *]]	::=	CHOICE << fi_type >>	{	equality		[0] AttributeValueAssertion [[p &parm->fi_un.fi_un_ava]],	substrings 		[1] ANY [[a &parm->fi_un.fi_un_substrings]] 			[[D substring_decode ]] [[E substring_encode]] 			[[F substring_free ]],-- A bit too complex for Pepsy just yet.--		[1] SEQUENCE --		{--		type--			AttributeType,--		strings--			SEQUENCE OF CHOICE {--				initial--					[0] AttributeValue,--				any--					[1] AttributeValue,--				final--					[2] AttributeValue--			}--		} 	greaterOrEqual		[2] AttributeValueAssertion [[p &parm->fi_un.fi_un_ava]],	lessOrEqual		[3] AttributeValueAssertion [[p &parm->fi_un.fi_un_ava]],	present		[4] AttributeType [[p fi_un.fi_un_type]],	approximateMatch		[5] AttributeValueAssertion [[p &parm->fi_un.fi_un_ava]]	}Filter [[P struct s_filter *]]	::=	CHOICE <<flt_type>>	{	item		[0] FilterItem [[p &parm->flt_un.flt_un_item]],	and		[1] SET OF [[ T struct s_filter * $ parm->flt_un.flt_un_filter ]] <<flt_next>>			Filter [[p *]],	or		[2] SET OF [[ T struct s_filter * $ parm->flt_un.flt_un_filter ]] <<flt_next>>			Filter [[p *]],	not		[3] Filter [[p parm->flt_un.flt_un_filter]]	}-- Pepsy !!!TAttributeType [[P struct attrcomp *]] 	::= CHOICE <E<1>><D<0>> {		    AttributeType [[p attr_type]]	    }EntryModification [[P struct entrymod *]]	::=	CHOICE <<em_type>>	{	addAttribute		[0] Attribute [[p em_what]],	removeAttribute		[1] TAttributeType [[p em_what]],	addValues		[2] Attribute [[p em_what]],	removeValues		[3] Attribute [[p em_what]]	}-- Pulled upAbandonProblem	::=	INTEGER	{	noSuchOperation(1) ,	tooLate(2) ,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?