Skip to content

Executable plugin broken when using binaryAttribute as pivot #3

Open
@coudot

Description

@coudot

From http://tools.lsc-project.org/issues/766

I am using the executable plugin as a destination service and am syncing from active directory. I am trying to use objectGUID as the pivot attribute. For example, on a particular LDAP entry, an LDAP search of active directory returns:

objectGUID:: awOS8elHDEiszxWm8l1aPA==

But, when I run LSC, the following is sent to my script:

objectguid:: awPvv73vv73vv71HDEjvv73vv70V77+977+9XVo8

I was able to fix the issue by modifying AbstractExecutableLdifService.java and changing the toLdif method. I changed the following line:

LdifLayout.printAttributeToStringBuffer(sb, attributeName, Collections.singletonList((Object)attributes.getStringValueAttribute(attributeName)));

to:

LdifLayout.printAttributeToStringBuffer(sb, attributeName, new ArrayList<Object>(attributes.getDatasets().values()));

I am fairly new to LDAP and LSC, so I am not sure if this breaks other things, but the proper string is now passed to my script...

Here is my connection information:

        <ldapConnection>
            <name>ldap-src-conn</name>
            <url>ldap://%LDAP_HOST%:%LDAP_PORT%/%LDAP_BASE_DN%</url>
            <username>%LDAP_USERNAME%</username>
            <password>%LDAP_PASSWORD%</password>
            <authentication>SIMPLE</authentication>
            <referral>IGNORE</referral>
            <derefAliases>NEVER</derefAliases>
            <version>VERSION_3</version>
            <pageSize>-1</pageSize>
            <factory>com.sun.jndi.ldap.LdapCtxFactory</factory>
            <tlsActivated>false</tlsActivated>
            <binaryAttributes>
                <string>objectguid</string>
            </binaryAttributes>
        </ldapConnection>

        <pluginConnection>
            <name>executable</name>
            <url>fake</url>
            <username>fake</username>
            <password>fake</password>
            <binaryAttributes>
                <string>objectguid</string>
            </binaryAttributes>
        </pluginConnection>
    </connections>

Here is my ldap source service:

            <ldapSourceService>
                <name>groups-source-service</name>
                <connection reference="ldap-src-conn" />
                <baseDn>%LDAP_BASE_DN%</baseDn>
                <pivotAttributes>
                    <string>objectguid</string>
                </pivotAttributes>
                <fetchedAttributes>
                    <!--<string>objectGUID</string>-->
                    <string>name</string>
                </fetchedAttributes>
                <getAllFilter>(&amp;(objectClass=group))</getAllFilter>
                <getOneFilter>(&amp;(objectClass=group)(objectGUID={objectGUID}))</getOneFilter>
                <cleanFilter>(&amp;(objectClass=group)(objectGUID={objectGUID}))</cleanFilter>
            </ldapSourceService>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions