WARNSify, fix .Nm usage, bzero -> memset

This commit is contained in:
lukem 1997-10-18 12:48:40 +00:00
parent 5f18af1fa6
commit 5645d77b1c
6 changed files with 39 additions and 29 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: chpass.1,v 1.9 1997/03/08 14:14:36 mouse Exp $ .\" $NetBSD: chpass.1,v 1.10 1997/10/18 12:48:40 lukem Exp $
.\" .\"
.\" Copyright (c) 1988, 1990, 1993 .\" Copyright (c) 1988, 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -40,12 +40,12 @@
.Nm chpass .Nm chpass
.Nd add or change user database information .Nd add or change user database information
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm chpass .Nm
.Op Fl a Ar list .Op Fl a Ar list
.Op Fl s Ar newshell .Op Fl s Ar newshell
.Op user .Op user
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm Chpass .Nm
allows editing of the user database information associated allows editing of the user database information associated
with with
.Ar user .Ar user
@ -186,7 +186,7 @@ and
numbers. numbers.
.Pp .Pp
Once the information has been verified, Once the information has been verified,
.Nm chpass .Nm
uses uses
.Xr pwd_mkdb 8 .Xr pwd_mkdb 8
to update the user database. to update the user database.

View File

@ -1,4 +1,4 @@
/* $NetBSD: chpass.c,v 1.13 1997/07/25 06:40:32 mikel Exp $ */ /* $NetBSD: chpass.c,v 1.14 1997/10/18 12:48:47 lukem Exp $ */
/*- /*-
* Copyright (c) 1988, 1993, 1994 * Copyright (c) 1988, 1993, 1994
@ -33,17 +33,17 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
#ifndef lint #ifndef lint
static char copyright[] = __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
"@(#) Copyright (c) 1988, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n");
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
#else #else
static char rcsid[] = "$NetBSD: chpass.c,v 1.13 1997/07/25 06:40:32 mikel Exp $"; __RCSID("$NetBSD: chpass.c,v 1.14 1997/10/18 12:48:47 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -76,11 +76,11 @@ int yflag;
void (*Pw_error) __P((const char *, int, int)); void (*Pw_error) __P((const char *, int, int));
#ifdef YP #ifdef YP
extern struct passwd *ypgetpwnam(), *ypgetpwuid();
extern int _yp_check __P((char **)); /* buried deep inside libc */ extern int _yp_check __P((char **)); /* buried deep inside libc */
#endif #endif
void baduser __P((void)); void baduser __P((void));
int main __P((int, char **));
void usage __P((void)); void usage __P((void));
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: chpass.h,v 1.6 1997/07/25 06:36:02 mikel Exp $ */ /* $NetBSD: chpass.h,v 1.7 1997/10/18 12:48:51 lukem Exp $ */
/* /*
* Copyright (c) 1988, 1993, 1994 * Copyright (c) 1988, 1993, 1994
@ -39,7 +39,7 @@ struct passwd;
typedef struct _entry { typedef struct _entry {
char *prompt; char *prompt;
int (*func)(), restricted, len; int (*func) __P((char *, struct passwd *, struct _entry *)), restricted, len;
char *except, *save; char *except, *save;
} ENTRY; } ENTRY;
@ -78,6 +78,8 @@ int check_yppasswdd __P((void));
int pw_yp __P((struct passwd *, uid_t)); int pw_yp __P((struct passwd *, uid_t));
void yppw_error __P((const char *name, int, int)); void yppw_error __P((const char *name, int, int));
void yppw_prompt __P((void)); void yppw_prompt __P((void));
struct passwd *ypgetpwnam __P((const char *));
struct passwd *ypgetpwuid __P((uid_t));
#endif #endif
extern void (*Pw_error) __P((const char *name, int, int)); extern void (*Pw_error) __P((const char *name, int, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: edit.c,v 1.8 1997/02/11 08:26:27 mrg Exp $ */ /* $NetBSD: edit.c,v 1.9 1997/10/18 12:48:55 lukem Exp $ */
/*- /*-
* Copyright (c) 1990, 1993, 1994 * Copyright (c) 1990, 1993, 1994
@ -33,11 +33,12 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
#else #else
static char rcsid[] = "$NetBSD: edit.c,v 1.8 1997/02/11 08:26:27 mrg Exp $"; __RCSID("$NetBSD: edit.c,v 1.9 1997/10/18 12:48:55 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -98,7 +99,7 @@ display(tempname, fd, pw)
struct passwd *pw; struct passwd *pw;
{ {
FILE *fp; FILE *fp;
char *bp, *p, *ttoa(); char *bp, *p;
if (!(fp = fdopen(fd, "w"))) if (!(fp = fdopen(fd, "w")))
(*Pw_error)(tempname, 1, 1); (*Pw_error)(tempname, 1, 1);
@ -209,7 +210,7 @@ bad: (void)fclose(fp);
len = strlen(list[E_NAME].save) + strlen(list[E_BPHONE].save) + len = strlen(list[E_NAME].save) + strlen(list[E_BPHONE].save) +
strlen(list[E_HPHONE].save) + strlen(list[E_LOCATE].save) + 4; strlen(list[E_HPHONE].save) + strlen(list[E_LOCATE].save) + 4;
if (!(p = malloc(len))) if (!(p = malloc(len)))
err(1, NULL); err(1, "malloc");
(void)snprintf(pw->pw_gecos = p, len, "%s,%s,%s,%s", list[E_NAME].save, (void)snprintf(pw->pw_gecos = p, len, "%s,%s,%s,%s", list[E_NAME].save,
list[E_LOCATE].save, list[E_BPHONE].save, list[E_HPHONE].save); list[E_LOCATE].save, list[E_BPHONE].save, list[E_HPHONE].save);

View File

@ -1,4 +1,4 @@
/* $NetBSD: field.c,v 1.3 1995/03/26 04:55:28 glass Exp $ */ /* $NetBSD: field.c,v 1.4 1997/10/18 12:49:00 lukem Exp $ */
/* /*
* Copyright (c) 1988, 1993, 1994 * Copyright (c) 1988, 1993, 1994
@ -33,11 +33,12 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94";
#else #else
static char rcsid[] = "$NetBSD: field.c,v 1.3 1995/03/26 04:55:28 glass Exp $"; __RCSID("$NetBSD: field.c,v 1.4 1997/10/18 12:49:00 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -247,7 +248,7 @@ p_shell(p, pw, ep)
struct passwd *pw; struct passwd *pw;
ENTRY *ep; ENTRY *ep;
{ {
char *t, *ok_shell(); char *t;
if (!*p) { if (!*p) {
pw->pw_shell = _PATH_BSHELL; pw->pw_shell = _PATH_BSHELL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pw_yp.c,v 1.11 1997/07/25 06:37:27 mikel Exp $ */ /* $NetBSD: pw_yp.c,v 1.12 1997/10/18 12:49:05 lukem Exp $ */
/* /*
* Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1988 The Regents of the University of California.
@ -32,33 +32,42 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)pw_yp.c 1.0 2/2/93"; static char sccsid[] = "@(#)pw_yp.c 1.0 2/2/93";
#else #else
static char rcsid[] = "$NetBSD: pw_yp.c,v 1.11 1997/07/25 06:37:27 mikel Exp $"; __RCSID("$NetBSD: pw_yp.c,v 1.12 1997/10/18 12:49:05 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#ifdef YP #ifdef YP
#include <err.h> #include <err.h>
#include <errno.h>
#include <netdb.h>
#include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <netdb.h>
#include <time.h> #include <time.h>
#include <pwd.h> #include <unistd.h>
#include <errno.h>
#include <rpc/rpc.h> #include <rpc/rpc.h>
#include <rpcsvc/yp_prot.h> #include <rpcsvc/yp_prot.h>
#include <rpcsvc/ypclnt.h> #include <rpcsvc/ypclnt.h>
#define passwd yp_passwd_rec #define passwd yp_passwd_rec
#include <rpcsvc/yppasswd.h> #include <rpcsvc/yppasswd.h>
#undef passwd #undef passwd
#include "chpass.h"
static char *domain; static char *domain;
static struct passwd *interpret __P((struct passwd *, char *));
static char *pwskip __P((char *));
/* /*
* Check if rpc.yppasswdd is running on the master YP server. * Check if rpc.yppasswdd is running on the master YP server.
* XXX this duplicates some code, but is much less complex * XXX this duplicates some code, but is much less complex
@ -106,12 +115,10 @@ pw_yp(pw, uid)
uid_t uid; uid_t uid;
{ {
char *master; char *master;
char *pp;
int r, rpcport, status; int r, rpcport, status;
struct yppasswd yppasswd; struct yppasswd yppasswd;
struct timeval tv; struct timeval tv;
CLIENT *client; CLIENT *client;
extern char *getpass();
/* /*
* Get local domain * Get local domain
@ -152,7 +159,7 @@ pw_yp(pw, uid)
} }
/* prompt for old password */ /* prompt for old password */
bzero(&yppasswd, sizeof yppasswd); memset(&yppasswd, 0, sizeof yppasswd);
yppasswd.oldpass = "none"; yppasswd.oldpass = "none";
yppasswd.oldpass = getpass("Old password:"); yppasswd.oldpass = getpass("Old password:");
if (!yppasswd.oldpass) { if (!yppasswd.oldpass) {
@ -209,7 +216,6 @@ interpret(pwent, line)
char *line; char *line;
{ {
char *p = line; char *p = line;
int c;
pwent->pw_passwd = "*"; pwent->pw_passwd = "*";
pwent->pw_uid = 0; pwent->pw_uid = 0;
@ -246,7 +252,7 @@ interpret(pwent, line)
struct passwd * struct passwd *
ypgetpwnam(nam) ypgetpwnam(nam)
char *nam; const char *nam;
{ {
static struct passwd pwent; static struct passwd pwent;
static char line[1024]; static char line[1024];