The branch, master has been updated
       via  693781d s3-waf: create a smbldap.so library.
       via  e81d550 s3-smbldap: remove dependency to secrets subsystem.
       via  65e2944 s3-smbldap: extend smbldap_init() with binddn/bindsecret 
arguments.
       via  af50d7a s3-smbldap: remove duplicate prototype of smbldap_init().
       via  636fa7a s3-net: use better state variable name for smbldap_state.
       via  8312ee1 s3-passdb: split out passdb/pdb_ldap_schema.c
       via  28f8ccb s3: move smbldap_util to pdb_ldap_util.
       via  25a00b4 s3-smbldap: use include/smb_ldap.h in smbldap.h
      from  ffb846b lib/util/debug: with log level = 10 we should be more 
verbose

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 693781db8962a39af376e5d5df0d36e1f3ad127b
Author: Günther Deschner <g...@samba.org>
Date:   Mon Oct 17 17:19:27 2011 +0200

    s3-waf: create a smbldap.so library.
    
    Guenther
    
    Autobuild-User: Günther Deschner <g...@samba.org>
    Autobuild-Date: Wed Nov 16 14:03:05 CET 2011 on sn-devel-104

commit e81d5505f48de800d2314cf6971a1417ca915fde
Author: Günther Deschner <g...@samba.org>
Date:   Tue Nov 15 23:57:58 2011 +0100

    s3-smbldap: remove dependency to secrets subsystem.
    
    Guenther

commit 65e2944c678a7d4d111ee00e9e964fde14b163a6
Author: Günther Deschner <g...@samba.org>
Date:   Tue Nov 15 23:56:38 2011 +0100

    s3-smbldap: extend smbldap_init() with binddn/bindsecret arguments.
    
    Guenther

commit af50d7a57fcc69d0bc5928410618f253071e9759
Author: Günther Deschner <g...@samba.org>
Date:   Tue Nov 15 19:01:45 2011 +0100

    s3-smbldap: remove duplicate prototype of smbldap_init().
    
    Guenther

commit 636fa7a2cd6846b1a93cbc869735442b3a98ed60
Author: Günther Deschner <g...@samba.org>
Date:   Tue Nov 15 17:53:25 2011 +0100

    s3-net: use better state variable name for smbldap_state.
    
    Guenther

commit 8312ee136771befd2c04d877e3ab340e1b1366a7
Author: Günther Deschner <g...@samba.org>
Date:   Mon Oct 17 18:03:31 2011 +0200

    s3-passdb: split out passdb/pdb_ldap_schema.c
    
    Guenther

commit 28f8ccbe8b36766cf15a3d97cffb4ea66b411958
Author: Günther Deschner <g...@samba.org>
Date:   Mon Oct 17 18:00:01 2011 +0200

    s3: move smbldap_util to pdb_ldap_util.
    
    Guenther

commit 25a00b44d3b227a3fe84a9d46bd697e8b70b25c1
Author: Günther Deschner <g...@samba.org>
Date:   Mon Oct 17 17:17:18 2011 +0200

    s3-smbldap: use include/smb_ldap.h in smbldap.h
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in                                |    7 +-
 source3/configure.in                               |    5 +-
 source3/include/smbldap.h                          |  114 +---------
 source3/lib/smbldap.c                              |  244 +-------------------
 source3/libnet/libnet_samsync_ldif.c               |    2 +-
 source3/pam_smbpass/wscript_build                  |    2 +-
 source3/passdb/pdb_ipa.c                           |    1 +
 source3/passdb/pdb_ldap.c                          |   16 ++-
 source3/passdb/pdb_ldap_schema.c                   |  246 ++++++++++++++++++++
 source3/passdb/pdb_ldap_schema.h                   |  128 ++++++++++
 .../{lib/smbldap_util.c => passdb/pdb_ldap_util.c} |   25 +-
 .../passdb/pdb_ldap_util.h                         |   31 ++--
 source3/passdb/wscript_build                       |    3 +-
 source3/utils/net_sam.c                            |   35 ++-
 source3/winbindd/idmap_ldap.c                      |    5 +-
 source3/winbindd/wscript_build                     |    1 +
 source3/wscript_build                              |   14 +-
 17 files changed, 479 insertions(+), 400 deletions(-)
 create mode 100644 source3/passdb/pdb_ldap_schema.c
 create mode 100644 source3/passdb/pdb_ldap_schema.h
 rename source3/{lib/smbldap_util.c => passdb/pdb_ldap_util.c} (97%)
 copy source4/libcli/ldap/libcli_ldap.h => source3/passdb/pdb_ldap_util.h (58%)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index fbf1710..a57300e 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -271,7 +271,7 @@ TDB_LIB_OBJ = lib/util_tdb.o ../lib/util/util_tdb.o \
 
 TDB_VALIDATE_OBJ = lib/tdb_validate.o
 
