aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-16 22:24:31 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-16 23:04:25 +0200
commitddcb88070be3060ee2ab089d292b9eb357c30ed7 (patch)
tree45a36fc2abb96cddbe8d06152b952c896cfdacad /src/misc.c
parent1a0fbedc2e7bc688ce380bbb465a5e1710355666 (diff)
downloadlibssh-ddcb88070be3060ee2ab089d292b9eb357c30ed7.tar.gz
libssh-ddcb88070be3060ee2ab089d292b9eb357c30ed7.tar.xz
libssh-ddcb88070be3060ee2ab089d292b9eb357c30ed7.zip
misc: Remove session from ssh_get_local_username().
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/misc.c b/src/misc.c
index 361fc2d3..f3fcf110 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -138,24 +138,23 @@ int gettimeofday(struct timeval *__p, void *__t) {
return (0);
}
-char *ssh_get_local_username(ssh_session session) {
- DWORD size = 0;
- char *user;
+char *ssh_get_local_username(void) {
+ DWORD size = 0;
+ char *user;
- /* get the size */
- GetUserName(NULL, &size);
+ /* get the size */
+ GetUserName(NULL, &size);
- user = (char *) malloc(size);
- if (user == NULL) {
- ssh_set_error_oom(session);
- return NULL;
- }
+ user = (char *) malloc(size);
+ if (user == NULL) {
+ return NULL;
+ }
- if (GetUserName(user, &size)) {
- return user;
- }
+ if (GetUserName(user, &size)) {
+ return user;
+ }
- return NULL;
+ return NULL;
}
int ssh_is_ipaddr_v4(const char *str) {
@@ -233,7 +232,7 @@ int ssh_file_readaccess_ok(const char *file) {
return 1;
}
-char *ssh_get_local_username(ssh_session session) {
+char *ssh_get_local_username(void) {
struct passwd pwd;
struct passwd *pwdbuf;
char buf[NSS_BUFLEN_PASSWD];
@@ -242,16 +241,13 @@ char *ssh_get_local_username(ssh_session session) {
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
if (rc != 0) {
- ssh_set_error(session, SSH_FATAL,
- "Couldn't retrieve information for current user!");
return NULL;
}
name = strdup(pwd.pw_name);
if (name == NULL) {
- ssh_set_error_oom(session);
- return NULL;
+ return NULL;
}
return name;
@@ -724,7 +720,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
x = strdup(session->sshdir);
break;
case 'u':
- x = ssh_get_local_username(session);
+ x = ssh_get_local_username();
break;
case 'l':
if (gethostname(host, sizeof(host) == 0)) {