r25007: Remove more uses of pstring, move ntlmauth-specific utility function to ntlm...
authorJelmer Vernooij <jelmer@samba.org>
Fri, 7 Sep 2007 16:54:39 +0000 (16:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:05:32 +0000 (15:05 -0500)
(This used to be commit 6f224480b230ab7ccfc0417c13e7f4fc3f6f2a13)

source4/lib/util/util.h
source4/lib/util/util_str.c
source4/lib/util/util_strlist.c
source4/utils/ntlm_auth.c

index 8259e0851279c37aed8c0e0ed328ee4b49990dc7..8d71ad1a64e5d5d8c87f83ba5b40d2434464909e 100644 (file)
@@ -562,11 +562,6 @@ _PUBLIC_ bool str_list_check(const char **list, const char *s);
 */
 _PUBLIC_ bool str_list_check_ci(const char **list, const char *s);
 
-/**
- Check if a string is part of a list.
-**/
-_PUBLIC_ bool in_list(const char *s, const char *list, bool casesensitive);
-
 /* The following definitions come from lib/util/util_file.c  */
 
 
index 67e59474fd88365d4f65064a774137f9f25295d6..eb8155cc7c0098a5a29d9ce4d37b7fbef0ca3ace 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "libcli/raw/smb.h"
-#include "pstring.h"
 #include "system/locale.h"
 
 /**
@@ -237,7 +236,7 @@ _PUBLIC_ void hex_encode(const unsigned char *buff_in, size_t len, char **out_he
        int i;
        char *hex_buffer;
 
-       *out_hex_buffer = smb_xmalloc((len*2)+1);
+       *out_hex_buffer = malloc_array_p(char, (len*2)+1);
        hex_buffer = *out_hex_buffer;
 
        for (i = 0; i < len; i++)
@@ -457,7 +456,7 @@ _PUBLIC_ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s)
        if (!s || !*s) {
                return talloc_strdup(mem_ctx, "");
        }
-       ret = talloc_size(mem_ctx, strlen(s)+2);
+       ret = talloc_array(mem_ctx, char, strlen(s)+2);
        if (!ret) {
                return ret;
        }
@@ -566,7 +565,7 @@ _PUBLIC_ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib)
        };
        char *ret;
 
-       ret = talloc_size(mem_ctx, ARRAY_SIZE(attr_strs)+1);
+       ret = talloc_array(mem_ctx, char, ARRAY_SIZE(attr_strs)+1);
        if (!ret) {
                return NULL;
        }
index ab73fb2d15f239bc1c7c524792e0961a7b85dd95..a8b106a567ea041afd93da9795468e2374f5692f 100644 (file)
@@ -300,25 +300,4 @@ _PUBLIC_ bool str_list_check_ci(const char **list, const char *s)
        return false;
 }
 
-/**
- Check if a string is part of a list.
-**/
-_PUBLIC_ bool in_list(const char *s, const char *list, bool casesensitive)
-{
-       pstring tok;
-       const char *p=list;
 
-       if (!list)
-               return false;
-
-       while (next_token(&p,tok,LIST_SEP,sizeof(tok))) {
-               if (casesensitive) {
-                       if (strcmp(tok,s) == 0)
-                               return true;
-               } else {
-                       if (strcasecmp_m(tok,s) == 0)
-                               return true;
-               }
-       }
-       return false;
-}
index 4ce8fc6d3f2e4374bcb91a8f30b9f91787f607f7..9659541319e75ef222e6151950ae98a3a53dc5ca 100644 (file)
@@ -120,7 +120,7 @@ static void mux_printf(unsigned int mux_id, const char *format, ...)
 /* Copy of parse_domain_user from winbindd_util.c.  Parse a string of the
    form DOMAIN/user into a domain and a user */
 
-static BOOL parse_ntlm_auth_domain_user(const char *domuser, fstring domain, 
+static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain, 
                                        fstring user)
 {
 
@@ -324,6 +324,24 @@ static const char *get_password(struct cli_credentials *credentials)
        return password;
 }
 
+/**
+ Check if a string is part of a list.
+**/
+static bool in_list(const char *s, const char *list, bool casesensitive)
+{
+       pstring tok;
+       const char *p=list;
+
+       if (!list)
+               return false;
+
+       while (next_token(&p, tok, LIST_SEP, sizeof(tok))) {
+               if ((casesensitive?strcmp:strcasecmp_m)(tok,s) == 0)
+                       return true;
+       }
+       return false;
+}
+
 static void gensec_want_feature_list(struct gensec_security *state, char* feature_list)
 {
        if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, True)) {