* Break the line into two fields.
*/
name = stpspn(buf, " \t"); /* first nonwhite */
- if (*name == '\0' || *name == '#')
+ if (streq(name, "") || *name == '#')
continue; /* comment or empty */
s = stpsep(name, " \t"); /* next field */
#include "atoi/a2i/a2u.h"
#include "defines.h"
#include "prototypes.h"
+#include "string/strcmp/streq.h"
/*
return 0; /* <long> */
case '-':
- if ('\0' == *end)
+ if (streq(end, ""))
return 0; /* <long>- */
parse_max:
if (!isdigit((unsigned char) *end))
}
}
(void) fclose (fil);
- if (limits[0] == '\0') {
+ if (streq(limits, "")) {
/* no user specific limits */
- if (deflimits[0] == '\0') { /* no default limits */
+ if (streq(deflimits, "")) { /* no default limits */
return 0;
}
strcpy (limits, deflimits); /* use the default limits */
* Empty list is special - 0 members, not 1 empty member. --marekm
*/
- if ('\0' == *members) {
+ if (streq(members, "")) {
*array = NULL;
free (members);
return array;
port++;
}
- if (('\0' == *pattern) && ('\0' == *port)) {
+ if (streq(pattern, "") && streq(port, "")) {
return 0;
}
if (streq(orig, "SU"))
cp = field;
- if ('\0' == *cp) {
+ if (streq(cp, "")) {
port.pt_times = NULL;
return &port;
}
exit (EXIT_FAILURE);
}
- if (prefix[0] == '\0' || streq(prefix, "/"))
+ if (streq(prefix, "") || streq(prefix, "/"))
return ""; /* if prefix is "/" then we ignore the flag option */
/* should we prevent symbolic link from being used as a prefix? */
#include "getdef.h"
#include "string/memset/memzero.h"
#include "string/sprintf/snprintf.h"
+#include "string/strcmp/streq.h"
#ifdef SKEY
#include <skey.h>
* matter.
*/
- if ((NULL == cipher) || ('\0' == *cipher)) {
+ if ((NULL == cipher) || streq(cipher, "")) {
return 0;
}
* ...Re-prompt, with echo on.
* -- AR 8/22/1999
*/
- if ((0 != retval) && ('\0' == input[0]) && use_skey) {
+ if ((0 != retval) && streq(input, "") && use_skey) {
erase_pass(clear);
clear = agetpass(prompt);
input = (clear == NULL) ? "" : clear;
* Prepare DES setting for crypt_gensalt(), if result
* has not been filled with anything previously.
*/
- if ('\0' == result[0]) {
+ if (streq(result, "")) {
/* Avoid -Wunused-but-set-variable. */
salt_len = GENSALT_SETTING_SIZE - 1;
rounds = 0;
#include "shadowlog.h"
#include "string/sprintf/xasprintf.h"
#include "string/strchr/stpspn.h"
+#include "string/strcmp/streq.h"
#include "string/strdup/xstrdup.h"
#include "string/strtok/stpsep.h"
cp = buf;
/* ignore whitespace and comments */
cp = stpspn(cp, " \t");
- if (('\0' == *cp) || ('#' == *cp)) {
+ if (streq(cp, "") || ('#' == *cp)) {
continue;
}
/*
* Create the SHELL environmental variable and export it.
*/
- if ((NULL == info->pw_shell) || ('\0' == *info->pw_shell)) {
+ if ((NULL == info->pw_shell) || streq(info->pw_shell, "")) {
free (info->pw_shell);
info->pw_shell = xstrdup (SHELL);
}
#include "atoi/getnum.h"
#include "defines.h"
#include "prototypes.h"
+#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
return NULL;
}
}
- if (!s || s[0] == '\0')
+ if (!s || streq(s, ""))
break;
members[i++] = strsep(&s, ",");
}
for (cp = grpbuf, i = 0; (i < NFIELDS) && (NULL != cp); i++)
grpfields[i] = strsep(&cp, ":");
- if (i < NFIELDS || *grpfields[2] == '\0' || cp != NULL) {
+ if (i < NFIELDS || streq(grpfields[2], "") || cp != NULL) {
return NULL;
}
grent.gr_name = grpfields[0];
#include "defines.h"
#include "prototypes.h"
#include "shadowlog_internal.h"
+#include "string/strcmp/streq.h"
#define NFIELDS 7
* the entry is invalid. Also, the UID and GID must be non-blank.
*/
- if (i != NFIELDS || *fields[2] == '\0' || *fields[3] == '\0')
+ if (i != NFIELDS)
+ return NULL;
+ if (streq(fields[2], ""))
+ return NULL;
+ if (streq(fields[3], ""))
return NULL;
/*
#include "defines.h"
#include "prototypes.h"
#include "shadowlog_internal.h"
+#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
* incorrectly formatted number.
*/
- if (fields[2][0] == '\0')
+ if (streq(fields[2], ""))
spwd.sp_lstchg = -1;
else if (a2sl(&spwd.sp_lstchg, fields[2], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* Get the minimum period between password changes.
*/
- if (fields[3][0] == '\0')
+ if (streq(fields[3], ""))
spwd.sp_min = -1;
else if (a2sl(&spwd.sp_min, fields[3], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* Get the maximum number of days a password is valid.
*/
- if (fields[4][0] == '\0')
+ if (streq(fields[4], ""))
spwd.sp_max = -1;
else if (a2sl(&spwd.sp_max, fields[4], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* Get the number of days of password expiry warning.
*/
- if (fields[5][0] == '\0')
+ if (streq(fields[5], ""))
spwd.sp_warn = -1;
else if (a2sl(&spwd.sp_warn, fields[5], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* disabled.
*/
- if (fields[6][0] == '\0')
+ if (streq(fields[6], ""))
spwd.sp_inact = -1;
else if (a2sl(&spwd.sp_inact, fields[6], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* set to expire.
*/
- if (fields[7][0] == '\0')
+ if (streq(fields[7], ""))
spwd.sp_expire = -1;
else if (a2sl(&spwd.sp_expire, fields[7], NULL, 0, 0, LONG_MAX) == -1)
return NULL;
* to have anything other than a valid integer in it.
*/
- if (fields[8][0] == '\0')
+ if (streq(fields[8], ""))
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
else if (str2ul(&spwd.sp_flag, fields[8]) == -1)
return NULL;
/* Author: Peter Vrabec <pvrabec@redhat.com> */
#include <config.h>
+
#ifdef USE_SSSD
+#include "sssd.h"
#include <stdio.h>
#include <sys/stat.h>
#include "exitcodes.h"
#include "defines.h"
#include "prototypes.h"
-#include "sssd.h"
-
#include "shadowlog_internal.h"
+#include "string/strcmp/streq.h"
#define MSG_SSSD_FLUSH_CACHE_FAILED "%s: Failed to flush the sssd cache."
if (dbflags & SSSD_DB_GROUP)
stpcpy(p, "G");
- if (*p == '\0') {
+ if (streq(p, "")) {
/* Neither passwd nor group, nothing to do */
free(sss_cache_args);
return 0;
#include <ctype.h>
-#ident "$Id$"
-
#include "atoi/str2i/str2s.h"
#include "getdate.h"
#include "prototypes.h"
#include "string/strchr/stpspn.h"
+#include "string/strcmp/streq.h"
/*
* which is not what we expect, unless you're a BOFH :-).
* (useradd sets sp_expire = current date for new lusers)
*/
- if ((NULL == str) || ('\0' == *str)) {
+ if ((NULL == str) || streq(str, "")) {
return -1;
}
* There must be exactly SUBID_NFIELDS colon separated fields or
* the entry is invalid. Also, fields must be non-blank.
*/
- if (i != SUBID_NFIELDS || *fields[0] == '\0' || *fields[1] == '\0' || *fields[2] == '\0')
+ if (i != SUBID_NFIELDS)
+ return NULL;
+ if (streq(fields[0], ""))
+ return NULL;
+ if (streq(fields[1], ""))
+ return NULL;
+ if (streq(fields[2], ""))
return NULL;
range.owner = fields[0];
if (str2ul(&range.start, fields[1]) == -1)
strcpy (full_tty, "/dev/");
strncat(full_tty, tty, UTX_LINESIZE);
- if ('\0' == tmptty[0]) {
+ if (streq(tmptty, "")) {
const char *tname = ttyname (STDIN_FILENO);
if (NULL != tname)
STRTCPY(tmptty, tname);
}
- if ('\0' == tmptty[0]) {
+ if (streq(tmptty, "")) {
(void) puts (_("Unable to determine your tty name."));
exit (EXIT_FAILURE);
}
* routine is meant to waste CPU time.
*/
- if ((NULL != ent->pw_name) && ('\0' == ent->pw_passwd[0])) {
- if ('\0' == password[0]) {
+ if ((NULL != ent->pw_name) && streq(ent->pw_passwd, "")) {
+ if (streq(password, "")) {
return true; /* user entered nothing */
} else {
return false; /* user entered something! */
* If there is no entry then we need a salt to use.
*/
- if ((NULL == ent->pw_name) || ('\0' == ent->pw_passwd[0])) {
+ if ((NULL == ent->pw_name) || streq(ent->pw_passwd, "")) {
salt = "xx";
} else {
salt = ent->pw_passwd;
*/
if ( (NULL != grp->gr_mem[0])
&& (NULL == grp->gr_mem[1])
- && ('\0' == grp->gr_mem[0][0])) {
+ && streq(grp->gr_mem[0], ""))
+ {
grp->gr_mem[0] = NULL;
}
/* if we didn't get a user on the command line,
set it to NULL */
get_pam_user (&pam_user);
- if ((NULL != pam_user) && ('\0' == pam_user[0])) {
+ if ((NULL != pam_user) && streq(pam_user, "")) {
retcode = pam_set_item (pamh, PAM_USER, NULL);
PAM_FAIL_CHECK;
}
username = XMALLOC(max_size, char);
login_prompt(username, max_size);
- if ('\0' == username[0]) {
+ if (streq(username, "")) {
/* Prompt for a new login */
free (username);
username = NULL;
* guys won't see that the passwordless account exists at
* all). --marekm
*/
- if (user_passwd[0] == '\0') {
+ if (streq(user_passwd, "")) {
pw_auth ("!", username, reason, NULL);
}
#ifndef USE_PAM
#ident "$Id$"
-#include "prototypes.h"
/*
* This module implements a simple but effective form of login access
* control based on login names and on host (or domain) names, internet
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <syslog.h>
+#include <arpa/inet.h> /* for inet_ntoa() */
#include <ctype.h>
-#include <netdb.h>
+#include <errno.h>
#include <grp.h>
+#include <netdb.h>
+#include <netinet/in.h>
#ifdef PRIMARY_GROUP_MATCH
#include <pwd.h>
#endif
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
+#include <stddef.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/param.h>
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h> /* for inet_ntoa() */
+#include <sys/types.h>
+#include <syslog.h>
+#include <unistd.h>
+#include "prototypes.h"
#include "sizeof.h"
#include "string/strchr/strrspn.h"
+#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
continue; /* comment line */
}
stpcpy(strrspn(line, " \t"), "");
- if (line[0] == '\0') { /* skip blank lines */
+ if (streq(line, "")) { /* skip blank lines */
continue;
}
p = line;
{
static char name[MAXHOSTNAMELEN + 1] = "";
- if (name[0] == '\0') {
+ if (streq(name, "")) {
gethostname (name, sizeof (name));
stpcpy(&name[MAXHOSTNAMELEN], "");
}
spw_free (spwd);
}
- if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) {
+ if (streq(pwd->pw_passwd, "") && (grp->gr_passwd[0] != '\0')) {
needspasswd = true;
}
goto failure;
}
- if (grp->gr_passwd[0] == '\0' ||
- !streq(cpasswd, grp->gr_passwd)) {
+ if (streq(grp->gr_passwd, "") ||
+ !streq(grp->gr_passwd, cpasswd)) {
#ifdef WITH_AUDIT
SNPRINTF(audit_buf, "authentication new-gid=%lu",
(unsigned long) grp->gr_gid);
if (*pass == '*' || *pass == '!') {
return "L";
}
- if (*pass == '\0') {
+ if (streq(pass, "")) {
return "NP";
}
return "P";
if (optind < argc) {
STRTCPY(name, argv[optind++]); /* use this login id */
}
- if ('\0' == name[0]) { /* use default user */
+ if (streq(name, "")) { /* use default user */
struct passwd *root_pw = getpwnam ("root");
if ((NULL != root_pw) && (0 == root_pw->pw_uid)) {
(void) strcpy (name, "root");
/*
* Set the default shell.
*/
- if ((NULL == shellstr) || ('\0' == shellstr[0])) {
+ if ((NULL == shellstr) || streq(shellstr, "")) {
shellstr = SHELL;
}
stpcpy(strrspn(temp, " \t"), "");
p = stpspn(temp, " \t");
- if (*p == '#' || *p == '\0')
+ if (*p == '#' || streq(p, ""))
continue;
to_users = strsep(&p, ":");
/*@-exitarg@*/
#include "exitcodes.h"
#include "shadowlog.h"
+#include "string/strcmp/streq.h"
#include "string/strdup/xstrdup.h"
* it will work with standard getpass() (no NULL on EOF).
* --marekm
*/
- if ((NULL == pass) || ('\0' == *pass)) {
+ if ((NULL == pass) || streq(pass, "")) {
erase_pass (pass);
(void) puts ("");
#ifdef TELINIT
* Default Skeleton information
*/
else if (streq(buf, DSKEL)) {
- if ('\0' == *ccp)
+ if (streq(ccp, ""))
ccp = SKEL_DIR;
if (prefix[0]) {
* Default Usr Skeleton information
*/
else if (streq(buf, DUSRSKEL)) {
- if ('\0' == *ccp)
+ if (streq(ccp, ""))
ccp = USRSKELDIR;
if (prefix[0]) {
* Create by default user mail spool or not ?
*/
else if (streq(buf, DCREATE_MAIL_SPOOL)) {
- if (*ccp == '\0')
+ if (streq(ccp, ""))
ccp = "no";
def_create_mail_spool = xstrdup(ccp);
* By default do we add the user to the lastlog and faillog databases ?
*/
else if (streq(buf, DLOG_INIT)) {
- if (*ccp == '\0')
+ if (streq(ccp, ""))
ccp = def_log_init;
def_log_init = xstrdup(ccp);
user_groups[i++] = NULL;
}
- if ('\0' == *list) {
+ if (streq(list, "")) {
return 0;
}
* Note: This is a best effort basis. The user may log in between,
* a cron job may be started on her behalf, etc.
*/
- if ((prefix[0] == '\0') && !Rflg && user_busy (user_name, user_id) != 0) {
+ if (streq(prefix, "") && !Rflg && user_busy(user_name, user_id) != 0) {
if (!fflg) {
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog,
* Cancel any crontabs or at jobs. Have to do this before we remove
* the entry from /etc/passwd.
*/
- if (prefix[0] == '\0')
+ if (streq(prefix, ""))
user_cancel (user_name);
close_files ();
*/
user_groups[0] = NULL;
- if ('\0' == *list) {
+ if (streq(list, "")) {
return 0;
}
* be changed while the user is logged in.
* Note: no need to check if a prefix is specified...
*/
- if ( (prefix[0] == '\0') && (uflg || lflg || dflg
+ if (streq(prefix, "") && (uflg || lflg || dflg
#ifdef ENABLE_SUBIDS
|| Vflg || Wflg
#endif /* ENABLE_SUBIDS */