r25007: Remove more uses of pstring, move ntlmauth-specific utility function to ntlm...
[kai/samba.git] / source4 / utils / ntlm_auth.c
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)) {