New upstream version 4.17.0

This commit is contained in:
Chris Hofstaedtler
2024-12-28 13:12:23 +01:00
parent f78a468368
commit c2a3ebed18
423 changed files with 1574 additions and 1181 deletions
+2 -1
View File
@@ -33,6 +33,7 @@
#include "defines.h"
#include "chkname.h"
#include "string/strcmp/streq.h"
int allow_bad_names = false;
@@ -85,7 +86,7 @@ is_valid_name(const char *name)
numeric = isdigit(*name);
while ('\0' != *++name) {
while (!streq(++name, "")) {
if (!((*name >= 'a' && *name <= 'z') ||
(*name >= 'A' && *name <= 'Z') ||
(*name >= '0' && *name <= '9') ||
+3 -2
View File
@@ -18,6 +18,7 @@
#include "prototypes.h"
#include "string/strchr/stpspn.h"
#include "string/strchr/strrspn.h"
#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
@@ -47,7 +48,7 @@ int valid_field (const char *field, const char *illegal)
}
/* Search if there are non-printable or control characters */
for (cp = field; '\0' != *cp; cp++) {
for (cp = field; !streq(cp, ""); cp++) {
unsigned char c = *cp;
if (!isprint (c)) {
err = 1;
@@ -86,7 +87,7 @@ change_field(char *buf, size_t maxsize, const char *prompt)
if (stpsep(newf, "\n") == NULL)
return;
if ('\0' != newf[0]) {
if (!streq(newf, "")) {
/*
* Remove leading and trailing whitespace. This also
* makes it possible to change the field to empty, by
+2 -3
View File
@@ -14,8 +14,7 @@
#include "defines.h"
#include "prototypes.h"
#ident "$Id$"
#include "string/strcmp/streq.h"
/*@null@*/char *
@@ -48,7 +47,7 @@ int fputsx (const char *s, FILE * stream)
{
int i;
for (i = 0; '\0' != *s; i++, s++) {
for (i = 0; !streq(s, ""); i++, s++) {
if (putc (*s, stream) == EOF) {
return EOF;
}
+2 -1
View File
@@ -7,7 +7,8 @@
#include "fs/readlink/readlinknul.h"
#include <stddef.h>
#include <sys/types.h>
extern inline int readlinknul(const char *restrict link, char *restrict buf,
extern inline ssize_t readlinknul(const char *restrict link, char *restrict buf,
size_t size);
+11 -8
View File
@@ -22,28 +22,31 @@
ATTR_STRING(1)
inline int readlinknul(const char *restrict link, char *restrict buf,
inline ssize_t readlinknul(const char *restrict link, char *restrict buf,
size_t size);
// Similar to readlink(2), but terminate the string.
inline int
inline ssize_t
readlinknul(const char *restrict link, char *restrict buf, size_t size)
{
ssize_t len;
size_t ulen;
ssize_t slen;
len = readlink(link, buf, size);
if (len == -1)
slen = readlink(link, buf, size);
if (slen == -1)
return -1;
if (len == size) {
ulen = slen;
if (ulen == size) {
stpcpy(&buf[size-1], "");
errno = E2BIG;
return -1;
}
stpcpy(&buf[len], "");
return len;
stpcpy(&buf[ulen], "");
return slen;
}
+2 -2
View File
@@ -2213,7 +2213,7 @@ static int LookupWord (char *buff)
bool abbrev;
/* Make it lowercase. */
for (p = buff; '\0' != *p; p++)
for (p = buff; !streq(p, ""); p++)
if (isupper (*p))
*p = tolower (*p);
@@ -2306,7 +2306,7 @@ static int LookupWord (char *buff)
}
/* Drop out any periods and try the timezone table again. */
for (i = 0, p = q = buff; '\0' != *q; q++)
for (i = 0, p = q = buff; !streq(q, ""); q++)
if (*q != '.')
*p++ = *q;
else
+2 -2
View File
@@ -627,7 +627,7 @@ static int LookupWord (char *buff)
bool abbrev;
/* Make it lowercase. */
for (p = buff; '\0' != *p; p++)
for (p = buff; !streq(p, ""); p++)
if (isupper (*p))
*p = tolower (*p);
@@ -720,7 +720,7 @@ static int LookupWord (char *buff)
}
/* Drop out any periods and try the timezone table again. */
for (i = 0, p = q = buff; '\0' != *q; q++)
for (i = 0, p = q = buff; !streq(q, ""); q++)
if (*q != '.')
*p++ = *q;
else
+1 -1
View File
@@ -567,7 +567,7 @@ static void def_load (void)
* 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 */
+2 -1
View File
@@ -13,6 +13,7 @@
#include "atoi/a2i/a2u.h"
#include "defines.h"
#include "prototypes.h"
#include "string/strcmp/streq.h"
/*
@@ -53,7 +54,7 @@ getrange(const char *range,
return 0; /* <long> */
case '-':
if ('\0' == *end)
if (streq(end, ""))
return 0; /* <long>- */
parse_max:
if (!isdigit((unsigned char) *end))
+1 -1
View File
@@ -42,7 +42,7 @@ build_list(char *s)
l = XMALLOC(strchrcnt(s, ',') + 2, char *);
for (i = 0; s != NULL && *s != '\0'; i++)
for (i = 0; s != NULL && !streq(s, ""); i++)
l[i] = strsep(&s, ",");
l[i] = NULL;
+3 -3
View File
@@ -203,7 +203,7 @@ static int do_user_limits (const char *buf, const char *name)
pp = "A- C- D- F- I- L- M- N- O- P- R- S- T- U-";
}
while ('\0' != *pp) {
while (!streq(pp, "")) {
switch (*pp++) {
case 'a':
case 'A':
@@ -413,9 +413,9 @@ static int setup_user_limits (const char *uname)
}
}
(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 */
+1 -1
View File
@@ -209,7 +209,7 @@ comma_to_list(const char *comma)
* Empty list is special - 0 members, not 1 empty member. --marekm
*/
if ('\0' == *members) {
if (streq(members, "")) {
*array = NULL;
free (members);
return array;
+6 -2
View File
@@ -15,9 +15,13 @@
#ident "$Id$"
#include "defines.h"
#include <pwd.h>
#include "defines.h"
#include "prototypes.h"
#include "string/strcmp/streq.h"
/*@null@*/ /*@only@*/struct passwd *get_my_pwent (void)
{
struct passwd *pw;
@@ -34,7 +38,7 @@
* XXX - when running from su, will return the current user (not
* the original user, like getlogin() does). Does this matter?
*/
if ((NULL != cp) && ('\0' != *cp)) {
if ((NULL != cp) && !streq(cp, "")) {
pw = xgetpwnam (cp);
if ((NULL != pw) && (pw->pw_uid == ruid)) {
return pw;
+1 -1
View File
@@ -87,7 +87,7 @@ nss_init(const char *nsswitch_path) {
continue;
p = &line[6];
p = stpspn(p, " \t\n");
if (*p != '\0')
if (!streq(p, ""))
break;
p = NULL;
}
+1 -1
View File
@@ -82,7 +82,7 @@ static char *str_lower (/*@returned@*/char *string)
{
char *cp;
for (cp = string; '\0' != *cp; cp++) {
for (cp = string; !streq(cp, ""); cp++) {
*cp = tolower (*cp);
}
return string;
+4 -4
View File
@@ -39,12 +39,12 @@ static int portcmp (const char *pattern, const char *port)
{
const char *orig = port;
while (('\0' != *pattern) && (*pattern == *port)) {
while (!streq(pattern, "") && (*pattern == *port)) {
pattern++;
port++;
}
if (('\0' == *pattern) && ('\0' == *port)) {
if (streq(pattern, "") && streq(port, "")) {
return 0;
}
if (streq(orig, "SU"))
@@ -204,7 +204,7 @@ next:
cp = field;
if ('\0' == *cp) {
if (streq(cp, "")) {
port.pt_times = NULL;
return &port;
}
@@ -215,7 +215,7 @@ next:
* Get the next comma separated entry
*/
for (j = 0; ('\0' != *cp) && (j < PORT_TIMES); j++) {
for (j = 0; !streq(cp, "") && (j < PORT_TIMES); j++) {
/*
* Start off with no days of the week
+1 -1
View File
@@ -98,7 +98,7 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char **
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? */
+3 -2
View File
@@ -26,6 +26,7 @@
#include "getdef.h"
#include "string/memset/memzero.h"
#include "string/sprintf/snprintf.h"
#include "string/strcmp/streq.h"
#ifdef SKEY
#include <skey.h>
@@ -102,7 +103,7 @@ int pw_auth (const char *cipher,
* matter.
*/
if ((NULL == cipher) || ('\0' == *cipher)) {
if ((NULL == cipher) || streq(cipher, "")) {
return 0;
}
@@ -169,7 +170,7 @@ int pw_auth (const char *cipher,
* ...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;
+1 -1
View File
@@ -419,7 +419,7 @@ static /*@observer@*/const char *gensalt (size_t salt_size)
* 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;
+3 -2
View File
@@ -28,6 +28,7 @@
#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"
@@ -60,7 +61,7 @@ static void read_env_file (const char *filename)
cp = buf;
/* ignore whitespace and comments */
cp = stpspn(cp, " \t");
if (('\0' == *cp) || ('#' == *cp)) {
if (streq(cp, "") || ('#' == *cp)) {
continue;
}
/*
@@ -209,7 +210,7 @@ void setup_env (struct passwd *info)
* 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);
}
+3 -2
View File
@@ -21,6 +21,7 @@
#include "atoi/getnum.h"
#include "defines.h"
#include "prototypes.h"
#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
@@ -54,7 +55,7 @@ list(char *s)
return NULL;
}
}
if (!s || s[0] == '\0')
if (!s || streq(s, ""))
break;
members[i++] = strsep(&s, ",");
}
@@ -89,7 +90,7 @@ struct group *sgetgrent (const char *buf)
for (cp = grpbuf, i = 0; (i < NFIELDS) && (NULL != cp); i++)
grpfields[i] = strsep(&cp, ":");
if (i < (NFIELDS - 1) || *grpfields[2] == '\0' || cp != NULL) {
if (i < NFIELDS || streq(grpfields[2], "") || cp != NULL) {
return NULL;
}
grent.gr_name = grpfields[0];
+6 -1
View File
@@ -20,6 +20,7 @@
#include "defines.h"
#include "prototypes.h"
#include "shadowlog_internal.h"
#include "string/strcmp/streq.h"
#define NFIELDS 7
@@ -76,7 +77,11 @@ sgetpwent(const char *buf)
* 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;
/*
+8 -7
View File
@@ -24,6 +24,7 @@
#include "defines.h"
#include "prototypes.h"
#include "shadowlog_internal.h"
#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"
@@ -85,7 +86,7 @@ sgetspent(const char *string)
* 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;
@@ -94,7 +95,7 @@ sgetspent(const char *string)
* 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;
@@ -103,7 +104,7 @@ sgetspent(const char *string)
* 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;
@@ -126,7 +127,7 @@ sgetspent(const char *string)
* 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;
@@ -136,7 +137,7 @@ sgetspent(const char *string)
* 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;
@@ -146,7 +147,7 @@ sgetspent(const char *string)
* 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;
@@ -156,7 +157,7 @@ sgetspent(const char *string)
* 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;
+4 -3
View File
@@ -1,7 +1,9 @@
/* Author: Peter Vrabec <pvrabec@redhat.com> */
#include <config.h>
#ifdef USE_SSSD
#include "sssd.h"
#include <stdio.h>
#include <sys/stat.h>
@@ -12,9 +14,8 @@
#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."
@@ -46,7 +47,7 @@ sssd_flush_cache(int dbflags)
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;
+3 -4
View File
@@ -11,12 +11,11 @@
#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"
/*
@@ -44,7 +43,7 @@ long strtoday (const char *str)
* 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;
}
@@ -55,7 +54,7 @@ long strtoday (const char *str)
s++;
}
s = stpspn(s, " ");
while (isnum && ('\0' != *s)) {
while (isnum && !streq(s, "")) {
if (!isdigit (*s)) {
isnum = false;
}
+7 -1
View File
@@ -108,7 +108,13 @@ subordinate_parse(const char *line)
* 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)
+1 -1
View File
@@ -58,7 +58,7 @@ void ttytype (const char *line)
break;
}
}
if ((feof (fp) == 0) && (ferror (fp) == 0) && (type[0] != '\0')) {
if ((feof(fp) == 0) && (ferror(fp) == 0) && !streq(type, "")) {
addenv ("TERM", type);
}
+3 -3
View File
@@ -53,13 +53,13 @@ is_my_tty(const char tty[UTX_LINESIZE])
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);
}
@@ -254,7 +254,7 @@ prepare_utmp(const char *name, const char *line, const char *host,
if (NULL != host && '\0' != host[0])
if (NULL != host && !streq(host, ""))
hostname = xstrdup(host);
#if defined(HAVE_STRUCT_UTMPX_UT_HOST)
else if (NULL != ut && '\0' != ut->ut_host[0])
+3 -3
View File
@@ -42,8 +42,8 @@ bool valid (const char *password, const struct passwd *ent)
* 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! */
@@ -54,7 +54,7 @@ bool valid (const char *password, const struct passwd *ent)
* 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;