diff options
author | Volker Lendecke <vl@samba.org> | 2011-02-26 11:53:21 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-02-27 19:19:05 +0100 |
commit | 2c9c8fa036645b8705c281fc5a104373dcee8f27 (patch) | |
tree | c7a27c1e77a58b2c5cad829a6734db97c525c89b /source3 | |
parent | c427b795c7e649ae7f747cde11f47ad021406fb2 (diff) | |
download | samba-2c9c8fa036645b8705c281fc5a104373dcee8f27.tar.gz samba-2c9c8fa036645b8705c281fc5a104373dcee8f27.tar.bz2 samba-2c9c8fa036645b8705c281fc5a104373dcee8f27.zip |
s3: Use strndup in parse_nss_param
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/nss_info.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c index a243a03948..b8e32b9945 100644 --- a/source3/winbindd/nss_info.c +++ b/source3/winbindd/nss_info.c @@ -88,8 +88,6 @@ static struct nss_function_entry *nss_get_backend(const char *name ) static bool parse_nss_parm( const char *config, char **backend, char **domain ) { char *p; - char *q; - int len; *backend = *domain = NULL; @@ -111,17 +109,8 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain ) *domain = SMB_STRDUP( p+1 ); } - len = PTR_DIFF(p,config)+1; - if ( (q = SMB_MALLOC_ARRAY( char, len )) == NULL ) { - SAFE_FREE( *backend ); - return False; - } - - StrnCpy( q, config, len-1); - q[len-1] = '\0'; - *backend = q; - - return True; + *backend = SMB_STRNDUP(config, PTR_DIFF(p, config)); + return (*backend != NULL); } static NTSTATUS nss_domain_list_add_domain(const char *domain, |