diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-02-22 21:59:45 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-02-22 21:59:45 +0000 |
commit | c53bea2d689b27f3ff0de5586bf6463b04abb457 (patch) | |
tree | 7a884e1364a1d8acadc4b8752286292396a344d8 /usr.bin/ssh | |
parent | dea01b6e7f0865d98a3de5f0818d2d09b8987f0f (diff) |
use pwcopy in ssh.c, too
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/auth.c | 17 | ||||
-rw-r--r-- | usr.bin/ssh/auth.h | 3 | ||||
-rw-r--r-- | usr.bin/ssh/auth1.c | 3 | ||||
-rw-r--r-- | usr.bin/ssh/auth2.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/misc.c | 19 | ||||
-rw-r--r-- | usr.bin/ssh/misc.h | 4 | ||||
-rw-r--r-- | usr.bin/ssh/ssh.c | 14 |
7 files changed, 29 insertions, 35 deletions
diff --git a/usr.bin/ssh/auth.c b/usr.bin/ssh/auth.c index 3ec985f535a..dd2debab36b 100644 --- a/usr.bin/ssh/auth.c +++ b/usr.bin/ssh/auth.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth.c,v 1.17 2001/02/12 16:16:23 markus Exp $"); +RCSID("$OpenBSD: auth.c,v 1.18 2001/02/22 21:59:43 markus Exp $"); #include "xmalloc.h" #include "match.h" @@ -120,21 +120,6 @@ authctxt_new(void) return authctxt; } -struct passwd * -pwcopy(struct passwd *pw) -{ - struct passwd *copy = xmalloc(sizeof(*copy)); - memset(copy, 0, sizeof(*copy)); - copy->pw_name = xstrdup(pw->pw_name); - copy->pw_passwd = xstrdup(pw->pw_passwd); - copy->pw_uid = pw->pw_uid; - copy->pw_gid = pw->pw_gid; - copy->pw_class = xstrdup(pw->pw_class); - copy->pw_dir = xstrdup(pw->pw_dir); - copy->pw_shell = xstrdup(pw->pw_shell); - return copy; -} - void auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) { diff --git a/usr.bin/ssh/auth.h b/usr.bin/ssh/auth.h index f5bf80efa8c..a2e38e63d6c 100644 --- a/usr.bin/ssh/auth.h +++ b/usr.bin/ssh/auth.h @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $OpenBSD: auth.h,v 1.11 2001/02/12 16:16:23 markus Exp $ + * $OpenBSD: auth.h,v 1.12 2001/02/22 21:59:43 markus Exp $ */ #ifndef AUTH_H #define AUTH_H @@ -119,7 +119,6 @@ char *get_challenge(Authctxt *authctxt, char *devs); int verify_response(Authctxt *authctxt, char *response); struct passwd * auth_get_user(void); -struct passwd * pwcopy(struct passwd *pw); #define AUTH_FAIL_MAX 6 #define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2) diff --git a/usr.bin/ssh/auth1.c b/usr.bin/ssh/auth1.c index 494231925c2..8715c523fc4 100644 --- a/usr.bin/ssh/auth1.c +++ b/usr.bin/ssh/auth1.c @@ -10,7 +10,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth1.c,v 1.17 2001/02/13 22:49:40 markus Exp $"); +RCSID("$OpenBSD: auth1.c,v 1.18 2001/02/22 21:59:43 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -23,6 +23,7 @@ RCSID("$OpenBSD: auth1.c,v 1.17 2001/02/13 22:49:40 markus Exp $"); #include "compat.h" #include "auth.h" #include "session.h" +#include "misc.h" /* import */ extern ServerOptions options; diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c index a9c7cb3bd59..380c607b54f 100644 --- a/usr.bin/ssh/auth2.c +++ b/usr.bin/ssh/auth2.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth2.c,v 1.42 2001/02/13 22:49:40 markus Exp $"); +RCSID("$OpenBSD: auth2.c,v 1.43 2001/02/22 21:59:44 markus Exp $"); #include <openssl/evp.h> @@ -47,6 +47,7 @@ RCSID("$OpenBSD: auth2.c,v 1.42 2001/02/13 22:49:40 markus Exp $"); #include "pathnames.h" #include "uidswap.h" #include "auth-options.h" +#include "misc.h" /* import */ extern ServerOptions options; @@ -71,7 +72,6 @@ void protocol_error(int type, int plen, void *ctxt); /* helper */ Authmethod *authmethod_lookup(const char *name); -struct passwd *pwcopy(struct passwd *pw); int user_key_allowed(struct passwd *pw, Key *key); char *authmethods_get(void); diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index e4e1fc76c17..31d6713db17 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.1 2001/01/21 19:05:52 markus Exp $ */ +/* $OpenBSD: misc.c,v 1.2 2001/02/22 21:59:44 markus Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: misc.c,v 1.1 2001/01/21 19:05:52 markus Exp $"); +RCSID("$OpenBSD: misc.c,v 1.2 2001/02/22 21:59:44 markus Exp $"); #include "misc.h" #include "log.h" @@ -95,3 +95,18 @@ strdelim(char **s) return (old); } + +struct passwd * +pwcopy(struct passwd *pw) +{ + struct passwd *copy = xmalloc(sizeof(*copy)); + memset(copy, 0, sizeof(*copy)); + copy->pw_name = xstrdup(pw->pw_name); + copy->pw_passwd = xstrdup(pw->pw_passwd); + copy->pw_uid = pw->pw_uid; + copy->pw_gid = pw->pw_gid; + copy->pw_class = xstrdup(pw->pw_class); + copy->pw_dir = xstrdup(pw->pw_dir); + copy->pw_shell = xstrdup(pw->pw_shell); + return copy; +} diff --git a/usr.bin/ssh/misc.h b/usr.bin/ssh/misc.h index 16370425a17..2630dd75f15 100644 --- a/usr.bin/ssh/misc.h +++ b/usr.bin/ssh/misc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.2 2001/01/29 01:58:17 niklas Exp $ */ +/* $OpenBSD: misc.h,v 1.3 2001/02/22 21:59:44 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -19,3 +19,5 @@ char *strdelim(char **s); /* set filedescriptor to non-blocking */ void set_nonblock(int fd); + +struct passwd * pwcopy(struct passwd *pw); diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 191e5c8343c..ac422b7b0b8 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.97 2001/02/21 21:14:04 stevesk Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.98 2001/02/22 21:59:44 markus Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -237,7 +237,7 @@ main(int ac, char **av) u_short fwd_port, fwd_host_port; char *optarg, *cp, buf[256]; struct stat st; - struct passwd *pw, pwcopy; + struct passwd *pw; int dummy; uid_t original_effective_uid; @@ -542,15 +542,7 @@ main(int ac, char **av) exit(1); } /* Take a copy of the returned structure. */ - memset(&pwcopy, 0, sizeof(pwcopy)); - pwcopy.pw_name = xstrdup(pw->pw_name); - pwcopy.pw_passwd = xstrdup(pw->pw_passwd); - pwcopy.pw_uid = pw->pw_uid; - pwcopy.pw_gid = pw->pw_gid; - pwcopy.pw_class = xstrdup(pw->pw_class); - pwcopy.pw_dir = xstrdup(pw->pw_dir); - pwcopy.pw_shell = xstrdup(pw->pw_shell); - pw = &pwcopy; + pw = pwcopy(pw); /* Initialize "log" output. Since we are the client all output actually goes to the terminal. */ |