Author: jelmer
Date: 2007-09-07 16:54:39 +0000 (Fri, 07 Sep 2007)
New Revision: 25007

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25007

Log:
Remove more uses of pstring, move ntlmauth-specific utility function to 
ntlm-auth.c
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/util/util.h
   branches/SAMBA_4_0/source/lib/util/util_str.c
   branches/SAMBA_4_0/source/lib/util/util_strlist.c
   branches/SAMBA_4_0/source/utils/ntlm_auth.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/util/util.h
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util.h   2007-09-07 16:45:06 UTC (rev 
25006)
+++ branches/SAMBA_4_0/source/lib/util/util.h   2007-09-07 16:54:39 UTC (rev 
25007)
@@ -562,11 +562,6 @@
 */
 _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  */
 
 

Modified: branches/SAMBA_4_0/source/lib/util/util_str.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util_str.c       2007-09-07 16:45:06 UTC 
(rev 25006)
+++ branches/SAMBA_4_0/source/lib/util/util_str.c       2007-09-07 16:54:39 UTC 
(rev 25007)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "libcli/raw/smb.h"
-#include "pstring.h"
 #include "system/locale.h"
 
 /**
@@ -237,7 +236,7 @@
        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 @@
        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 @@
        };
        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;
        }

Modified: branches/SAMBA_4_0/source/lib/util/util_strlist.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util_strlist.c   2007-09-07 16:45:06 UTC 
(rev 25006)
+++ branches/SAMBA_4_0/source/lib/util/util_strlist.c   2007-09-07 16:54:39 UTC 
(rev 25007)
@@ -300,25 +300,4 @@
        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;
-}

Modified: branches/SAMBA_4_0/source/utils/ntlm_auth.c
===================================================================
--- branches/SAMBA_4_0/source/utils/ntlm_auth.c 2007-09-07 16:45:06 UTC (rev 
25006)
+++ branches/SAMBA_4_0/source/utils/ntlm_auth.c 2007-09-07 16:54:39 UTC (rev 
25007)
@@ -120,7 +120,7 @@
 /* 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 @@
        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)) {

Reply via email to