summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-05 05:56:40 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-05 05:56:40 +0000
commit086cf214cf70cbb1658a9e966f84e7c12214554c (patch)
treef71acc5803d24430ed87ddf4fc53f31dd9369e37
parentebd888d91996b8328009f985d1b69d9f698e3607 (diff)
- 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
-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 0a4e90f44..55671c4e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,9 @@
31 - markus@cvs.openbsd.org 2001/02/22 21:57:27 31 - markus@cvs.openbsd.org 2001/02/22 21:57:27
32 [ssh.1 sshd.8] 32 [ssh.1 sshd.8]
33 typos/grammar from matt@anzen.com 33 typos/grammar from matt@anzen.com
34 - markus@cvs.openbsd.org 2001/02/22 21:59:44
35 [auth.c auth.h auth1.c auth2.c misc.c misc.h ssh.c]
36 use pwcopy in ssh.c, too
34 37
3520010304 3820010304
36 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. 39 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
@@ -4223,4 +4226,4 @@
4223 - Wrote replacements for strlcpy and mkdtemp 4226 - Wrote replacements for strlcpy and mkdtemp
4224 - Released 1.0pre1 4227 - Released 1.0pre1
4225 4228
4226$Id: ChangeLog,v 1.861 2001/03/05 05:49:29 mouring Exp $ 4229$Id: ChangeLog,v 1.862 2001/03/05 05:56:40 mouring Exp $
diff --git a/auth.c b/auth.c
index 61984a076..edd22a8d2 100644
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth.c,v 1.17 2001/02/12 16:16:23 markus Exp $"); 26RCSID("$OpenBSD: auth.c,v 1.18 2001/02/22 21:59:43 markus Exp $");
27 27
28#ifdef HAVE_LOGIN_H 28#ifdef HAVE_LOGIN_H
29#include <login.h> 29#include <login.h>
@@ -170,26 +170,6 @@ authctxt_new(void)
170 return authctxt; 170 return authctxt;
171} 171}
172 172
173struct passwd *
174pwcopy(struct passwd *pw)
175{
176 struct passwd *copy = xmalloc(sizeof(*copy));
177 memset(copy, 0, sizeof(*copy));
178 copy->pw_name = xstrdup(pw->pw_name);
179 copy->pw_passwd = xstrdup(pw->pw_passwd);
180 copy->pw_uid = pw->pw_uid;
181 copy->pw_gid = pw->pw_gid;
182#ifdef HAVE_PW_CLASS_IN_PASSWD
183 copy->pw_class = xstrdup(pw->pw_class);
184#endif
185#ifdef HAVE_CYGWIN
186 copy->pw_gecos = xstrdup(pw->pw_gecos);
187#endif
188 copy->pw_dir = xstrdup(pw->pw_dir);
189 copy->pw_shell = xstrdup(pw->pw_shell);
190 return copy;
191}
192
193void 173void
194auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) 174auth_log(Authctxt *authctxt, int authenticated, char *method, char *info)
195{ 175{
diff --git a/auth.h b/auth.h
index 457553397..6afce6b3a 100644
--- a/auth.h
+++ b/auth.h
@@ -21,7 +21,7 @@
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 * 23 *
24 * $OpenBSD: auth.h,v 1.11 2001/02/12 16:16:23 markus Exp $ 24 * $OpenBSD: auth.h,v 1.12 2001/02/22 21:59:43 markus Exp $
25 */ 25 */
26#ifndef AUTH_H 26#ifndef AUTH_H
27#define AUTH_H 27#define AUTH_H
@@ -132,7 +132,6 @@ char *get_challenge(Authctxt *authctxt, char *devs);
132int verify_response(Authctxt *authctxt, char *response); 132int verify_response(Authctxt *authctxt, char *response);
133 133
134struct passwd * auth_get_user(void); 134struct passwd * auth_get_user(void);
135struct passwd * pwcopy(struct passwd *pw);
136 135
137#define AUTH_FAIL_MAX 6 136#define AUTH_FAIL_MAX 6
138#define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2) 137#define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2)
diff --git a/auth1.c b/auth1.c
index beccf2b45..4d623717f 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.17 2001/02/13 22:49:40 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.18 2001/02/22 21:59:43 markus Exp $");
14 14
15#include "xmalloc.h" 15#include "xmalloc.h"
16#include "rsa.h" 16#include "rsa.h"
@@ -23,6 +23,7 @@ RCSID("$OpenBSD: auth1.c,v 1.17 2001/02/13 22:49:40 markus Exp $");
23#include "compat.h" 23#include "compat.h"
24#include "auth.h" 24#include "auth.h"
25#include "session.h" 25#include "session.h"
26#include "misc.h"
26 27
27/* import */ 28/* import */
28extern ServerOptions options; 29extern ServerOptions options;
diff --git a/auth2.c b/auth2.c
index e90105066..5d7de3a1c 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2.c,v 1.42 2001/02/13 22:49:40 markus Exp $"); 26RCSID("$OpenBSD: auth2.c,v 1.43 2001/02/22 21:59:44 markus Exp $");
27 27
28#include <openssl/evp.h> 28#include <openssl/evp.h>
29 29
@@ -47,6 +47,7 @@ RCSID("$OpenBSD: auth2.c,v 1.42 2001/02/13 22:49:40 markus Exp $");
47#include "pathnames.h" 47#include "pathnames.h"
48#include "uidswap.h" 48#include "uidswap.h"
49#include "auth-options.h" 49#include "auth-options.h"
50#include "misc.h"
50 51
51/* import */ 52/* import */
52extern ServerOptions options; 53extern ServerOptions options;
@@ -75,7 +76,6 @@ void protocol_error(int type, int plen, void *ctxt);
75 76
76/* helper */ 77/* helper */
77Authmethod *authmethod_lookup(const char *name); 78Authmethod *authmethod_lookup(const char *name);
78struct passwd *pwcopy(struct passwd *pw);
79int user_key_allowed(struct passwd *pw, Key *key); 79int user_key_allowed(struct passwd *pw, Key *key);
80char *authmethods_get(void); 80char *authmethods_get(void);
81 81
diff --git a/misc.c b/misc.c
index 743011654..4a1213a29 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.1 2001/01/21 19:05:52 markus Exp $ */ 1/* $OpenBSD: misc.c,v 1.2 2001/02/22 21:59:44 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: misc.c,v 1.1 2001/01/21 19:05:52 markus Exp $"); 28RCSID("$OpenBSD: misc.c,v 1.2 2001/02/22 21:59:44 markus Exp $");
29 29
30#include "misc.h" 30#include "misc.h"
31#include "log.h" 31#include "log.h"
@@ -96,6 +96,21 @@ strdelim(char **s)
96 return (old); 96 return (old);
97} 97}
98 98
99struct passwd *
100pwcopy(struct passwd *pw)
101{
102 struct passwd *copy = xmalloc(sizeof(*copy));
103 memset(copy, 0, sizeof(*copy));
104 copy->pw_name = xstrdup(pw->pw_name);
105 copy->pw_passwd = xstrdup(pw->pw_passwd);
106 copy->pw_uid = pw->pw_uid;
107 copy->pw_gid = pw->pw_gid;
108 copy->pw_class = xstrdup(pw->pw_class);
109 copy->pw_dir = xstrdup(pw->pw_dir);
110 copy->pw_shell = xstrdup(pw->pw_shell);
111 return copy;
112}
113
99mysig_t 114mysig_t
100mysignal(int sig, mysig_t act) 115mysignal(int sig, mysig_t act)
101{ 116{
diff --git a/misc.h b/misc.h
index 1dd038960..3204b626a 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.h,v 1.2 2001/01/29 01:58:17 niklas Exp $ */ 1/* $OpenBSD: misc.h,v 1.3 2001/02/22 21:59:44 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -20,6 +20,8 @@ char *strdelim(char **s);
20/* set filedescriptor to non-blocking */ 20/* set filedescriptor to non-blocking */
21void set_nonblock(int fd); 21void set_nonblock(int fd);
22 22
23struct passwd * pwcopy(struct passwd *pw);
24
23/* wrapper for signal interface */ 25/* wrapper for signal interface */
24typedef void (*mysig_t)(int); 26typedef void (*mysig_t)(int);
25mysig_t mysignal(int sig, mysig_t act); 27mysig_t mysignal(int sig, mysig_t act);
diff --git a/ssh.c b/ssh.c
index 7db19f3ba..ec6f30e54 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.97 2001/02/21 21:14:04 stevesk Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.98 2001/02/22 21:59:44 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -245,7 +245,7 @@ main(int ac, char **av)
245 u_short fwd_port, fwd_host_port; 245 u_short fwd_port, fwd_host_port;
246 char *optarg, *cp, buf[256]; 246 char *optarg, *cp, buf[256];
247 struct stat st; 247 struct stat st;
248 struct passwd *pw, pwcopy; 248 struct passwd *pw;
249 int dummy; 249 int dummy;
250 uid_t original_effective_uid; 250 uid_t original_effective_uid;
251 251
@@ -555,17 +555,7 @@ main(int ac, char **av)
555 exit(1); 555 exit(1);
556 } 556 }
557 /* Take a copy of the returned structure. */ 557 /* Take a copy of the returned structure. */
558 memset(&pwcopy, 0, sizeof(pwcopy)); 558 pw = pwcopy(pw);
559 pwcopy.pw_name = xstrdup(pw->pw_name);
560 pwcopy.pw_passwd = xstrdup(pw->pw_passwd);
561 pwcopy.pw_uid = pw->pw_uid;
562 pwcopy.pw_gid = pw->pw_gid;
563#ifdef HAVE_PW_CLASS_IN_PASSWD
564 pwcopy.pw_class = xstrdup(pw->pw_class);
565#endif
566 pwcopy.pw_dir = xstrdup(pw->pw_dir);
567 pwcopy.pw_shell = xstrdup(pw->pw_shell);
568 pw = &pwcopy;
569 559
570 /* Initialize "log" output. Since we are the client all output 560 /* Initialize "log" output. Since we are the client all output
571 actually goes to the terminal. */ 561 actually goes to the terminal. */