mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
Improve ssh_options_default_username().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@360 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -548,6 +548,10 @@ static char *get_username_from_uid(SSH_OPTIONS *opt, uid_t uid){
|
||||
int ssh_options_default_username(SSH_OPTIONS *opt) {
|
||||
char *user = NULL;
|
||||
|
||||
if (opt == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opt->username) {
|
||||
return 0;
|
||||
}
|
||||
@@ -569,7 +573,7 @@ int ssh_options_default_username(SSH_OPTIONS *opt){
|
||||
opt->username=user;
|
||||
return 0;
|
||||
} else {
|
||||
free(user);
|
||||
SAFE_FREE(user);
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user