s3-smbldap: improve smbldap.h readability and rearrange some defines.
authorGünther Deschner <gd@samba.org>
Wed, 16 Nov 2011 17:59:26 +0000 (18:59 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 17 Nov 2011 01:11:46 +0000 (02:11 +0100)
Guenther

source3/include/smb_ldap.h
source3/include/smbldap.h

index 594f01586296fb5e57603d97710c01b9035258b0..6d15b1a6a2b66111395fe6db7878eb4e1b9eec44 100644 (file)
@@ -88,4 +88,35 @@ struct ldapsam_privates;
 #define LDAP_OPT_SUCCESS 0
 #endif
 
+#define LDAP_DEFAULT_TIMEOUT   15
+#define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
+#define LDAP_PAGE_SIZE 1024
+
+#define ADS_PAGE_CTL_OID       "1.2.840.113556.1.4.319"
+
+/*
+ * Work around versions of the LDAP client libs that don't have the OIDs
+ * defined, or have them defined under the old name.
+ * This functionality is really a factor of the server, not the client
+ *
+ */
+
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
+#define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD)
+#define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
+#endif
+
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
+#endif
+
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
+#endif
+
 #endif /* _SMB_LDAP_H */
index d1eb81e2168d000916a235989b984a484aff1db3..ef09c4c3c28c5fc8337cb1b8b40a0a0e4a69a318 100644 (file)
 #ifndef _SMBLDAP_H
 #define _SMBLDAP_H
 
-struct smbldap_state;
-
 #include "include/smb_ldap.h"
 
 #ifdef HAVE_LDAP
 
-/* 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,
-                     bool anon,
-                     const char *bind_dn,
-                     const char *bind_secret,
-                     struct smbldap_state **smbldap_state);
-
-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,
-                     LDAPMod ***mods,
-                     const char *attribute, const char *newval);
-void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
-                          LDAPMod ***mods,
-                          const char *attribute, const DATA_BLOB *newblob);
-bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
-                                  const char *attribute, char *value,
-                                  int max_len);
-int smbldap_modify(struct smbldap_state *ldap_state,
-                   const char *dn,
-                   LDAPMod *attrs[]);
-
 /**
  * Struct to keep the state for all the ldap stuff 
  *
@@ -119,6 +91,28 @@ struct ldapsam_privates {
 
 /* The following definitions come from lib/smbldap.c  */
 
+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);
+
+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,
+                     LDAPMod ***mods,
+                     const char *attribute, const char *newval);
+void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
+                          LDAPMod ***mods,
+                          const char *attribute, const DATA_BLOB *newblob);
+bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
+                                  const char *attribute, char *value,
+                                  int max_len);
+int smbldap_modify(struct smbldap_state *ldap_state,
+                   const char *dn,
+                   LDAPMod *attrs[]);
 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
 int smbldap_search(struct smbldap_state *ldap_state,
@@ -165,35 +159,4 @@ char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
 
 #endif         /* HAVE_LDAP */
 
-#define LDAP_DEFAULT_TIMEOUT   15
-#define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
-#define LDAP_PAGE_SIZE 1024
-
-#define ADS_PAGE_CTL_OID       "1.2.840.113556.1.4.319"
-
-/*
- * Work around versions of the LDAP client libs that don't have the OIDs
- * defined, or have them defined under the old name.
- * This functionality is really a factor of the server, not the client
- *
- */
-
-#if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
-#define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
-#elif !defined(LDAP_EXOP_MODIFY_PASSWD)
-#define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
-#endif
-
-#if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
-#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
-#elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
-#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
-#endif
-
-#if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
-#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
-#elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
-#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
-#endif
-
 #endif /* _SMBLDAP_H */