Author: vlendec
Date: 2004-08-10 19:10:46 +0000 (Tue, 10 Aug 2004)
New Revision: 1702
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1702&nolog=1
Log:
A little more ldap stuff
Modified:
   trunk/source/lib/smb_ldap.c

Changeset:
Modified: trunk/source/lib/smb_ldap.c
===================================================================
--- trunk/source/lib/smb_ldap.c 2004-08-10 18:47:26 UTC (rev 1701)
+++ trunk/source/lib/smb_ldap.c 2004-08-10 19:10:46 UTC (rev 1702)
@@ -1191,7 +1191,7 @@
                r->dn = blob2string_talloc(msg->mem_ctx, blob);
                if (asn1_peek_tag(data, 0x80)) {
                        int pwlen;
-                       r->creds.password = NULL;
+                       r->creds.password = "";
                        /* Mechanism 0 (SIMPLE) */
                        asn1_start_tag(data, 0x80);
                        pwlen = asn1_tag_remaining(data);
@@ -1410,8 +1410,8 @@
        return !data->has_error;
 }
 
-static BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
-                                char **host, uint16 *port, BOOL *ldaps)
+BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
+                         char **host, uint16 *port, BOOL *ldaps)
 {
        int tmp_port = 0;
        fstring protocol;
@@ -1740,6 +1740,21 @@
        return res;
 }
 
+struct ldap_message *new_ldap_simple_bind_msg(const char *dn, const char *pw)
+{
+       struct ldap_message *res = new_ldap_message();
+
+       if (res == NULL)
+               return NULL;
+
+       res->type = LDAP_TAG_BindRequest;
+       res->r.BindRequest.version = 3;
+       res->r.BindRequest.dn = talloc_strdup(res->mem_ctx, dn);
+       res->r.BindRequest.mechanism = LDAP_AUTH_MECH_SIMPLE;
+       res->r.BindRequest.creds.password = talloc_strdup(res->mem_ctx, pw);
+       return res;
+}
+
 BOOL ldap_setsearchent(struct ldap_connection *conn, struct ldap_message *msg,
                       const struct timeval *endtime)
 {

Reply via email to