-SMBLDAP_OBJ = @SMBLDAP@ @SMBLDAPUTIL@
+SMBLDAP_OBJ = @SMBLDAP@
 
 VERSION_OBJ = lib/version.o
 
@@ -2842,10 +2842,11 @@ bin/sam.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_SAM_OBJ)
        @$(SHLD_MODULE) $(AUTH_SAM_OBJ)
 
 bin/ldapsam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_ldap.o passdb/pdb_nds.o \
-                       passdb/pdb_ipa.o
+                       passdb/pdb_ipa.o passdb/pdb_ldap_util.o \
+       passdb/pdb_ldap_schema.o
        @echo "Building plugin $@"
        @$(SHLD_MODULE) passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o \
-                       $(LDAP_LIBS)
+                       passdb/pdb_ldap_util.o passdb/pdb_ldap_schema.o 
$(LDAP_LIBS)
 
 bin/ads.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_ads.o
        @echo "Building plugin $@"
diff --git a/source3/configure.in b/source3/configure.in
index a415900..6091a4a 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -3433,8 +3433,6 @@ AC_MSG_RESULT($with_ldap_support)
 
 SMBLDAP=""
 AC_SUBST(SMBLDAP)
-SMBLDAPUTIL=""
-AC_SUBST(SMBLDAPUTIL)
 
 if test x"$with_ldap_support" != x"no"; then
 
@@ -3545,7 +3543,6 @@ if test x"$with_ldap_support" != x"no"; then
     default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
     default_shared_modules="$default_shared_modules";
     SMBLDAP="lib/smbldap.o"
-    SMBLDAPUTIL="lib/smbldap_util.o"
     with_ldap_support=yes
     AC_MSG_CHECKING(whether LDAP support is used)
     AC_MSG_RESULT(yes)
@@ -6856,7 +6853,7 @@ if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
        AC_SUBST(SMBD_FAM_LIBS)
 fi
 
-SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o,
+SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o 
passdb/pdb_ldap_util.o passdb/pdb_ldap_schema.o,
                   "bin/ldapsam.$SHLIBEXT", PDB,
                   [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
 SMB_MODULE(pdb_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index 9a81c30..d8f12bc 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -23,120 +23,21 @@
 
 struct smbldap_state;
 
-#include "smb_ldap.h"
+#include "include/smb_ldap.h"
 
 #ifdef HAVE_LDAP
 
-/* specify schema versions between 2.2. and 3.0 */
-
-#define SCHEMAVER_SAMBAACCOUNT         1
-#define SCHEMAVER_SAMBASAMACCOUNT      2
-
-/* objectclass names */
-
-#define LDAP_OBJ_SAMBASAMACCOUNT       "sambaSamAccount"
-#define LDAP_OBJ_SAMBAACCOUNT          "sambaAccount"
-#define LDAP_OBJ_GROUPMAP              "sambaGroupMapping"
-#define LDAP_OBJ_DOMINFO               "sambaDomain"
-#define LDAP_OBJ_IDPOOL                        "sambaUnixIdPool"
-#define LDAP_OBJ_IDMAP_ENTRY           "sambaIdmapEntry"
-#define LDAP_OBJ_SID_ENTRY             "sambaSidEntry"
-#define LDAP_OBJ_TRUST_PASSWORD         "sambaTrustPassword"
-#define LDAP_OBJ_TRUSTDOM_PASSWORD      "sambaTrustedDomainPassword"
-#define LDAP_OBJ_TRUSTED_DOMAIN                "sambaTrustedDomain"
-
-#define LDAP_OBJ_ACCOUNT               "account"
-#define LDAP_OBJ_POSIXACCOUNT          "posixAccount"
-#define LDAP_OBJ_POSIXGROUP            "posixGroup"
-#define LDAP_OBJ_OU                    "organizationalUnit"
-
-/* some generic attributes that get reused a lot */
-
-#define LDAP_ATTRIBUTE_SID             "sambaSID"
-#define LDAP_ATTRIBUTE_UIDNUMBER       "uidNumber"
-#define LDAP_ATTRIBUTE_GIDNUMBER       "gidNumber"
-#define LDAP_ATTRIBUTE_SID_LIST                "sambaSIDList"
-
-/* attribute map table indexes */
-
-#define LDAP_ATTR_LIST_END             0
-#define LDAP_ATTR_UID                  1
-#define LDAP_ATTR_UIDNUMBER            2
-#define LDAP_ATTR_GIDNUMBER            3
-#define LDAP_ATTR_UNIX_HOME            4
-#define LDAP_ATTR_PWD_LAST_SET         5
-#define LDAP_ATTR_PWD_CAN_CHANGE       6
-#define LDAP_ATTR_PWD_MUST_CHANGE      7
-#define LDAP_ATTR_LOGON_TIME           8
-#define LDAP_ATTR_LOGOFF_TIME          9
-#define LDAP_ATTR_KICKOFF_TIME         10
-#define LDAP_ATTR_CN                   11
-#define LDAP_ATTR_DISPLAY_NAME         12
-#define LDAP_ATTR_HOME_PATH            13
-#define LDAP_ATTR_LOGON_SCRIPT         14
-#define LDAP_ATTR_PROFILE_PATH         15
-#define LDAP_ATTR_DESC                 16
-#define LDAP_ATTR_USER_WKS             17
-#define LDAP_ATTR_USER_SID             18
-#define LDAP_ATTR_USER_RID             18
-#define LDAP_ATTR_PRIMARY_GROUP_SID    19
-#define LDAP_ATTR_PRIMARY_GROUP_RID    20
-#define LDAP_ATTR_LMPW                 21
-#define LDAP_ATTR_NTPW                 22
-#define LDAP_ATTR_DOMAIN               23
-#define LDAP_ATTR_OBJCLASS             24
-#define LDAP_ATTR_ACB_INFO             25
-#define LDAP_ATTR_NEXT_USERRID         26
-#define LDAP_ATTR_NEXT_GROUPRID                27
-#define LDAP_ATTR_DOM_SID              28
-#define LDAP_ATTR_HOME_DRIVE           29
-#define LDAP_ATTR_GROUP_SID            30
-#define LDAP_ATTR_GROUP_TYPE           31
-#define LDAP_ATTR_SID                  32
-#define LDAP_ATTR_ALGORITHMIC_RID_BASE  33
-#define LDAP_ATTR_NEXT_RID              34
-#define LDAP_ATTR_BAD_PASSWORD_COUNT   35
-#define LDAP_ATTR_LOGON_COUNT          36
-#define LDAP_ATTR_MUNGED_DIAL          37
-#define LDAP_ATTR_BAD_PASSWORD_TIME    38
-#define LDAP_ATTR_PWD_HISTORY           39
-#define LDAP_ATTR_SID_LIST             40
-#define LDAP_ATTR_MOD_TIMESTAMP         41
-#define LDAP_ATTR_LOGON_HOURS          42 
-#define LDAP_ATTR_TRUST_PASSWD_FLAGS    43
-#define LDAP_ATTR_SN                   44
-
-
-typedef struct _attrib_map_entry {
-       int             attrib;
-       const char      *name;
-} ATTRIB_MAP_ENTRY;
-
-
-/* structures */
-
-extern ATTRIB_MAP_ENTRY attrib_map_v22[];
-extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v22[];
-extern ATTRIB_MAP_ENTRY attrib_map_v30[];
-extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v30[];
-extern ATTRIB_MAP_ENTRY dominfo_attr_list[];
-extern ATTRIB_MAP_ENTRY groupmap_attr_list[];
-extern ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[];
-extern ATTRIB_MAP_ENTRY idpool_attr_list[];
-extern ATTRIB_MAP_ENTRY sidmap_attr_list[];
-extern ATTRIB_MAP_ENTRY trustpw_attr_list[];
-
-
 /* Function declarations -- not included in proto.h so we don't
    have to worry about LDAP structure types */
 
 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
                      struct tevent_context *tevent_ctx,
-                      const char *location,
-                      struct smbldap_state **smbldap_state);
+                     const char *location,
+                     bool anon,
+                     const char *bind_dn,
+                     const char *bind_secret,
+                     struct smbldap_state **smbldap_state);
 
