Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/include/smbldap.h

    r740 r988  
    2222#define _SMBLDAP_H
    2323
    24 struct smbldap_state;
    25 
    26 #include "smb_ldap.h"
     24#include "include/smb_ldap.h"
    2725
    2826#ifdef HAVE_LDAP
    2927
    30 /* specify schema versions between 2.2. and 3.0 */
    31 
    32 #define SCHEMAVER_SAMBAACCOUNT          1
    33 #define SCHEMAVER_SAMBASAMACCOUNT       2
    34 
    35 /* objectclass names */
    36 
    37 #define LDAP_OBJ_SAMBASAMACCOUNT        "sambaSamAccount"
    38 #define LDAP_OBJ_SAMBAACCOUNT           "sambaAccount"
    39 #define LDAP_OBJ_GROUPMAP               "sambaGroupMapping"
    40 #define LDAP_OBJ_DOMINFO                "sambaDomain"
    41 #define LDAP_OBJ_IDPOOL                 "sambaUnixIdPool"
    42 #define LDAP_OBJ_IDMAP_ENTRY            "sambaIdmapEntry"
    43 #define LDAP_OBJ_SID_ENTRY              "sambaSidEntry"
    44 #define LDAP_OBJ_TRUST_PASSWORD         "sambaTrustPassword"
    45 #define LDAP_OBJ_TRUSTDOM_PASSWORD      "sambaTrustedDomainPassword"
    46 #define LDAP_OBJ_TRUSTED_DOMAIN         "sambaTrustedDomain"
    47 
    48 #define LDAP_OBJ_ACCOUNT                "account"
    49 #define LDAP_OBJ_POSIXACCOUNT           "posixAccount"
    50 #define LDAP_OBJ_POSIXGROUP             "posixGroup"
    51 #define LDAP_OBJ_OU                     "organizationalUnit"
    52 
    53 /* some generic attributes that get reused a lot */
    54 
    55 #define LDAP_ATTRIBUTE_SID              "sambaSID"
    56 #define LDAP_ATTRIBUTE_UIDNUMBER        "uidNumber"
    57 #define LDAP_ATTRIBUTE_GIDNUMBER        "gidNumber"
    58 #define LDAP_ATTRIBUTE_SID_LIST         "sambaSIDList"
    59 
    60 /* attribute map table indexes */
    61 
    62 #define LDAP_ATTR_LIST_END              0
    63 #define LDAP_ATTR_UID                   1
    64 #define LDAP_ATTR_UIDNUMBER             2
    65 #define LDAP_ATTR_GIDNUMBER             3
    66 #define LDAP_ATTR_UNIX_HOME             4
    67 #define LDAP_ATTR_PWD_LAST_SET          5
    68 #define LDAP_ATTR_PWD_CAN_CHANGE        6
    69 #define LDAP_ATTR_PWD_MUST_CHANGE       7
    70 #define LDAP_ATTR_LOGON_TIME            8
    71 #define LDAP_ATTR_LOGOFF_TIME           9
    72 #define LDAP_ATTR_KICKOFF_TIME          10
    73 #define LDAP_ATTR_CN                    11
    74 #define LDAP_ATTR_DISPLAY_NAME          12
    75 #define LDAP_ATTR_HOME_PATH             13
    76 #define LDAP_ATTR_LOGON_SCRIPT          14
    77 #define LDAP_ATTR_PROFILE_PATH          15
    78 #define LDAP_ATTR_DESC                  16
    79 #define LDAP_ATTR_USER_WKS              17
    80 #define LDAP_ATTR_USER_SID              18
    81 #define LDAP_ATTR_USER_RID              18
    82 #define LDAP_ATTR_PRIMARY_GROUP_SID     19
    83 #define LDAP_ATTR_PRIMARY_GROUP_RID     20
    84 #define LDAP_ATTR_LMPW                  21
    85 #define LDAP_ATTR_NTPW                  22
    86 #define LDAP_ATTR_DOMAIN                23
    87 #define LDAP_ATTR_OBJCLASS              24
    88 #define LDAP_ATTR_ACB_INFO              25
    89 #define LDAP_ATTR_NEXT_USERRID          26
    90 #define LDAP_ATTR_NEXT_GROUPRID         27
    91 #define LDAP_ATTR_DOM_SID               28
    92 #define LDAP_ATTR_HOME_DRIVE            29
    93 #define LDAP_ATTR_GROUP_SID             30
    94 #define LDAP_ATTR_GROUP_TYPE            31
    95 #define LDAP_ATTR_SID                   32
    96 #define LDAP_ATTR_ALGORITHMIC_RID_BASE  33
    97 #define LDAP_ATTR_NEXT_RID              34
    98 #define LDAP_ATTR_BAD_PASSWORD_COUNT    35
    99 #define LDAP_ATTR_LOGON_COUNT           36
    100 #define LDAP_ATTR_MUNGED_DIAL           37
    101 #define LDAP_ATTR_BAD_PASSWORD_TIME     38
    102 #define LDAP_ATTR_PWD_HISTORY           39
    103 #define LDAP_ATTR_SID_LIST              40
    104 #define LDAP_ATTR_MOD_TIMESTAMP         41
    105 #define LDAP_ATTR_LOGON_HOURS           42
    106 #define LDAP_ATTR_TRUST_PASSWD_FLAGS    43
    107 #define LDAP_ATTR_SN                    44
    108 
    109 
    110 typedef struct _attrib_map_entry {
    111         int             attrib;
    112         const char      *name;
    113 } ATTRIB_MAP_ENTRY;
    114 
    115 
    116 /* structures */
    117 
    118 extern ATTRIB_MAP_ENTRY attrib_map_v22[];
    119 extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v22[];
    120 extern ATTRIB_MAP_ENTRY attrib_map_v30[];
    121 extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v30[];
    122 extern ATTRIB_MAP_ENTRY dominfo_attr_list[];
    123 extern ATTRIB_MAP_ENTRY groupmap_attr_list[];
    124 extern ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[];
    125 extern ATTRIB_MAP_ENTRY idpool_attr_list[];
    126 extern ATTRIB_MAP_ENTRY sidmap_attr_list[];
    127 extern ATTRIB_MAP_ENTRY trustpw_attr_list[];
    128 
    129 
    130 /* Function declarations -- not included in proto.h so we don't
    131    have to worry about LDAP structure types */
    132 
    133 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
    134                       struct event_context *event_ctx,
    135                       const char *location,
    136                       struct smbldap_state **smbldap_state);
    137 
    138 const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key );
    139 const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] );
    140 void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
    141 void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
    142 void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
    143                       LDAPMod ***mods,
    144                       const char *attribute, const char *newval);
    145 void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
    146                            LDAPMod ***mods,
    147                            const char *attribute, const DATA_BLOB *newblob);
    148 bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
    149                                    const char *attribute, char *value,
    150                                    int max_len);
    151 int smbldap_modify(struct smbldap_state *ldap_state,
    152                    const char *dn,
    153                    LDAPMod *attrs[]);
     28#include <talloc.h>
     29#include <tevent.h>
    15430
    15531/**
     
    16945        char *bind_dn;
    17046        char *bind_secret;
     47        int (*bind_callback)(LDAP *ldap_struct, struct smbldap_state *ldap_state, void *data);
     48        void *bind_callback_data;
    17149
    17250        bool paged_results;
     
    17553
    17654        time_t last_use; /* monotonic */
    177         struct event_context *event_context;
    178         struct timed_event *idle_event;
     55        struct tevent_context *tevent_context;
     56        struct tevent_timer *idle_event;
    17957
    18058        struct timeval last_rebind; /* monotonic */
     
    21795};
    21896
    219 /* Functions shared between pdb_ldap.c and pdb_nds.c. */
    220 struct pdb_methods;
    221 NTSTATUS pdb_init_ldapsam_compat( struct pdb_methods **pdb_method, const char *location);
    222 void private_data_free_fn(void **result);
    223 int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state,
    224                                   const char *user,
    225                                   LDAPMessage ** result,
    226                                   const char **attr);
    227 NTSTATUS pdb_init_ldapsam( struct pdb_methods **pdb_method, const char *location);
    228 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
    229 
    230 char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    231                                        const char *attribute,
    232                                        TALLOC_CTX *mem_ctx);
    233 char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    234                                       const char *attribute,
    235                                       TALLOC_CTX *mem_ctx);
    236 char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    237                                          const char *attribute,
    238                                          TALLOC_CTX *mem_ctx);
    239 bool smbldap_talloc_single_blob(TALLOC_CTX *mem_ctx, LDAP *ld,
    240                                 LDAPMessage *msg, const char *attrib,
    241                                 DATA_BLOB *blob);
    242 bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
    243                       struct dom_sid *sid);
    244 void talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
    245 void talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
    246 char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
    247                               LDAPMessage *entry);
    248 LDAP *priv2ld(struct ldapsam_privates *priv);
    249 
    25097/* The following definitions come from lib/smbldap.c  */
    25198
    252 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
    253 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
     99NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
     100                      struct tevent_context *tevent_ctx,
     101                      const char *location,
     102                      bool anon,
     103                      const char *bind_dn,
     104                      const char *bind_secret,
     105                      struct smbldap_state **smbldap_state);
     106
     107void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
     108void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
     109void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
     110                      LDAPMod ***mods,
     111                      const char *attribute, const char *newval);
     112void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
     113                           LDAPMod ***mods,
     114                           const char *attribute, const DATA_BLOB *newblob);
     115bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
     116                                   const char *attribute, char *value,
     117                                   int max_len);
     118int smbldap_modify(struct smbldap_state *ldap_state,
     119                   const char *dn,
     120                   LDAPMod *attrs[]);
     121int smbldap_start_tls(LDAP *ldap_struct, int version);
     122int smbldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
    254123int smbldap_search(struct smbldap_state *ldap_state,
    255124                   const char *base, int scope, const char *filter,
     
    271140                           LDAPMessage ** result);
    272141void smbldap_free_struct(struct smbldap_state **ldap_state) ;
    273 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
    274                       const char *location,
    275                       struct smbldap_state **smbldap_state);
    276142bool smbldap_has_control(LDAP *ld, const char *control);
    277143bool smbldap_has_extension(LDAP *ld, const char *extension);
    278144bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
    279145bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
    280 
    281 /* The following definitions come from lib/smbldap_util.c  */
    282 
    283 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
    284                                     LDAPMessage ** result, const char *domain_name,
    285                                     bool try_add);
     146char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     147                                       const char *attribute,
     148                                       TALLOC_CTX *mem_ctx);
     149char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     150                                      const char *attribute,
     151                                      TALLOC_CTX *mem_ctx);
     152char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     153                                         const char *attribute,
     154                                         TALLOC_CTX *mem_ctx);
     155bool smbldap_talloc_single_blob(TALLOC_CTX *mem_ctx, LDAP *ld,
     156                                LDAPMessage *msg, const char *attrib,
     157                                DATA_BLOB *blob);
     158bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
     159                      struct dom_sid *sid);
     160void smbldap_talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
     161void smbldap_talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
     162char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
     163                              LDAPMessage *entry);
    286164
    287165#endif  /* HAVE_LDAP */
    288166
    289 #define LDAP_DEFAULT_TIMEOUT   15
    290 #define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
    291 #define LDAP_PAGE_SIZE 1024
    292 
    293 #define ADS_PAGE_CTL_OID        "1.2.840.113556.1.4.319"
    294 
    295 /*
    296  * Work around versions of the LDAP client libs that don't have the OIDs
    297  * defined, or have them defined under the old name.
    298  * This functionality is really a factor of the server, not the client
    299  *
    300  */
    301 
    302 #if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
    303 #define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
    304 #elif !defined(LDAP_EXOP_MODIFY_PASSWD)
    305 #define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
    306 #endif
    307 
    308 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
    309 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
    310 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
    311 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
    312 #endif
    313 
    314 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
    315 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
    316 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
    317 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
    318 #endif
    319 
    320167#endif  /* _SMBLDAP_H */
Note: See TracChangeset for help on using the changeset viewer.