Remove smbldap_get_single_pstring() and all pstrings
[samba.git] / source / lib / smbldap.c
index f8cb8f4a25d798ac06c6aa0e5e51fea21b4b0b23..662a5a948a523c0908dc7e14161f9c17df1463de 100644 (file)
@@ -9,7 +9,7 @@
     
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -18,8 +18,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
@@ -262,7 +261,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
  Search an attribute and return the first value found.
 ******************************************************************/
 
BOOL smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
                                    const char *attribute, char *value,
                                    int max_len)
 {
@@ -293,14 +292,6 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
        return True;
 }
 
- BOOL smbldap_get_single_pstring (LDAP * ldap_struct, LDAPMessage * entry,
-                                 const char *attribute, pstring value)
-{
-       return smbldap_get_single_attribute(ldap_struct, entry,
-                                           attribute, value, 
-                                           sizeof(pstring));
-}
-
  char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
                                        const char *attribute,
                                        TALLOC_CTX *mem_ctx)
@@ -409,9 +400,8 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
        if (mods == NULL) {
                mods = SMB_MALLOC_P(LDAPMod *);
                if (mods == NULL) {
-                       smb_panic("smbldap_set_mod: out of memory!\n");
+                       smb_panic("smbldap_set_mod: out of memory!");
                        /* notreached. */
-                       abort();
                }
                mods[0] = NULL;
        }
@@ -424,15 +414,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
        if (mods[i] == NULL) {
                mods = SMB_REALLOC_ARRAY (mods, LDAPMod *, i + 2);
                if (mods == NULL) {
-                       smb_panic("smbldap_set_mod: out of memory!\n");
+                       smb_panic("smbldap_set_mod: out of memory!");
                        /* notreached. */
-                       abort();
                }
                mods[i] = SMB_MALLOC_P(LDAPMod);
                if (mods[i] == NULL) {
-                       smb_panic("smbldap_set_mod: out of memory!\n");
+                       smb_panic("smbldap_set_mod: out of memory!");
                        /* notreached. */
-                       abort();
                }
                mods[i]->mod_op = modop;
                mods[i]->mod_values = NULL;
@@ -450,15 +438,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
                mods[i]->mod_values = SMB_REALLOC_ARRAY(mods[i]->mod_values, char *, j + 2);
                                               
                if (mods[i]->mod_values == NULL) {
-                       smb_panic("smbldap_set_mod: out of memory!\n");
+                       smb_panic("smbldap_set_mod: out of memory!");
                        /* notreached. */
-                       abort();
                }
 
                if (push_utf8_allocate(&utf8_value, value) == (size_t)-1) {
-                       smb_panic("smbldap_set_mod: String conversion failure!\n");
+                       smb_panic("smbldap_set_mod: String conversion failure!");
                        /* notreached. */
-                       abort();
                }
 
                mods[i]->mod_values[j] = utf8_value;
@@ -478,7 +464,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
                      const char *attribute, const char *newval)
 {
        char oldval[2048]; /* current largest allowed value is mungeddial */
-       BOOL existed;
+       bool existed;
 
        if (attribute == NULL) {
                /* This can actually happen for ldapsam_compat where we for
@@ -1011,7 +997,7 @@ static void smbldap_idle_fn(struct event_context *event_ctx,
 static int smbldap_open(struct smbldap_state *ldap_state)
 {
        int rc, opt_rc;
-       BOOL reopen = False;
+       bool reopen = False;
        SMB_ASSERT(ldap_state);
                
 #ifndef NO_LDAP_SECURITY
@@ -1103,7 +1089,7 @@ static NTSTATUS smbldap_close(struct smbldap_state *ldap_state)
        return NT_STATUS_OK;
 }
 
-static BOOL got_alarm;
+static bool got_alarm;
 
 static void (*old_handler)(int);
 
@@ -1300,7 +1286,7 @@ int smbldap_search_paged(struct smbldap_state *ldap_state,
        BerElement      *cookie_be = NULL;
        struct berval   *cookie_bv = NULL;
        int             tmp = 0, i, rc;
-       BOOL            critical = True;
+       bool            critical = True;
 
        *res = NULL;
 
@@ -1681,13 +1667,13 @@ char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry)
  Check if root-dse has a certain Control or Extension
 ********************************************************************/
 
-static BOOL smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value) 
+static bool smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value) 
 {
        LDAPMessage *msg = NULL;
        LDAPMessage *entry = NULL;
        char **values = NULL;
        int rc, num_result, num_values, i;
-       BOOL result = False;
+       bool result = False;
 
        if (!attrs[0]) {
                DEBUG(3,("smbldap_check_root_dse: nothing to look for\n"));
@@ -1757,7 +1743,7 @@ static BOOL smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *val
  Check if LDAP-Server supports a certain Control (OID in string format)
 ********************************************************************/
 
-BOOL smbldap_has_control(LDAP *ld, const char *control)
+bool smbldap_has_control(LDAP *ld, const char *control)
 {
        const char *attrs[] = { "supportedControl", NULL };
        return smbldap_check_root_dse(ld, attrs, control);
@@ -1767,7 +1753,7 @@ BOOL smbldap_has_control(LDAP *ld, const char *control)
  Check if LDAP-Server supports a certain Extension (OID in string format)
 ********************************************************************/
 
-BOOL smbldap_has_extension(LDAP *ld, const char *extension)
+bool smbldap_has_extension(LDAP *ld, const char *extension)
 {
        const char *attrs[] = { "supportedExtension", NULL };
        return smbldap_check_root_dse(ld, attrs, extension);
@@ -1777,13 +1763,13 @@ BOOL smbldap_has_extension(LDAP *ld, const char *extension)
  Check if LDAP-Server holds a given namingContext
 ********************************************************************/
 
-BOOL smbldap_has_naming_context(LDAP *ld, const char *naming_context)
+bool smbldap_has_naming_context(LDAP *ld, const char *naming_context)
 {
        const char *attrs[] = { "namingContexts", NULL };
        return smbldap_check_root_dse(ld, attrs, naming_context);
 }
 
-BOOL smbldap_set_creds(struct smbldap_state *ldap_state, BOOL anon, const char *dn, const char *secret)
+bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret)
 {
        ldap_state->anonymous = anon;