-const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key );
-const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] );
 void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, 
const char *value);
 void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char 
*attribute, const DATA_BLOB *newblob);
 void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
@@ -239,9 +140,6 @@ int smbldap_search_suffix (struct smbldap_state *ldap_state,
                           const char *filter, const char **search_attr,
                           LDAPMessage ** result);
 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
-NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct tevent_context *tevent_ctx,
-                     const char *location,
-                     struct smbldap_state **smbldap_state);
 bool smbldap_has_control(LDAP *ld, const char *control);
 bool smbldap_has_extension(LDAP *ld, const char *extension);
 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index bb98d44..51bcabd 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -24,7 +24,6 @@
 
 #include "includes.h"
 #include "smbldap.h"
-#include "secrets.h"
 #include "../libcli/security/security.h"
 #include <tevent.h>
 
@@ -36,226 +35,6 @@
 #define SMBLDAP_IDLE_TIME 150          /* After 2.5 minutes disconnect */
 
 
-/* attributes used by Samba 2.2 */
-
-ATTRIB_MAP_ENTRY attrib_map_v22[] = {
-       { LDAP_ATTR_UID,                "uid"           },
-       { LDAP_ATTR_UIDNUMBER,          LDAP_ATTRIBUTE_UIDNUMBER},
-       { LDAP_ATTR_GIDNUMBER,          LDAP_ATTRIBUTE_GIDNUMBER},
-       { LDAP_ATTR_UNIX_HOME,          "homeDirectory" },
-       { LDAP_ATTR_PWD_LAST_SET,       "pwdLastSet"    },
-       { LDAP_ATTR_PWD_CAN_CHANGE,     "pwdCanChange"  },
-       { LDAP_ATTR_PWD_MUST_CHANGE,    "pwdMustChange" },
-       { LDAP_ATTR_LOGON_TIME,         "logonTime"     },
-       { LDAP_ATTR_LOGOFF_TIME,        "logoffTime"    },
-       { LDAP_ATTR_KICKOFF_TIME,       "kickoffTime"   },
-       { LDAP_ATTR_CN,                 "cn"            },
-       { LDAP_ATTR_SN,                 "sn"            },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"   },
-       { LDAP_ATTR_HOME_PATH,          "smbHome"       },
-       { LDAP_ATTR_HOME_DRIVE,         "homeDrive"     },
-       { LDAP_ATTR_LOGON_SCRIPT,       "scriptPath"    },
-       { LDAP_ATTR_PROFILE_PATH,       "profilePath"   },
-       { LDAP_ATTR_DESC,               "description"   },
-       { LDAP_ATTR_USER_WKS,           "userWorkstations"},
-       { LDAP_ATTR_USER_RID,           "rid"           },
-       { LDAP_ATTR_PRIMARY_GROUP_RID,  "primaryGroupID"},
-       { LDAP_ATTR_LMPW,               "lmPassword"    },
-       { LDAP_ATTR_NTPW,               "ntPassword"    },
-       { LDAP_ATTR_DOMAIN,             "domain"        },
-       { LDAP_ATTR_OBJCLASS,           "objectClass"   },
-       { LDAP_ATTR_ACB_INFO,           "acctFlags"     },
-       { LDAP_ATTR_MOD_TIMESTAMP,      "modifyTimestamp"       },
-       { LDAP_ATTR_LIST_END,           NULL            }
-};
-
-ATTRIB_MAP_ENTRY attrib_map_to_delete_v22[] = {
-       { LDAP_ATTR_PWD_LAST_SET,       "pwdLastSet"    },
-       { LDAP_ATTR_PWD_CAN_CHANGE,     "pwdCanChange"  },
-       { LDAP_ATTR_PWD_MUST_CHANGE,    "pwdMustChange" },
-       { LDAP_ATTR_LOGON_TIME,         "logonTime"     },
-       { LDAP_ATTR_LOGOFF_TIME,        "logoffTime"    },
-       { LDAP_ATTR_KICKOFF_TIME,       "kickoffTime"   },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"   },
-       { LDAP_ATTR_HOME_PATH,          "smbHome"       },
-       { LDAP_ATTR_HOME_DRIVE,         "homeDrives"    },
-       { LDAP_ATTR_LOGON_SCRIPT,       "scriptPath"    },
-       { LDAP_ATTR_PROFILE_PATH,       "profilePath"   },
-       { LDAP_ATTR_USER_WKS,           "userWorkstations"},
-       { LDAP_ATTR_USER_RID,           "rid"           },
-       { LDAP_ATTR_PRIMARY_GROUP_RID,  "primaryGroupID"},
-       { LDAP_ATTR_LMPW,               "lmPassword"    },
-       { LDAP_ATTR_NTPW,               "ntPassword"    },
-       { LDAP_ATTR_DOMAIN,             "domain"        },
-       { LDAP_ATTR_ACB_INFO,           "acctFlags"     },
-       { LDAP_ATTR_LIST_END,           NULL            }
-};
-
-/* attributes used by Samba 3.0's sambaSamAccount */
-
-ATTRIB_MAP_ENTRY attrib_map_v30[] = {
-       { LDAP_ATTR_UID,                "uid"                   },
-       { LDAP_ATTR_UIDNUMBER,          LDAP_ATTRIBUTE_UIDNUMBER},
-       { LDAP_ATTR_GIDNUMBER,          LDAP_ATTRIBUTE_GIDNUMBER},
-       { LDAP_ATTR_UNIX_HOME,          "homeDirectory"         },
-       { LDAP_ATTR_PWD_LAST_SET,       "sambaPwdLastSet"       },
-       { LDAP_ATTR_PWD_CAN_CHANGE,     "sambaPwdCanChange"     },
-       { LDAP_ATTR_PWD_MUST_CHANGE,    "sambaPwdMustChange"    },
-       { LDAP_ATTR_LOGON_TIME,         "sambaLogonTime"        },
-       { LDAP_ATTR_LOGOFF_TIME,        "sambaLogoffTime"       },
-       { LDAP_ATTR_KICKOFF_TIME,       "sambaKickoffTime"      },
-       { LDAP_ATTR_CN,                 "cn"                    },
-       { LDAP_ATTR_SN,                 "sn"                    },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"           },
-       { LDAP_ATTR_HOME_DRIVE,         "sambaHomeDrive"        },
-       { LDAP_ATTR_HOME_PATH,          "sambaHomePath"         },
-       { LDAP_ATTR_LOGON_SCRIPT,       "sambaLogonScript"      },
-       { LDAP_ATTR_PROFILE_PATH,       "sambaProfilePath"      },
-       { LDAP_ATTR_DESC,               "description"           },
-       { LDAP_ATTR_USER_WKS,           "sambaUserWorkstations" },
-       { LDAP_ATTR_USER_SID,           LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_PRIMARY_GROUP_SID,  "sambaPrimaryGroupSID"  },
-       { LDAP_ATTR_LMPW,               "sambaLMPassword"       },
-       { LDAP_ATTR_NTPW,               "sambaNTPassword"       },
-       { LDAP_ATTR_DOMAIN,             "sambaDomainName"       },
-       { LDAP_ATTR_OBJCLASS,           "objectClass"           },
-       { LDAP_ATTR_ACB_INFO,           "sambaAcctFlags"        },
-       { LDAP_ATTR_MUNGED_DIAL,        "sambaMungedDial"       },
-       { LDAP_ATTR_BAD_PASSWORD_COUNT, "sambaBadPasswordCount" },
-       { LDAP_ATTR_BAD_PASSWORD_TIME,  "sambaBadPasswordTime"  },
-       { LDAP_ATTR_PWD_HISTORY,        "sambaPasswordHistory"  },
-       { LDAP_ATTR_MOD_TIMESTAMP,      "modifyTimestamp"       },
-       { LDAP_ATTR_LOGON_HOURS,        "sambaLogonHours"       },
-       { LDAP_ATTR_LIST_END,           NULL                    }
-};
-
-ATTRIB_MAP_ENTRY attrib_map_to_delete_v30[] = {
-       { LDAP_ATTR_PWD_LAST_SET,       "sambaPwdLastSet"       },
-       { LDAP_ATTR_PWD_CAN_CHANGE,     "sambaPwdCanChange"     },
-       { LDAP_ATTR_PWD_MUST_CHANGE,    "sambaPwdMustChange"    },
-       { LDAP_ATTR_LOGON_TIME,         "sambaLogonTime"        },
-       { LDAP_ATTR_LOGOFF_TIME,        "sambaLogoffTime"       },
-       { LDAP_ATTR_KICKOFF_TIME,       "sambaKickoffTime"      },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"           },
-       { LDAP_ATTR_HOME_DRIVE,         "sambaHomeDrive"        },
-       { LDAP_ATTR_HOME_PATH,          "sambaHomePath"         },
-       { LDAP_ATTR_LOGON_SCRIPT,       "sambaLogonScript"      },
-       { LDAP_ATTR_PROFILE_PATH,       "sambaProfilePath"      },
-       { LDAP_ATTR_USER_WKS,           "sambaUserWorkstations" },
-       { LDAP_ATTR_USER_SID,           LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_PRIMARY_GROUP_SID,  "sambaPrimaryGroupSID"  },
-       { LDAP_ATTR_LMPW,               "sambaLMPassword"       },
-       { LDAP_ATTR_NTPW,               "sambaNTPassword"       },
-       { LDAP_ATTR_DOMAIN,             "sambaDomainName"       },
-       { LDAP_ATTR_ACB_INFO,           "sambaAcctFlags"        },
-       { LDAP_ATTR_MUNGED_DIAL,        "sambaMungedDial"       },
-       { LDAP_ATTR_BAD_PASSWORD_COUNT, "sambaBadPasswordCount" },
-       { LDAP_ATTR_BAD_PASSWORD_TIME,  "sambaBadPasswordTime"  },
-       { LDAP_ATTR_PWD_HISTORY,        "sambaPasswordHistory"  },
-       { LDAP_ATTR_LOGON_HOURS,        "sambaLogonHours"       },
-       { LDAP_ATTR_LIST_END,           NULL                    }
-};
-
-/* attributes used for allocating RIDs */
-
-ATTRIB_MAP_ENTRY dominfo_attr_list[] = {
-       { LDAP_ATTR_DOMAIN,             "sambaDomainName"       },
-       { LDAP_ATTR_NEXT_RID,           "sambaNextRid"          },
-       { LDAP_ATTR_NEXT_USERRID,       "sambaNextUserRid"      },
-       { LDAP_ATTR_NEXT_GROUPRID,      "sambaNextGroupRid"     },
-       { LDAP_ATTR_DOM_SID,            LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_ALGORITHMIC_RID_BASE,"sambaAlgorithmicRidBase"},
-       { LDAP_ATTR_OBJCLASS,           "objectClass"           },
-       { LDAP_ATTR_LIST_END,           NULL                    },
-};
-
-/* Samba 3.0 group mapping attributes */
-
-ATTRIB_MAP_ENTRY groupmap_attr_list[] = {
-       { LDAP_ATTR_GIDNUMBER,          LDAP_ATTRIBUTE_GIDNUMBER},
-       { LDAP_ATTR_GROUP_SID,          LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_GROUP_TYPE,         "sambaGroupType"        },
-       { LDAP_ATTR_SID_LIST,           "sambaSIDList"          },
-       { LDAP_ATTR_DESC,               "description"           },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"           },
-       { LDAP_ATTR_CN,                 "cn"                    },
-       { LDAP_ATTR_OBJCLASS,           "objectClass"           },
-       { LDAP_ATTR_LIST_END,           NULL                    }       
-};
-
-ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[] = {
-       { LDAP_ATTR_GROUP_SID,          LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_GROUP_TYPE,         "sambaGroupType"        },
-       { LDAP_ATTR_DESC,               "description"           },
-       { LDAP_ATTR_DISPLAY_NAME,       "displayName"           },
-       { LDAP_ATTR_SID_LIST,           "sambaSIDList"          },
-       { LDAP_ATTR_LIST_END,           NULL                    }       
-};
-
-/* idmap_ldap sambaUnixIdPool */
-
-ATTRIB_MAP_ENTRY idpool_attr_list[] = {
-       { LDAP_ATTR_UIDNUMBER,          LDAP_ATTRIBUTE_UIDNUMBER},
-       { LDAP_ATTR_GIDNUMBER,          LDAP_ATTRIBUTE_GIDNUMBER},
-       { LDAP_ATTR_OBJCLASS,           "objectClass"           },
-       { LDAP_ATTR_LIST_END,           NULL                    }       
-};
-
-ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
-       { LDAP_ATTR_SID,                LDAP_ATTRIBUTE_SID      },
-       { LDAP_ATTR_UIDNUMBER,          LDAP_ATTRIBUTE_UIDNUMBER},
-       { LDAP_ATTR_GIDNUMBER,          LDAP_ATTRIBUTE_GIDNUMBER},
-       { LDAP_ATTR_OBJCLASS,           "objectClass"           },
-       { LDAP_ATTR_LIST_END,           NULL                    }       
-};
-
-/**********************************************************************
- perform a simple table lookup and return the attribute name 
- **********************************************************************/
- 
- const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key )
-{
-       int i = 0;
-
-       while ( table[i].attrib != LDAP_ATTR_LIST_END ) {
-               if ( table[i].attrib == key )
-                       return table[i].name;
-               i++;
-       }
-
-       return NULL;
-}
-
-
-/**********************************************************************
- Return the list of attribute names from a mapping table
- **********************************************************************/
-
- const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] )
-{
-       const char **names;
-       int i = 0;
-
-       while ( table[i].attrib != LDAP_ATTR_LIST_END )
-               i++;
-       i++;
-
-       names = talloc_array( mem_ctx, const char*, i );
-       if ( !names ) {
-               DEBUG(0,("get_attr_list: out of memory\n"));
-               return NULL;
-       }
-
-       i = 0;
-       while ( table[i].attrib != LDAP_ATTR_LIST_END ) {
-               names[i] = talloc_strdup( names, table[i].name );
-               i++;
-       }
-       names[i] = NULL;
-
-       return names;
-}
-
 /*******************************************************************
  Search an attribute and return the first value found.
 ******************************************************************/
