Link to home
Start Free TrialLog in
Avatar of ssbb123
ssbb123

asked on

How do I convert a char * to a struct berval for ldap_sasl_bind_s?

I am new to C so any guidance will be greatly appreciated.  ldap_simple_bind_s is depricated in favor of ldap_sasl_bind_s.  I need to recompile a program that previously used ldap_simple_bind_s.  The password value is passed to the function that is calling ldap_sasl_bind_s as a char *, but sasl_bind_s is wanting a struct berval.  Do I need to convert it, and if so, how?

LDAP_F( int )
ldap_simple_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */
        LDAP *ld,
        LDAP_CONST char *who,
        LDAP_CONST char *passwd ));

LDAP_F( int )
ldap_sasl_bind_s LDAP_P((
        LDAP                    *ld,
        LDAP_CONST char *dn,
        LDAP_CONST char *mechanism,
        struct berval   *cred,
        LDAPControl             **serverctrls,
        LDAPControl             **clientctrls,
        struct berval   **servercredp ));
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ssbb123
ssbb123

ASKER

That works! I was trying to make it much more complicated than that =).  Thanks!!!
Good to know ;o)

BTW, you should close your questions when they're resolved.