summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--auth.c22
-rw-r--r--auth.h3
-rw-r--r--auth1.c3
-rw-r--r--auth2.c4
-rw-r--r--misc.c19
-rw-r--r--misc.h4
-rw-r--r--ssh.c16
8 files changed, 33 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a4e90f4..55671c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,9 @@
- markus@cvs.openbsd.org 2001/02/22 21:57:27
[ssh.1 sshd.8]
typos/grammar from matt@anzen.com
+ - markus@cvs.openbsd.org 2001/02/22 21:59:44
+ [auth.c auth.h auth1.c auth2.c misc.c misc.h ssh.c]
+ use pwcopy in ssh.c, too
20010304
- (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
@@ -4223,4 +4226,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.861 2001/03/05 05:49:29 mouring Exp $
+$Id: ChangeLog,v 1.862 2001/03/05 05:56:40 mouring Exp $
diff --git a/auth.c b/auth.c
index 61984a07..edd22a8d 100644
--- a/auth.c
+++ b/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 $");
#ifdef HAVE_LOGIN_H
#include <login.h>
@@ -170,26 +170,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;
-#ifdef HAVE_PW_CLASS_IN_PASSWD
- copy->pw_class = xstrdup(pw->pw_class);
-#endif
-#ifdef HAVE_CYGWIN
- copy->pw_gecos = xstrdup(pw->pw_gecos);
-#endif
- 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/auth.h b/auth.h
index 45755339..6afce6b3 100644
--- a/auth.h
+++ b/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
@@ -132,7 +132,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/auth1.c b/auth1.c
index beccf2b4..4d623717 100644
--- a/auth1.c
+++ b/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/auth2.c b/auth2.c
index e9010506..5d7de3a1 100644
--- a/auth2.c
+++ b/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;
@@ -75,7 +76,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/misc.c b/misc.c
index 74301165..4a1213a2 100644
--- a/misc.c
+++ b/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"
@@ -96,6 +96,21 @@ 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;
+}
+
mysig_t
mysignal(int sig, mysig_t act)
{
diff --git a/misc.h b/misc.h
index 1dd03896..3204b626 100644
--- a/misc.h
+++ b/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>
@@ -20,6 +20,8 @@ char *strdelim(char **s);
/* set filedescriptor to non-blocking */
void set_nonblock(int fd);
+struct passwd * pwcopy(struct passwd *pw);
+
/* wrapper for signal interface */
typedef void (*mysig_t)(int);
mysig_t mysignal(int sig, mysig_t act);
diff --git a/ssh.c b/ssh.c
index 7db19f3b..ec6f30e5 100644
--- a/ssh.c
+++ b/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>
@@ -245,7 +245,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;
@@ -555,17 +555,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;
-#ifdef HAVE_PW_CLASS_IN_PASSWD
- pwcopy.pw_class = xstrdup(pw->pw_class);
-#endif
- 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. */