@@ -1173,22 +952,6 @@ static int smbldap_connect_system(struct smbldap_state 
*ldap_state)
        int rc;
        int version;
 
-       if (!ldap_state->anonymous && !ldap_state->bind_dn) {
-               char *bind_dn = NULL;
-               char *bind_secret = NULL;
-
-               /* get the default dn and password only if they are not set 
already */
-               if (!fetch_ldap_pw(&bind_dn, &bind_secret)) {
-                       DEBUG(0, ("ldap_connect_system: Failed to retrieve 
password from secrets.tdb\n"));
-                       rc = LDAP_INVALID_CREDENTIALS;
-                       goto done;
-               }
-               smbldap_set_creds(ldap_state, false, bind_dn, bind_secret);
-               SAFE_FREE(bind_dn);
-               memset(bind_secret, '\0', strlen(bind_secret));
-               SAFE_FREE(bind_secret);
-       }
-
        /* removed the sasl_bind_s "EXTERNAL" stuff, as my testsuite 
           (OpenLDAP) doesnt' seem to support it */
 
@@ -1923,6 +1686,9 @@ static int smbldap_state_destructor(struct smbldap_state 
*state)
 
 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct tevent_context *tevent_ctx,
                      const char *location,
+                     bool anon,
+                     const char *bind_dn,
+                     const char *bind_secret,
                      struct smbldap_state **smbldap_state)
 {
        *smbldap_state = talloc_zero(mem_ctx, struct smbldap_state);
@@ -1939,6 +1705,10 @@ NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct 
tevent_context *tevent_ctx,
 
        (*smbldap_state)->tevent_context = tevent_ctx;
 
+       if (bind_dn && bind_secret) {
+               smbldap_set_creds(*smbldap_state, anon, bind_dn, bind_secret);
+       }
+
        talloc_set_destructor(*smbldap_state, smbldap_state_destructor);
        return NT_STATUS_OK;
 }
diff --git a/source3/libnet/libnet_samsync_ldif.c 
b/source3/libnet/libnet_samsync_ldif.c
index f535e28..a46bfca 100644
--- a/source3/libnet/libnet_samsync_ldif.c
+++ b/source3/libnet/libnet_samsync_ldif.c
@@ -25,9 +25,9 @@
 
 #include "includes.h"
 #include "libnet/libnet_samsync.h"
-#include "smbldap.h"
 #include "transfer_file.h"
 #include "passdb.h"
+#include "passdb/pdb_ldap_schema.h"
 
 #ifdef HAVE_LDAP
 
diff --git a/source3/pam_smbpass/wscript_build 
b/source3/pam_smbpass/wscript_build
index 633d9b7..70b21d5 100644
--- a/source3/pam_smbpass/wscript_build
+++ b/source3/pam_smbpass/wscript_build


-- 
Samba Shared Repository

Reply via email to