summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorJohn Sonnenschein <John.Sonnenschein@Sun.COM>2008-08-27 20:16:01 -0400
committerJohn Sonnenschein <John.Sonnenschein@Sun.COM>2008-08-27 20:16:01 -0400
commit66e150d7d3c0cb2de3c45c74612784ffd3e73de6 (patch)
tree6bf7bbb02dd4201a137e690849a601015d4e4e33 /usr
parent4b56a00321e0ce508e55cc5e43e3ad7b00005a39 (diff)
downloadillumos-joyent-66e150d7d3c0cb2de3c45c74612784ffd3e73de6.tar.gz
Contributed by Vinay Simha B.N. <simhavcs@gmail.com> and Beeresh G. <beeresh@gmail.com>
6547525 "*NP*" could use a #define
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/keyserv/chkey.c5
-rw-r--r--usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_ib_proc.c14
-rw-r--r--usr/src/head/shadow.h10
-rw-r--r--usr/src/lib/nsswitch/ldap/common/getspent.c12
-rw-r--r--usr/src/lib/nsswitch/nisplus/common/getspent.c3
-rw-r--r--usr/src/lib/pam_modules/authtok_store/authtok_store.c6
-rw-r--r--usr/src/lib/pam_modules/dhkeys/dhkeys.c4
-rw-r--r--usr/src/lib/pam_modules/unix_account/unix_acct.c13
-rw-r--r--usr/src/lib/pam_modules/unix_auth/unix_auth.c5
-rw-r--r--usr/src/lib/passwdutil/switch_utils.c9
10 files changed, 35 insertions, 46 deletions
diff --git a/usr/src/cmd/keyserv/chkey.c b/usr/src/cmd/keyserv/chkey.c
index 48c9f78d36..e16770ddb6 100644
--- a/usr/src/cmd/keyserv/chkey.c
+++ b/usr/src/cmd/keyserv/chkey.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -36,7 +36,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <stdio.h>
@@ -1553,7 +1552,7 @@ main(int argc, char **argv)
/* Set eUID back to user */
(void) seteuid(uid);
- if (strcmp(spw->sp_pwdp, "*NP*") == 0) {
+ if (strcmp(spw->sp_pwdp, NOPWDRTR) == 0) {
(void) fprintf(stderr,
"%s: do not have read access to the passwd field for %s\n",
program_name, pw->pw_name);
diff --git a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_ib_proc.c b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_ib_proc.c
index 09385ba96c..16a81fcb0d 100644
--- a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_ib_proc.c
+++ b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_ib_proc.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,11 +19,11 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 1990-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+
/*
* Ported from
@@ -57,6 +56,7 @@
#include <string.h>
#include <netdir.h>
#include <netconfig.h>
+#include <shadow.h>
extern bool_t xdr_nis_result();
extern bool_t xdr_nis_error();
@@ -131,7 +131,7 @@ nis_censor_object_attr(o, tc, p, zn, za)
return (NULL);
/* Replace with No Permission value */
ec[j].ENLEN = 5;
- ec[j].ENVAL = "*NP*";
+ ec[j].ENVAL = NOPWDRTR;
} else {
somedata++;
#ifdef NIS_CRYPT_SUPPORT
diff --git a/usr/src/head/shadow.h b/usr/src/head/shadow.h
index 7b8688e2a4..d7a5582365 100644
--- a/usr/src/head/shadow.h
+++ b/usr/src/head/shadow.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -31,7 +30,6 @@
#ifndef _SHADOW_H
#define _SHADOW_H
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
#ifdef __cplusplus
extern "C" {
@@ -53,7 +51,7 @@ extern "C" {
#define LOCKSTRING "*LK*" /* prefix to/string in sp_pwdp to lock acct */
#define NOLOGINSTRING "NP" /* sp_pwdp for no-login accounts */
-
+#define NOPWDRTR "*NP*" /* password is not retrievable */
/*
* The spwd structure is used in the retreval of information from
* /etc/shadow. It is used by routines in the libos library.
diff --git a/usr/src/lib/nsswitch/ldap/common/getspent.c b/usr/src/lib/nsswitch/ldap/common/getspent.c
index 707bf6ff44..a533300a08 100644
--- a/usr/src/lib/nsswitch/ldap/common/getspent.c
+++ b/usr/src/lib/nsswitch/ldap/common/getspent.c
@@ -19,11 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <shadow.h>
#include <stdlib.h>
@@ -63,7 +62,6 @@ _nss_ldap_shadow2str(ldap_backend_ptr be, nss_XbyY_args_t *argp)
unsigned long len = 0L;
char *tmp, *buffer = NULL;
char *pw_passwd = NULL;
- char np[] = "*NP*";
ns_ldap_result_t *result = be->result;
char **uid, **passwd, **flag, *flag_str;
@@ -87,7 +85,7 @@ _nss_ldap_shadow2str(ldap_backend_ptr be, nss_XbyY_args_t *argp)
* ACL does not allow userpassword to return or
* userpassword is not defined
*/
- pw_passwd = np;
+ pw_passwd = NOPWDRTR;
} else if (strcmp(passwd[0], "") == 0) {
/*
* An empty password is not supported
@@ -98,12 +96,12 @@ _nss_ldap_shadow2str(ldap_backend_ptr be, nss_XbyY_args_t *argp)
if ((tmp = strstr(passwd[0], "{crypt}")) != NULL ||
(tmp = strstr(passwd[0], "{CRYPT}")) != NULL) {
if (tmp != passwd[0])
- pw_passwd = np;
+ pw_passwd = NOPWDRTR;
else
pw_passwd = tmp + strlen("{crypt}");
} else {
- /* Replace it with *NP* */
- pw_passwd = np;
+ /* mark password as not retrievable */
+ pw_passwd = NOPWDRTR;
}
}
len += strlen(pw_passwd);
diff --git a/usr/src/lib/nsswitch/nisplus/common/getspent.c b/usr/src/lib/nsswitch/nisplus/common/getspent.c
index 025a43e3b2..4110d81dfb 100644
--- a/usr/src/lib/nsswitch/nisplus/common/getspent.c
+++ b/usr/src/lib/nsswitch/nisplus/common/getspent.c
@@ -30,7 +30,6 @@
* ("shadow") of the same table that stores vanilla passwd information.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <shadow.h>
@@ -205,7 +204,7 @@ nis_object2str(nobj, obj, be, argp)
* _nss_nisplus_getent(), but that's OK -- when we're doing
* enumerations we don't care what's in the argp->key union.
*/
- if (strncmp(passwd, "*NP*", passwdlen) == 0) {
+ if (strncmp(passwd, NOPWDRTR, passwdlen) == 0) {
be->flag = 1;
argp->key.uid = uid;
}
diff --git a/usr/src/lib/pam_modules/authtok_store/authtok_store.c b/usr/src/lib/pam_modules/authtok_store/authtok_store.c
index 60e0000ab4..d599fb695e 100644
--- a/usr/src/lib/pam_modules/authtok_store/authtok_store.c
+++ b/usr/src/lib/pam_modules/authtok_store/authtok_store.c
@@ -19,11 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/varargs.h>
@@ -38,6 +37,7 @@
#include <libintl.h>
#include <passwdutil.h>
+#include <shadow.h>
#define SUNW_OLDRPCPASS "SUNW-OLD-RPC-PASSWORD"
@@ -99,7 +99,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
pwu_repository_t *pwu_rep;
char *user;
char *oldpw;
- char *oldrpcpw = "*NP*";
+ char *oldrpcpw = NOPWDRTR;
char *newpw;
char *service;
struct pam_repository *auth_rep;
diff --git a/usr/src/lib/pam_modules/dhkeys/dhkeys.c b/usr/src/lib/pam_modules/dhkeys/dhkeys.c
index 96f165f50d..cea8662066 100644
--- a/usr/src/lib/pam_modules/dhkeys/dhkeys.c
+++ b/usr/src/lib/pam_modules/dhkeys/dhkeys.c
@@ -23,7 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <syslog.h>
@@ -63,6 +62,7 @@
#include <passwdutil.h>
#include "key_call_uid.h"
+#include <shadow.h>
/* to keep track of codepath */
#define CODEPATH_PAM_SM_AUTHENTICATE 0
@@ -330,7 +330,7 @@ establish_key(pam_handle_t *pamh, int flags, int codepath, int debug,
}
need_cred = (strcmp(repository_name, "nisplus") == 0 &&
- strcmp(repository_pass, "*NP*") == 0);
+ strcmp(repository_pass, NOPWDRTR) == 0);
if (auth_path) {
auth_cred_flags =
(need_cred ? flags : flags | PAM_SILENT);
diff --git a/usr/src/lib/pam_modules/unix_account/unix_acct.c b/usr/src/lib/pam_modules/unix_account/unix_acct.c
index 180cab8559..35a2ccf168 100644
--- a/usr/src/lib/pam_modules/unix_account/unix_acct.c
+++ b/usr/src/lib/pam_modules/unix_account/unix_acct.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,11 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/wait.h>
@@ -59,7 +57,6 @@
#define LOGINADMIN "/etc/default/login"
#define UNIX_AUTH_DATA "SUNW-UNIX-AUTH-DATA"
#define UNIX_AUTHTOK_DATA "SUNW-UNIX-AUTHTOK-DATA"
-#define NO_PW "*NP*"
/*
* Function Declarations
@@ -414,8 +411,8 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv)
else if (strncmp(shpwd.sp_pwdp, LOCKSTRING,
sizeof (LOCKSTRING) - 1) == 0)
pw = LOCKSTRING;
- else if (strcmp(shpwd.sp_pwdp, NO_PW) == 0)
- pw = NO_PW;
+ else if (strcmp(shpwd.sp_pwdp, NOPWDRTR) == 0)
+ pw = NOPWDRTR;
if (result == PWU_DENIED) {
syslog(LOG_AUTH | LOG_DEBUG,
diff --git a/usr/src/lib/pam_modules/unix_auth/unix_auth.c b/usr/src/lib/pam_modules/unix_auth/unix_auth.c
index 2fb4dbe3e9..dd15958591 100644
--- a/usr/src/lib/pam_modules/unix_auth/unix_auth.c
+++ b/usr/src/lib/pam_modules/unix_auth/unix_auth.c
@@ -23,7 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <pwd.h>
@@ -275,7 +274,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
/*
* "rep_passwd" holds the encrypted password.
- * If, however, we detect that the password equals "*NP*",
+ * If, however, we detect that the password equals NOPWDRTR,
* while we've obtained it from NIS+, it
* means that the permissions on the NIS+ table are too tight
* for us to get the password without having Secure RPC
@@ -285,7 +284,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
* and inform the administrator of this error.
*/
if (strcmp(repository_name, "nisplus") == 0 &&
- strcmp(rep_passwd, "*NP*") == 0) {
+ strcmp(rep_passwd, NOPWDRTR) == 0) {
syslog(LOG_ERR, "pam_unix_auth: NIS+ permissions require that"
"the pam_dhkeys module is on the PAM stack before "
"pam_unix_auth");
diff --git a/usr/src/lib/passwdutil/switch_utils.c b/usr/src/lib/passwdutil/switch_utils.c
index 77680a36ef..3b2221bff7 100644
--- a/usr/src/lib/passwdutil/switch_utils.c
+++ b/usr/src/lib/passwdutil/switch_utils.c
@@ -19,11 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <nsswitch.h>
@@ -901,10 +900,10 @@ nisplus_getsp_from_master(const char *name, char *domain)
SAFE_STRDUP(shadow, 7);
/*
- * If we got "*NP*" as password, try again with EUID set to
- * the UID of the record-owner.
+ * If we got NOPWDRTR as password, try again with EUID set
+ * to the UID of the record-owner.
*/
- if (strncmp(shadow, "*NP*", 4) == 0) {
+ if (strncmp(shadow, NOPWDRTR, 4) == 0) {
char *p;
uid_t owner_uid;
uid_t euid = geteuid();