please find attached a small python class (generated with asn1ate) which
might help to generate the needed data to send a request to the extdom
plugin directly. This might be useful to write tests.

To generate the base64 encoded data needed e.g. for the ldapexop command
I used:

from pyasn1.codec.der.encoder import encode as der_encoder
from base64 import b64encode
from pyasn1.codec.native.decoder import decode
from s2n_req import ExtdomRequestValue

ad_user = 'aduser'
ad_domain = 'ad.domain'
request_type = 'full'

name = { 'domainname' : ad_domain, 'objectname' : ad_user }
data = { 'name' : name }
r = { 'inputType' : 'name' , 'requestType' : request_type, 'data' : data }

req = decode(r, asn1Spec=ExtdomRequestValue())
der_serialisation = der_encoder(req)
print b64encode(der_serialisation)

(sorry for the bad python)

$ python my_req.py 

Now you can send the request to the extdom plugin by calling:

ldapexop -x 

If the user was found ldapexop will return a base64 encoded reply. So
far using e.g. dumpasn1 was sufficient for me to look at the reply
because I mainly used the requests to generate load for the extdom
plugin and didn't cared much about the reply. But if I'll find some time
I might add a class to decode the reply properly later.


# Auto-generated by asn1ate v.0.6.1.dev0 from s2n_req.asn1
# (last modified on 2018-01-15 15:15:47.250042)

from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful

class NameDomainData(univ.Sequence):

NameDomainData.componentType = namedtype.NamedTypes(
    namedtype.NamedType('domainname', univ.OctetString()),
    namedtype.NamedType('objectname', univ.OctetString())

class PosixGid(univ.Sequence):

PosixGid.componentType = namedtype.NamedTypes(
    namedtype.NamedType('domainname', univ.OctetString()),
    namedtype.NamedType('gid', univ.Integer())

class PosixUid(univ.Sequence):

PosixUid.componentType = namedtype.NamedTypes(
    namedtype.NamedType('domainname', univ.OctetString()),
    namedtype.NamedType('uid', univ.Integer())

class InputData(univ.Choice):

InputData.componentType = namedtype.NamedTypes(
    namedtype.NamedType('sid', univ.OctetString()),
    namedtype.NamedType('name', NameDomainData()),
    namedtype.NamedType('uid', PosixUid()),
    namedtype.NamedType('gid', PosixGid())

class ExtdomRequestValue(univ.Sequence):

ExtdomRequestValue.componentType = namedtype.NamedTypes(
univ.Enumerated(namedValues=namedval.NamedValues(('sid', 1), ('name', 2), 
('posixuid', 3), ('posixgid', 4)))),
univ.Enumerated(namedValues=namedval.NamedValues(('simple', 1), ('full', 2), 
('fullwithmembers', 3)))),
    namedtype.NamedType('data', InputData())

FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to