WARNSify, fix .Nm usage
This commit is contained in:
parent
fa580a821a
commit
b879efa7db
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.4 1997/01/07 04:08:12 tls Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.5 1997/10/19 12:29:35 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994
|
||||
|
@ -36,8 +36,8 @@
|
|||
*/
|
||||
|
||||
int kadm_passwd __P((char *, char *, char *, char *));
|
||||
int krb_check __P((void));
|
||||
int krb_passwd __P((void));
|
||||
int local_passwd __P((char *));
|
||||
void to64 __P((char *, long, int));
|
||||
int yp_passwd __P((char *));
|
||||
|
||||
int krb_check __P((void));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: krb5_passwd.c,v 1.4 1997/02/11 09:35:56 mrg Exp $ */
|
||||
/* $NetBSD: krb5_passwd.c,v 1.5 1997/10/19 12:29:44 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "from: @(#)krb_passwd.c 5.4 (Berkeley) 3/1/91";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: krb5_passwd.c,v 1.4 1997/02/11 09:35:56 mrg Exp $";
|
||||
__RCSID("$NetBSD: krb5_passwd.c,v 1.5 1997/10/19 12:29:44 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -48,13 +48,14 @@ static char rcsid[] = "$NetBSD: krb5_passwd.c,v 1.4 1997/02/11 09:35:56 mrg Exp
|
|||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <krb5/adm_defs.h>
|
||||
#include <krb5/krb5.h>
|
||||
#include <krb5/kdb.h>
|
||||
|
@ -151,8 +152,7 @@ krb_passwd()
|
|||
* Network() verifies the terminal device is not a pseudo tty
|
||||
*/
|
||||
if (networked() && krb_secure) {
|
||||
fprintf(stderr,"passwd: Sorry but you cannot %s from a\n", argv[0]);
|
||||
fprintf(stderr," pseudo tty terminal.\n");
|
||||
warnx("Sorry but you cannot %s from a pseudo tty terminal", argv[0]);
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -160,13 +160,13 @@ krb_passwd()
|
|||
|
||||
/* (3 * 255) + 1 (/) + 1 (@) + 1 (NULL) */
|
||||
if ((client_name = (char *) calloc (1, (3 * 256))) == NULL) {
|
||||
fprintf(stderr, "passwd: No Memory for Client_name\n");
|
||||
warnx("No Memory for Client_name");
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((requested_realm.data = (char *) calloc (1, 256)) == NULL) {
|
||||
fprintf(stderr, "passwd: No Memory for realm_name\n");
|
||||
warnx("No Memory for realm_name");
|
||||
retval = 1;
|
||||
free(client_name);
|
||||
goto finish;
|
||||
|
@ -177,8 +177,7 @@ krb_passwd()
|
|||
(void)signal(SIGTSTP, SIG_IGN);
|
||||
|
||||
if (setrlimit(RLIMIT_CORE, &rl) < 0) {
|
||||
(void)fprintf(stderr,
|
||||
"passwd: setrlimit: %s\n", strerror(errno));
|
||||
warn("setrlimit");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -187,7 +186,7 @@ krb_passwd()
|
|||
|
||||
/* Identify Default Credentials Cache */
|
||||
if ((retval = krb5_cc_default(&cache))) {
|
||||
fprintf(stderr, "passwd: Error while getting default ccache.\n");
|
||||
warnx("Error while getting default ccache.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -205,20 +204,19 @@ krb_passwd()
|
|||
(void)strncpy(default_name, pw->pw_name, sizeof(default_name) - 1);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"passwd: Unable to Identify Customer from Password File\n");
|
||||
warnx("Unable to Identify Customer from Password File");
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
/* Use this to get default_realm and format client_name */
|
||||
if ((retval = krb5_parse_name(default_name, &client))) {
|
||||
fprintf(stderr, "passwd: Unable to Parse Client Name\n");
|
||||
warnx("Unable to Parse Client Name");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((retval = krb5_unparse_name(client, &client_name))) {
|
||||
fprintf(stderr, "passwd: Unable to Parse Client Name\n");
|
||||
warnx("Unable to Parse Client Name");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -230,12 +228,12 @@ krb_passwd()
|
|||
else {
|
||||
/* Read Client from Cache */
|
||||
if ((retval = krb5_cc_get_principal(cache, (krb5_principal *) &client))) {
|
||||
fprintf(stderr, "passwd: Unable to Read Customer Credentials File\n");
|
||||
warnx("Unable to Read Customer Credentials File");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((retval = krb5_unparse_name(client, &client_name))) {
|
||||
fprintf(stderr, "passwd: Unable to Parse Client Name\n");
|
||||
warnx("Unable to Parse Client Name");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -252,11 +250,11 @@ krb_passwd()
|
|||
getpid());
|
||||
|
||||
if ((retval = krb5_cc_resolve(cache_name, &cache))) {
|
||||
fprintf(stderr, "passwd: Unable to Resolve Cache: %s\n", cache_name);
|
||||
warnx("Unable to Resolve Cache: %s", cache_name);
|
||||
}
|
||||
|
||||
if ((retval = krb5_cc_initialize(cache, client))) {
|
||||
fprintf(stderr, "passwd: Error initializing cache: %s\n", cache_name);
|
||||
warnx("Error initializing cache: %s", cache_name);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -280,7 +278,7 @@ krb_passwd()
|
|||
|
||||
retval = krb5_net_write(local_socket, (char *) &msg_length + 2, 2);
|
||||
if (retval < 0) {
|
||||
fprintf(stderr, "passwd: krb5_net_write failure\n");
|
||||
warnx("krb5_net_write failure");
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +294,7 @@ krb_passwd()
|
|||
/* compute checksum, using CRC-32 */
|
||||
if (!(send_cksum.contents = (krb5_octet *)
|
||||
malloc(krb5_checksum_size(CKSUMTYPE_CRC32)))) {
|
||||
fprintf(stderr, "passwd: Insufficient Memory while Allocating Checksum\n");
|
||||
warnx("Insufficient Memory while Allocating Checksum");
|
||||
goto finish;
|
||||
}
|
||||
cksum_alloc++;
|
||||
|
@ -308,8 +306,7 @@ krb_passwd()
|
|||
0, /* if length is 0, crc-32 doesn't
|
||||
use the seed */
|
||||
&send_cksum)) {
|
||||
fprintf(stderr, "Error while Computing Checksum: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Error while Computing Checksum: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -329,27 +326,24 @@ krb_passwd()
|
|||
0, /* don't need a subsession key */
|
||||
&err_ret,
|
||||
&rep_ret))) {
|
||||
fprintf(stderr, "passwd: Error while performing sendauth: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Error while performing sendauth: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
/* Get credentials : to use for safe and private messages */
|
||||
if (retval = krb5_get_credentials(0, cache, &my_creds)){
|
||||
fprintf(stderr, "passwd: Error Obtaining Credentials: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Error Obtaining Credentials: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
/* Read back what the server has to say... */
|
||||
if (retval = krb5_read_message(&local_socket, &inbuf)){
|
||||
fprintf(stderr, "passwd: Read Message Error: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Read Message Error: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
if ((inbuf.length != 2) || (inbuf.data[0] != KADMIND) ||
|
||||
(inbuf.data[1] != KADMSAG)){
|
||||
fprintf(stderr, "passwd: Invalid ack from admin server.\n");
|
||||
warnx("Invalid ack from admin server.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -367,15 +361,14 @@ krb_passwd()
|
|||
0,
|
||||
0,
|
||||
&msg_data))) {
|
||||
fprintf(stderr, "passwd: Error during First Message Encoding: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Error during First Message Encoding: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
free(inbuf.data);
|
||||
|
||||
/* write private message to server */
|
||||
if (krb5_write_message(&local_socket, &msg_data)){
|
||||
fprintf(stderr, "passwd: Write Error During First Message Transmission\n");
|
||||
warnx("Write Error During First Message Transmission");
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -387,8 +380,7 @@ krb_passwd()
|
|||
#ifdef MACH_PASS /* Machine-generated Passwords */
|
||||
/* Ok Now let's get the private message */
|
||||
if (retval = krb5_read_message(&local_socket, &inbuf)){
|
||||
fprintf(stderr, "passwd: Read Error During First Reply: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Read Error During First Reply: %s", error_message(retval));
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -402,15 +394,14 @@ krb_passwd()
|
|||
0,
|
||||
0,
|
||||
&msg_data))) {
|
||||
fprintf(stderr, "passwd: Error during First Read Decoding: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Error during First Read Decoding: %s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
free(inbuf.data);
|
||||
#endif
|
||||
|
||||
if ((new_password = (char *) calloc (1, ADM_MAX_PW_LENGTH+1)) == NULL) {
|
||||
fprintf(stderr, "passwd: Unable to Allocate Space for New Password\n");
|
||||
warnx("Unable to Allocate Space for New Password");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -449,7 +440,7 @@ krb_passwd()
|
|||
0,
|
||||
0,
|
||||
&msg_data))) {
|
||||
fprintf(stderr, "passwd: Error during Second Message Encoding: %s\n",
|
||||
warnx("Error during Second Message Encoding: %s",
|
||||
error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
|
@ -458,7 +449,7 @@ krb_passwd()
|
|||
|
||||
/* write private message to server */
|
||||
if (krb5_write_message(&local_socket, &msg_data)){
|
||||
fprintf(stderr, "passwd: Write Error During Second Message Transmission\n");
|
||||
warnx("Write Error During Second Message Transmission");
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -466,8 +457,7 @@ krb_passwd()
|
|||
|
||||
/* Ok Now let's get the private message */
|
||||
if (retval = krb5_read_message(&local_socket, &inbuf)){
|
||||
fprintf(stderr, "passwd: Read Error During Second Reply: %s\n",
|
||||
error_message(retval));
|
||||
warnx("Read Error During Second Reply: %s", error_message(retval));
|
||||
retval = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -481,8 +471,7 @@ krb_passwd()
|
|||
0,
|
||||
0,
|
||||
&msg_data))) {
|
||||
fprintf(stderr, "passwd: Error during Second Read Decoding :%s\n",
|
||||
error_message(retval));
|
||||
warnx("Error during Second Read Decoding :%s", error_message(retval));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -505,13 +494,13 @@ krb_passwd()
|
|||
if (rd_priv_resp.appl_code == KPASSWD) {
|
||||
if (rd_priv_resp.retn_code == KPASSBAD) {
|
||||
if (rd_priv_resp.message)
|
||||
fprintf(stderr, "passwd: %s\n", rd_priv_resp.message);
|
||||
warnx("%s", rd_priv_resp.message);
|
||||
else
|
||||
fprintf(stderr, "passwd: Server returned KPASSBAD.\n");
|
||||
warnx("Server returned KPASSBAD.");
|
||||
} else if (rd_priv_resp.retn_code != KPASSGOOD)
|
||||
fprintf(stderr, "passwd: Server returned unknown kerberos code.\n");
|
||||
warnx("Server returned unknown kerberos code.");
|
||||
} else
|
||||
fprintf(stderr, "passwd: Server returned bad application code %d\n",
|
||||
warnx("Server returned bad application code %d",
|
||||
rd_priv_resp.appl_code);
|
||||
|
||||
if (rd_priv_resp.message)
|
||||
|
@ -523,10 +512,8 @@ krb_passwd()
|
|||
free(client_name);
|
||||
free(requested_realm.data);
|
||||
if (cksum_alloc) free(send_cksum.contents);
|
||||
if (retval) {
|
||||
fprintf(stderr, "passwd: Protocol Failure - Password NOT changed\n");
|
||||
exit(1);
|
||||
}
|
||||
if (retval)
|
||||
errx(1, "Protocol Failure - Password NOT changed");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -558,14 +545,14 @@ get_first_ticket(cache, client)
|
|||
krb5_error_code retval;
|
||||
|
||||
if ((retval = krb5_unparse_name(client, &client_name))) {
|
||||
fprintf(stderr, "Unable to Unparse Client Name\n");
|
||||
warnx("Unable to Unparse Client Name");
|
||||
return(1);
|
||||
}
|
||||
|
||||
(void) printf("Changing Kerberos password for %s\n", client_name);
|
||||
|
||||
if ((retval = krb5_os_localaddr(&my_addresses))) {
|
||||
fprintf(stderr, "passwd: Unable to Get Customers Address\n");
|
||||
warnx("Unable to Get Customers Address");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -582,13 +569,13 @@ get_first_ticket(cache, client)
|
|||
/* instance is local realm */
|
||||
client->realm.data,
|
||||
0))) {
|
||||
fprintf(stderr, "Error %s while building server name\n");
|
||||
warnx("Error %s while building server name");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
if ((old_password = (char *) calloc (1, 255)) == NULL) {
|
||||
fprintf(stderr, "passwd: No Memory for Retrieving old password\n");
|
||||
warnx("No Memory for Retrieving old password");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -621,8 +608,7 @@ get_first_ticket(cache, client)
|
|||
}
|
||||
|
||||
if (retval) {
|
||||
fprintf(stderr, "passwd: Unable to Get Initial Credentials : %s\n",
|
||||
error_message(retval));
|
||||
warnx("Unable to Get Initial Credentials : %s", error_message(retval));
|
||||
}
|
||||
|
||||
/* Do NOT Forget to zap password */
|
||||
|
@ -661,8 +647,8 @@ print_and_choose_password(new_password, decodable_pwd_string)
|
|||
|
||||
/* Decode Password and Phrase Information Obtained from krb5_rd_priv */
|
||||
if ((retval = decode_krb5_pwd_data(decodable_pwd_string , &pwd_data))) {
|
||||
fprintf(stderr, "passwd: Unable to Decode Passwords and Phrases\n");
|
||||
fprintf(stderr, " Notify your System Administrator or the Kerberos Administrator\n");
|
||||
warnx("Unable to Decode Passwords and Phrases\n%s",
|
||||
" Notify your System Administrator or the Kerberos Administrator");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -671,10 +657,11 @@ print_and_choose_password(new_password, decodable_pwd_string)
|
|||
memset((char *) phrase_in, 0, ADM_MAX_PHRASE_LENGTH);
|
||||
for ( j = 0; j <= ADM_MAX_PW_ITERATIONS; j++) {
|
||||
if (j == ADM_MAX_PW_ITERATIONS) {
|
||||
fprintf(stderr, "passwd: Sorry - You Have Exceeded the List of Choices (%d) Allowed for Password\n",
|
||||
ADM_MAX_PW_ITERATIONS * ADM_MAX_PW_CHOICES);
|
||||
fprintf(stderr, " Modification. You Must Repeat this Operation in order to Successfully\n");
|
||||
fprintf(stderr, " Change your Password.\n");
|
||||
warnx("Sorry - You Have Exceeded the List of Choices (%d)\n%s%s%s",
|
||||
ADM_MAX_PW_ITERATIONS * ADM_MAX_PW_CHOICES,
|
||||
"\tAllowed for Password Modification.\n",
|
||||
"\tYou Must Repeat this Operation in order\n",
|
||||
"\tto Successfully Change your Password.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -687,7 +674,7 @@ print_and_choose_password(new_password, decodable_pwd_string)
|
|||
for ( i = 0; i < ADM_MAX_PW_CHOICES; i++){
|
||||
if ((password_list[i] = (char *) calloc (1,
|
||||
ADM_MAX_PW_LENGTH + 1)) == NULL) {
|
||||
fprintf(stderr, "passwd: Unable to Allocate Password List.\n");
|
||||
warnx("Unable to Allocate Password List.");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -732,8 +719,7 @@ print_and_choose_password(new_password, decodable_pwd_string)
|
|||
/* Read New Password from Terminal (Do Not Print on Screen) */
|
||||
if ((retval = krb5_read_password(&prompt[0], 0,
|
||||
new_password, &new_passwd_length))) {
|
||||
fprintf(stderr,
|
||||
"passwd: Error Reading Password Input or Input Aborted\n");
|
||||
warnx("Error Reading Password Input or Input Aborted");
|
||||
free_local_password_list();
|
||||
break;;
|
||||
}
|
||||
|
@ -786,8 +772,7 @@ int * local_socket;
|
|||
(void) memset((char *)&remote_sin, 0, sizeof(remote_sin));
|
||||
|
||||
if ((service_process = getservbyname(CPW_SNAME, "tcp")) == NULL) {
|
||||
fprintf(stderr, "passwd: Unable to find Service (%s) Check services file\n",
|
||||
CPW_SNAME);
|
||||
warnx("Unable to find Service (%s) Check services file", CPW_SNAME);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -798,7 +783,7 @@ int * local_socket;
|
|||
|
||||
/* Identify all Hosts Associated with this Realm */
|
||||
if ((retval = krb5_get_krbhst (realm_of_server, &hostlist))) {
|
||||
fprintf(stderr, "passwd: Unable to Determine Server Name\n");
|
||||
warnx("Unable to Determine Server Name");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -808,7 +793,7 @@ int * local_socket;
|
|||
|
||||
if (count == 0) {
|
||||
host_count = 0;
|
||||
fprintf(stderr, "passwd: No hosts found\n");
|
||||
warnx("No hosts found");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -830,12 +815,12 @@ int * local_socket;
|
|||
/* open a TCP socket */
|
||||
*local_socket = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (*local_socket < 0) {
|
||||
fprintf(stderr, "passwd: Cannot Open Socket\n");
|
||||
warnx("Cannot Open Socket");
|
||||
return(1);
|
||||
}
|
||||
/* connect to the server */
|
||||
if (connect(*local_socket, (struct sockaddr *)&remote_sin, sizeof(remote_sin)) < 0) {
|
||||
fprintf(stderr, "passwd: Cannot Connect to Socket\n");
|
||||
warnx("Cannot Connect to Socket");
|
||||
close(*local_socket);
|
||||
return(1);
|
||||
}
|
||||
|
@ -844,7 +829,7 @@ int * local_socket;
|
|||
namelen = sizeof(local_sin);
|
||||
if (getsockname(*local_socket,
|
||||
(struct sockaddr *) &local_sin, &namelen) < 0) {
|
||||
fprintf(stderr, "passwd: Cannot Perform getsockname\n");
|
||||
warnx("Cannot Perform getsockname");
|
||||
close(*local_socket);
|
||||
return(1);
|
||||
}
|
||||
|
@ -957,7 +942,7 @@ char *username,*tmpname;
|
|||
endutent();
|
||||
return(1);
|
||||
}
|
||||
bcopy((char *)&retutent, (char *)tmpptr, sizeof(struct utmp));
|
||||
memmove((char *)tmpptr, (char *)&retutent, sizeof(struct utmp));
|
||||
endutent();
|
||||
#ifdef DEBUG
|
||||
#ifdef NO_UT_HOST
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: local_passwd.c,v 1.13 1997/07/24 08:53:48 phil Exp $ */
|
||||
/* $NetBSD: local_passwd.c,v 1.14 1997/10/19 12:29:51 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
|
@ -33,26 +33,32 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)local_passwd.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: local_passwd.c,v 1.13 1997/07/24 08:53:48 phil Exp $";
|
||||
__RCSID("$NetBSD: local_passwd.c,v 1.14 1997/10/19 12:29:51 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <util.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
static char *getnewpasswd __P((struct passwd *));
|
||||
|
||||
static uid_t uid;
|
||||
|
||||
char *tempname;
|
||||
|
@ -72,13 +78,13 @@ to64(s, v, n)
|
|||
}
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
getnewpasswd(pw)
|
||||
struct passwd *pw;
|
||||
{
|
||||
int tries;
|
||||
char *p, *t;
|
||||
char buf[_PASSWORD_LEN+1], salt[9], *crypt(), *getpass();
|
||||
char buf[_PASSWORD_LEN+1], salt[9];
|
||||
|
||||
(void)printf("Changing local password for %s.\n", pw->pw_name);
|
||||
|
||||
|
@ -131,7 +137,6 @@ local_passwd(uname)
|
|||
struct passwd *pw;
|
||||
struct passwd old_pw;
|
||||
int pfd, tfd;
|
||||
char *getnewpasswd();
|
||||
|
||||
if (!(pw = getpwnam(uname))) {
|
||||
warnx("unknown user %s", uname);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: passwd.1,v 1.8 1997/01/07 04:08:17 tls Exp $
|
||||
.\" $NetBSD: passwd.1,v 1.9 1997/10/19 12:29:55 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -40,14 +40,14 @@
|
|||
.Nm passwd
|
||||
.Nd modify a user's password
|
||||
.Sh SYNOPSIS
|
||||
.Nm passwd
|
||||
.Nm
|
||||
.Op Fl l
|
||||
.Op Fl y
|
||||
.Op Ar user
|
||||
.Nm yppasswd
|
||||
.Op Ar user
|
||||
.Sh DESCRIPTION
|
||||
.Nm Passwd
|
||||
.Nm
|
||||
changes the user's local or YP password. First, the user is prompted
|
||||
for their current password.
|
||||
If the current password is correctly typed, a new password is
|
||||
|
@ -74,7 +74,7 @@ the user has an entry in the local database. The
|
|||
daemon should be running on the YP master server.
|
||||
.Nm yppasswd
|
||||
is the equivalent of
|
||||
.Nm passwd
|
||||
.Nm
|
||||
with the
|
||||
.Fl y
|
||||
flag.
|
||||
|
@ -107,6 +107,6 @@ Temporary copy of the password file
|
|||
.Re
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm passwd
|
||||
.Nm
|
||||
command appeared in
|
||||
.At v6 .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: passwd.c,v 1.11 1997/01/07 04:08:18 tls Exp $ */
|
||||
/* $NetBSD: passwd.c,v 1.12 1997/10/19 12:30:00 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
|
@ -33,17 +33,17 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1988, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)passwd.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: passwd.c,v 1.11 1997/01/07 04:08:18 tls Exp $";
|
||||
__RCSID("$NetBSD: passwd.c,v 1.12 1997/10/19 12:30:00 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -70,10 +70,13 @@ int yflag;
|
|||
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
int main __P((int, char **));
|
||||
|
||||
#ifdef YP
|
||||
extern int _yp_check __P((char **)); /* buried deep inside libc */
|
||||
#endif
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
|
@ -81,9 +84,9 @@ main(argc, argv)
|
|||
extern int optind;
|
||||
int ch;
|
||||
char *username;
|
||||
#if defined(KERBEROS) || defined(KERBEROS5)
|
||||
char *iflag = 0, *rflag = 0, *uflag = 0;
|
||||
|
||||
#if defined(KERBEROS) || defined(KERBEROS5)
|
||||
if (strcmp(__progname, "kpasswd") == 0)
|
||||
use_kerberos = 1;
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: yp_passwd.c,v 1.14 1997/05/21 02:09:51 lukem Exp $ */
|
||||
/* $NetBSD: yp_passwd.c,v 1.15 1997/10/19 12:30:07 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1990, 1993, 1994
|
||||
|
@ -33,26 +33,34 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)local_passwd.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: yp_passwd.c,v 1.14 1997/05/21 02:09:51 lukem Exp $";
|
||||
__RCSID("$NetBSD: yp_passwd.c,v 1.15 1997/10/19 12:30:07 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#ifdef YP
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpcsvc/yp_prot.h>
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#define passwd yp_passwd_rec
|
||||
#include <rpcsvc/yppasswd.h>
|
||||
#undef passwd
|
||||
|
@ -65,26 +73,21 @@ extern char *__progname; /* from crt0.o */
|
|||
|
||||
extern int yflag, yppwd;
|
||||
|
||||
static char *getnewpasswd();
|
||||
static struct passwd *ypgetpwnam();
|
||||
static char *getnewpasswd __P((struct passwd *, char **));
|
||||
static struct passwd *interpret __P((struct passwd *, char *));
|
||||
static struct passwd *ypgetpwnam __P((char *));
|
||||
static void pw_error __P((char *, int, int));
|
||||
|
||||
static uid_t uid;
|
||||
char *domain;
|
||||
|
||||
static
|
||||
static void
|
||||
pw_error(name, err, eval)
|
||||
char *name;
|
||||
int err, eval;
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
if (err) {
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (name)
|
||||
(void)fprintf(stderr, "%s: ", name);
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
}
|
||||
if (err)
|
||||
warn("%s", name ? name : "");
|
||||
errx(eval, "YP passwd database unchanged");
|
||||
}
|
||||
|
||||
|
@ -93,7 +96,6 @@ yp_passwd(username)
|
|||
char *username;
|
||||
{
|
||||
char *master;
|
||||
char *pp;
|
||||
int r, rpcport, status;
|
||||
struct yppasswd yppasswd;
|
||||
struct passwd *pw;
|
||||
|
@ -105,7 +107,7 @@ yp_passwd(username)
|
|||
/*
|
||||
* Get local domain
|
||||
*/
|
||||
if (r = yp_get_default_domain(&domain))
|
||||
if ((r = yp_get_default_domain(&domain)) != NULL)
|
||||
errx(1, "can't get local YP domain. Reason: %s",
|
||||
yperr_string(r));
|
||||
|
||||
|
@ -191,7 +193,7 @@ getnewpasswd(pw, old_pass)
|
|||
int tries;
|
||||
char *p, *t;
|
||||
static char buf[_PASSWORD_LEN+1];
|
||||
char salt[9], *crypt(), *getpass();
|
||||
char salt[9];
|
||||
|
||||
(void)printf("Changing YP password for %s.\n", pw->pw_name);
|
||||
|
||||
|
@ -255,11 +257,12 @@ pwskip(char *p)
|
|||
return (p);
|
||||
}
|
||||
|
||||
struct passwd *
|
||||
interpret(struct passwd *pwent, char *line)
|
||||
static struct passwd *
|
||||
interpret(pwent, line)
|
||||
struct passwd *pwent;
|
||||
char *line;
|
||||
{
|
||||
char *p = line;
|
||||
int c;
|
||||
|
||||
pwent->pw_passwd = "*";
|
||||
pwent->pw_uid = 0;
|
||||
|
|
Loading…
Reference in New Issue