[auth.c auth.h auth1.c auth2.c misc.c misc.h ssh.c]
     use pwcopy in ssh.c, too
This commit is contained in:
Ben Lindstrom 2001-03-05 05:56:40 +00:00
parent ebd888d919
commit 086cf214cf
8 changed files with 33 additions and 43 deletions

View File

@ -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 $

22
auth.c
View File

@ -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)
{

3
auth.h
View File

@ -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)

View File

@ -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;

View File

@ -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);

19
misc.c
View File

@ -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)
{

4
misc.h
View File

@ -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);

16
ssh.c
View File

@ -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. */