diff options
author | Jeremy Allison <jra@samba.org> | 2010-11-09 12:07:25 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-11-10 01:14:17 +0000 |
commit | 9997ee813b8ceeb7016355bbc07651db7f6b2d5a (patch) | |
tree | a82115ab85000f85e26aca4edd94d4f237c0619c /source3/smbd/service.c | |
parent | 692a7477dd3b1a40df58de09a02754dbaecb07d6 (diff) | |
download | samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.tar.gz samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.tar.bz2 samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.zip |
Remove fstring from map_username. Create a more sane interface than the called-parameter-is-modified.
Jeremy.
Diffstat (limited to 'source3/smbd/service.c')
-rw-r--r-- | source3/smbd/service.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c index ab68cb783e..efe68d7c3f 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -318,13 +318,20 @@ int find_service(fstring service) char *phome_dir = get_user_home_dir(talloc_tos(), service); if(!phome_dir) { + char *service_out = NULL; /* * Try mapping the servicename, it may * be a Windows to unix mapped user name. */ - if(map_username(service)) + if(map_username(talloc_tos(), service, &service_out)) { + if (service_out == NULL) { + /* Out of memory. */ + return -1; + } + fstrcpy(service, service_out); phome_dir = get_user_home_dir( talloc_tos(), service); + } } DEBUG(3,("checking for home directory %s gave %s\n",service, @@ -1153,12 +1160,12 @@ connection_struct *make_connection(struct smbd_server_connection *sconn, /* Security = share. Try with * current_user_info.smb_name as the username. */ if (*current_user_info.smb_name) { - fstring unix_username; - fstrcpy(unix_username, - current_user_info.smb_name); - map_username(unix_username); + char *unix_username = NULL; + (void)map_username(talloc_tos(), + current_user_info.smb_name, + &unix_username); snum = find_service(unix_username); - } + } if (snum != -1) { DEBUG(5, ("making a connection to 'homes' " "service %s based on " |