Remove pstring usages.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 22 Oct 2008 02:25:00 +0000 (04:25 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 22 Oct 2008 02:25:00 +0000 (04:25 +0200)
source4/client/smbmount.c
source4/include/pstring.h
source4/libcli/auth/smbencrypt.c
source4/utils/ntlm_auth.c

index 37c9eaadc47b3c2f541a46e6c614ba5ed02e1577..d2e98eb14000440dde6d2c8c034a95868a9b6546 100644 (file)
@@ -24,6 +24,9 @@
 #include <asm/types.h>
 #include <linux/smb_fs.h>
 
+#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
+#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
+
 static pstring credentials;
 static pstring my_netbios_name;
 static pstring password;
index 0cbc964c34cb3b4818a129c3171ea437a616d53c..43fd7fdfcff292f92b17d8914826fde49e79b0a9 100644 (file)
@@ -33,8 +33,6 @@
 _DEPRECATED_ typedef char pstring[PSTRING_LEN];
 typedef char fstring[FSTRING_LEN];
 
-#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
-#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
 
index 096f51e49b19508358bf147a9286477329b2e88c..54daf19a124fd763908ca127a676dcf102aee49c 100644 (file)
@@ -27,7 +27,6 @@
 #include "auth/ntlmssp/msrpc_parse.h"
 #include "../lib/crypto/crypto.h"
 #include "libcli/auth/libcli_auth.h"
-#include "pstring.h"
 #include "param/param.h"
 
 /*
@@ -94,7 +93,7 @@ bool E_md4hash(const char *passwd, uint8_t p16[16])
 bool E_deshash(const char *passwd, uint8_t p16[16])
 {
        bool ret = true;
-       fstring dospwd; 
+       char dospwd[20];
        ZERO_STRUCT(dospwd);
 
        /* Password must be converted to DOS charset - null terminated, uppercase. */
index 1ec87c6b428760c1dacd312c01dc71e9add9d791..1a0a97587961dea80af3936de764f0ae4417c47a 100644 (file)
@@ -127,8 +127,8 @@ 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, 
-                                       fstring user, char winbind_separator)
+static bool parse_ntlm_auth_domain_user(const char *domuser, char **domain, 
+                                                                               char **user, char winbind_separator)
 {
 
        char *p = strchr(domuser, winbind_separator);
@@ -137,9 +137,9 @@ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
                return false;
        }
         
-       fstrcpy(user, p+1);
-       fstrcpy(domain, domuser);
-       domain[PTR_DIFF(p, domuser)] = 0;
+       *user = smb_xstrdup(p+1);
+       *domain = smb_xstrdup(domuser);
+       (*domain)[PTR_DIFF(p, domuser)] = 0;
 
        return true;
 }
@@ -753,18 +753,14 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                        uint32_t flags = 0;
 
                        if (full_username && !username) {
-                               fstring fstr_user;
-                               fstring fstr_domain;
-                               
-                               if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain, 
-                                                                *lp_winbind_separator(lp_ctx))) {
+                               SAFE_FREE(username);
+                               SAFE_FREE(domain);
+                               if (!parse_ntlm_auth_domain_user(full_username, &username, 
+                                                                                                &domain, 
+                                                                                                *lp_winbind_separator(lp_ctx))) {
                                        /* username might be 'tainted', don't print into our new-line deleimianted stream */
                                        mux_printf(mux_id, "Error: Could not parse into domain and username\n");
                                }
-                               SAFE_FREE(username);
-                               SAFE_FREE(domain);
-                               username = smb_xstrdup(fstr_user);
-                               domain = smb_xstrdup(fstr_domain);
                        }
 
                        if (!domain) {