diff --git a/configure.ac b/configure.ac index c01264c004..6c9abf17c1 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ AC_CHECK_FUNCS([arc4random_buf \ updwtmpx innetgr \ getspnam_r \ rpmatch \ - memset_explicit explicit_bzero stpecpy stpeprintf]) + memset_explicit explicit_bzero stpecpy seprintf]) AC_SYS_LARGEFILE dnl Checks for typedefs, structures, and compiler characteristics. diff --git a/lib/Makefile.am b/lib/Makefile.am index 6a9a164433..71ff96995d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -197,10 +197,10 @@ libshadow_la_SOURCES = \ string/memset/memzero.h \ string/sprintf/aprintf.c \ string/sprintf/aprintf.h \ - string/sprintf/snprintf.c \ - string/sprintf/snprintf.h \ - string/sprintf/stpeprintf.c \ - string/sprintf/stpeprintf.h \ + string/sprintf/seprintf.c \ + string/sprintf/seprintf.h \ + string/sprintf/stprintf.c \ + string/sprintf/stprintf.h \ string/strchr/strchrcnt.c \ string/strchr/strchrcnt.h \ string/strchr/strchrscnt.c \ diff --git a/lib/audit_help.c b/lib/audit_help.c index b0ac5631e5..987465c389 100644 --- a/lib/audit_help.c +++ b/lib/audit_help.c @@ -25,7 +25,7 @@ #include "attr.h" #include "prototypes.h" #include "shadowlog.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" int audit_fd; diff --git a/lib/commonio.c b/lib/commonio.c index 28dc7324cf..cc01469ed0 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -37,7 +37,7 @@ #include "sssd.h" #include "string/memset/memzero.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strerrno.h" diff --git a/lib/env.c b/lib/env.c index f97bb10272..86fe79c597 100644 --- a/lib/env.c +++ b/lib/env.c @@ -22,8 +22,7 @@ #include "defines.h" #include "shadowlog.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/snprintf.h" -#include "string/sprintf/aprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/strprefix.h" #include "string/strdup/strdup.h" diff --git a/lib/get_pid.c b/lib/get_pid.c index 6ccc79d79b..719ddb4054 100644 --- a/lib/get_pid.c +++ b/lib/get_pid.c @@ -14,7 +14,7 @@ #include "atoi/getnum.h" #include "defines.h" #include "prototypes.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strerrno.h" diff --git a/lib/hushed.c b/lib/hushed.c index c2df9a4b90..6b0593c31f 100644 --- a/lib/hushed.c +++ b/lib/hushed.c @@ -21,7 +21,7 @@ #include "defines.h" #include "getdef.h" #include "prototypes.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strtok/stpsep.h" diff --git a/lib/idmapping.c b/lib/idmapping.c index 88a0c00e47..77631ec18a 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -27,7 +27,7 @@ #include "prototypes.h" #include "shadowlog.h" #include "sizeof.h" -#include "string/sprintf/stpeprintf.h" +#include "string/sprintf/seprintf.h" #include "string/strcmp/streq.h" #include "string/strerrno.h" @@ -184,13 +184,13 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings mapping = mappings; for (idx = 0; idx < ranges; idx++, mapping++) { /* Append this range to the string that will be written */ - pos = stpeprintf(pos, end, "%lu %lu %lu\n", + pos = seprintf(pos, end, "%lu %lu %lu\n", mapping->upper, mapping->lower, mapping->count); } if (pos == end || pos == NULL) { - fprintf(log_get_logfd(), _("%s: stpeprintf failed!\n"), log_get_progname()); + fprintf(log_get_logfd(), _("%s: seprintf failed!\n"), log_get_progname()); exit(EXIT_FAILURE); } diff --git a/lib/nss.c b/lib/nss.c index 5957390741..c487800e26 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -13,7 +13,7 @@ #include "prototypes.h" #include "../libsubid/subid.h" #include "shadowlog.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/strcaseprefix.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/lib/pwauth.c b/lib/pwauth.c index 0f0d2ff77c..d8f61e3ea0 100644 --- a/lib/pwauth.c +++ b/lib/pwauth.c @@ -25,7 +25,7 @@ #include "pwauth.h" #include "getdef.h" #include "string/memset/memzero.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #ifdef SKEY diff --git a/lib/salt.c b/lib/salt.c index 2e6f83197e..573547cc07 100644 --- a/lib/salt.c +++ b/lib/salt.c @@ -26,6 +26,7 @@ #include "getdef.h" #include "prototypes.h" #include "shadowlog.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" @@ -172,7 +173,7 @@ static /*@observer@*/void SHA_salt_rounds_to_buf (char *buf, unsigned long round */ assert (GENSALT_SETTING_SIZE > buf_begin + 17); - (void) snprintf (buf + buf_begin, 18, "rounds=%lu$", rounds); + stprintf(buf + buf_begin, 18, "rounds=%lu$", rounds); } #ifdef USE_BCRYPT @@ -250,7 +251,7 @@ static /*@observer@*/void BCRYPT_salt_rounds_to_buf (char *buf, unsigned long ro */ assert (GENSALT_SETTING_SIZE > buf_begin + 3); - (void) snprintf (buf + buf_begin, 4, "%2.2lu$", rounds); + stprintf(buf + buf_begin, 4, "%2.2lu$", rounds); } #endif /* USE_BCRYPT */ diff --git a/lib/shell.c b/lib/shell.c index 1e49df7b03..b4738561f1 100644 --- a/lib/shell.c +++ b/lib/shell.c @@ -15,7 +15,7 @@ #include #include "prototypes.h" #include "defines.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" extern char **newenvp; diff --git a/lib/string/README b/lib/string/README index 03f3db6c33..9e3ea4f34b 100644 --- a/lib/string/README +++ b/lib/string/README @@ -213,14 +213,14 @@ sprintf/ - Formatted string creation sprintf(3) variant that allocates. It has better interface than asprintf(3). - stprintf() // Current name: snprintf_() + stprintf() snprintf(3) wrapper that reports truncation with -1. If you need more than one call to form a string, use seprintf() instead. stprintf_a() Like stprintf(), but takes an array. - seprintf() // Current name: stpeprintf()) + seprintf() Similar to stprintf(), but takes a pointer to the end instead of a size. This makes it safer for chaining several calls. diff --git a/lib/string/sprintf/seprintf.c b/lib/string/sprintf/seprintf.c new file mode 100644 index 0000000000..cf62542fef --- /dev/null +++ b/lib/string/sprintf/seprintf.c @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include "config.h" + +#include "string/sprintf/seprintf.h" + +#include + + +#if !defined(HAVE_SEPRINTF) +extern inline char *seprintf(char *dst, const char end[0], + const char *restrict fmt, ...); +extern inline char *vseprintf(char *dst, const char end[0], + const char *restrict fmt, va_list ap); +#endif diff --git a/lib/string/sprintf/seprintf.h b/lib/string/sprintf/seprintf.h new file mode 100644 index 0000000000..197aa6aa87 --- /dev/null +++ b/lib/string/sprintf/seprintf.h @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_SEPRINTF_H_ +#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_SEPRINTF_H_ + + +#include "config.h" + +#include +#include + +#include "attr.h" +#include "string/sprintf/stprintf.h" + + +#if !defined(HAVE_SEPRINTF) +// seprintf - string end-pointer print formatted +format_attr(printf, 3, 4) +inline char *seprintf(char *dst, const char end[0], const char *restrict fmt, + ...); +// vseprintf - va_list string end-pointer print formatted +format_attr(printf, 3, 0) +inline char *vseprintf(char *dst, const char end[0], const char *restrict fmt, + va_list ap); +#endif + + +#if !defined(HAVE_SEPRINTF) +inline char * +seprintf(char *dst, const char end[0], const char *restrict fmt, ...) +{ + char *p; + va_list ap; + + va_start(ap, fmt); + p = vseprintf(dst, end, fmt, ap); + va_end(ap); + + return p; +} +#endif + + +#if !defined(HAVE_SEPRINTF) +inline char * +vseprintf(char *dst, const char end[0], const char *restrict fmt, va_list ap) +{ + int len; + ptrdiff_t size; + + if (dst == NULL) + return NULL; + + size = end - dst; + len = vstprintf(dst, size, fmt, ap); + if (len == -1) + return NULL; + + return dst + len; +} +#endif + + +#endif // include guard diff --git a/lib/string/sprintf/snprintf.c b/lib/string/sprintf/snprintf.c deleted file mode 100644 index e3755da76b..0000000000 --- a/lib/string/sprintf/snprintf.c +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "string/sprintf/snprintf.h" - -#include -#include - - -extern inline int snprintf_(char *restrict s, size_t size, - const char *restrict fmt, ...); -extern inline int vsnprintf_(char *restrict s, size_t size, - const char *restrict fmt, va_list ap); diff --git a/lib/string/sprintf/snprintf.h b/lib/string/sprintf/snprintf.h deleted file mode 100644 index f6dee1245f..0000000000 --- a/lib/string/sprintf/snprintf.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_SNPRINTF_H_ -#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_SNPRINTF_H_ - - -#include "config.h" - -#include -#include -#include - -#include "attr.h" -#include "sizeof.h" - - -// stprintf_a - string truncate print formatted array -#define stprintf_a(s, fmt, ...) \ -( \ - snprintf_(s, countof(s), fmt __VA_OPT__(,) __VA_ARGS__) \ -) - - -format_attr(printf, 3, 4) -inline int snprintf_(char *restrict s, size_t size, const char *restrict fmt, - ...); -format_attr(printf, 3, 0) -inline int vsnprintf_(char *restrict s, size_t size, const char *restrict fmt, - va_list ap); - - -inline int -snprintf_(char *restrict s, size_t size, const char *restrict fmt, ...) -{ - int len; - va_list ap; - - va_start(ap, fmt); - len = vsnprintf_(s, size, fmt, ap); - va_end(ap); - - return len; -} - - -inline int -vsnprintf_(char *restrict s, size_t size, const char *restrict fmt, va_list ap) -{ - int len; - - len = vsnprintf(s, size, fmt, ap); - if (len == -1) - return -1; - if ((size_t) len >= size) - return -1; - - return len; -} - - -#endif // include guard diff --git a/lib/string/sprintf/stpeprintf.c b/lib/string/sprintf/stpeprintf.c deleted file mode 100644 index d195931b89..0000000000 --- a/lib/string/sprintf/stpeprintf.c +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "string/sprintf/stpeprintf.h" - -#include - - -#if !defined(HAVE_STPEPRINTF) -extern inline char *stpeprintf(char *dst, char *end, const char *restrict fmt, - ...); -extern inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt, - va_list ap); -#endif diff --git a/lib/string/sprintf/stpeprintf.h b/lib/string/sprintf/stpeprintf.h deleted file mode 100644 index b0048c4441..0000000000 --- a/lib/string/sprintf/stpeprintf.h +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPEPRINTF_H_ -#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPEPRINTF_H_ - - -#include "config.h" - -#include -#include -#include - -#include "attr.h" - - -#if !defined(HAVE_STPEPRINTF) -format_attr(printf, 3, 4) -inline char *stpeprintf(char *dst, char *end, const char *restrict fmt, ...); -format_attr(printf, 3, 0) -inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt, - va_list ap); -#endif - - -/* - * SYNOPSIS - * [[gnu::format(printf, 3, 4)]] - * char *_Nullable stpeprintf(char *_Nullable dst, char end[0], - * const char *restrict fmt, ...); - * - * [[gnu::format(printf, 3, 0)]] - * char *_Nullable vstpeprintf(char *_Nullable dst, char end[0], - * const char *restrict fmt, va_list ap); - * - * - * ARGUMENTS - * dst Destination buffer where to write a string. - * - * end Pointer to one after the last element of the buffer - * pointed to by `dst`. Usually, it should be calculated - * as `dst + countof(dst)`. - * - * fmt Format string - * - * ... - * ap Variadic argument list - * - * DESCRIPTION - * These functions are very similar to [v]snprintf(3). - * - * The destination buffer is limited by a pointer to its end --one - * after its last element-- instead of a size. This allows - * chaining calls to it safely, unlike [v]snprintf(3), which is - * difficult to chain without invoking Undefined Behavior. - * - * RETURN VALUE - * dst + strlen(dst) - * • On success, these functions return a pointer to the - * terminating NUL byte. - * - * end - * • If this call truncated the resulting string. - * • If `dst == end` (a previous chained call to these - * functions truncated). - * NULL - * • If this function failed (see ERRORS). - * • If `dst == NULL` (a previous chained call to these - * functions failed). - * - * ERRORS - * These functions may fail for the same reasons as vsnprintf(3). - */ - - -#if !defined(HAVE_STPEPRINTF) -inline char * -stpeprintf(char *dst, char *end, const char *restrict fmt, ...) -{ - char *p; - va_list ap; - - va_start(ap, fmt); - p = vstpeprintf(dst, end, fmt, ap); - va_end(ap); - - return p; -} -#endif - - -#if !defined(HAVE_STPEPRINTF) -inline char * -vstpeprintf(char *dst, char *end, const char *restrict fmt, va_list ap) -{ - int len; - ptrdiff_t size; - - if (dst == end) - return end; - if (dst == NULL) - return NULL; - - size = end - dst; - len = vsnprintf(dst, size, fmt, ap); - - if (len == -1) - return NULL; - if (len >= size) - return end; - - return dst + len; -} -#endif - - -#endif // include guard diff --git a/lib/string/sprintf/stprintf.c b/lib/string/sprintf/stprintf.c new file mode 100644 index 0000000000..1fe70550f7 --- /dev/null +++ b/lib/string/sprintf/stprintf.c @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include "config.h" + +#include "string/sprintf/stprintf.h" + +#include +#include + + +extern inline int stprintf(char *restrict s, ssize_t size, + const char *restrict fmt, ...); +extern inline int vstprintf(char *restrict s, ssize_t size, + const char *restrict fmt, va_list ap); diff --git a/lib/string/sprintf/stprintf.h b/lib/string/sprintf/stprintf.h new file mode 100644 index 0000000000..1488862d8e --- /dev/null +++ b/lib/string/sprintf/stprintf.h @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPRINTF_H_ +#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPRINTF_H_ + + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "attr.h" +#include "sizeof.h" + + +// stprintf_a - string truncate print formatted array +#define stprintf_a(s, fmt, ...) \ +( \ + stprintf(s, countof(s), fmt __VA_OPT__(,) __VA_ARGS__) \ +) + + +// stprintf - string truncate print formatted +format_attr(printf, 3, 4) +inline int stprintf(char *restrict s, ssize_t size, + const char *restrict fmt, ...); +// vstprintf - va_list string truncate print formatted +format_attr(printf, 3, 0) +inline int vstprintf(char *restrict s, ssize_t size, + const char *restrict fmt, va_list ap); + + +inline int +stprintf(char *restrict s, ssize_t size, const char *restrict fmt, ...) +{ + int len; + va_list ap; + + va_start(ap, fmt); + len = vstprintf(s, size, fmt, ap); + va_end(ap); + + return len; +} + + +inline int +vstprintf(char *restrict s, ssize_t size, const char *restrict fmt, va_list ap) +{ + int len; + + if (size == 0) + abort(); + + len = vsnprintf(s, size, fmt, ap); + if (len == -1) + return -1; + if (len >= size) { + errno = E2BIG; + return -1; + } + + return len; +} + + +#endif // include guard diff --git a/lib/string/strcpy/stpecpy.c b/lib/string/strcpy/stpecpy.c index 2e6f92b0fc..bd36cbc1cb 100644 --- a/lib/string/strcpy/stpecpy.c +++ b/lib/string/strcpy/stpecpy.c @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -8,5 +8,6 @@ #if !defined(HAVE_STPECPY) -extern inline char *stpecpy(char *dst, char *end, const char *restrict src); +extern inline char *stpecpy(char *dst, const char end[0], + const char *restrict src); #endif diff --git a/lib/string/strcpy/stpecpy.h b/lib/string/strcpy/stpecpy.h index 91c6ce7a7f..7492f6e8fe 100644 --- a/lib/string/strcpy/stpecpy.h +++ b/lib/string/strcpy/stpecpy.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2022-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -8,79 +8,36 @@ #include "config.h" +#include #include #include #include #include "attr.h" +#include "string/strcpy/strtcpy.h" #if !defined(HAVE_STPECPY) +// stpecpy - string offset-pointer end-pointer copy ATTR_STRING(3) -inline char *stpecpy(char *dst, char *end, const char *restrict src); +inline char *stpecpy(char *dst, const char end[0], const char *restrict src); #endif -/* - * SYNOPSIS - * [[gnu::null_terminated_string_arg(3)]] - * char *_Nullable stpecpy(char *_Nullable dst, char end[0], - * const char *restrict src); - * - * ARGUMENTS - * dst Destination buffer where to copy a string. - * - * end Pointer to one after the last element of the buffer - * pointed to by `dst`. Usually, it should be calculated - * as `dst + countof(dst)`. - * - * src Source string to be copied into dst. - * - * DESCRIPTION - * This function copies the string pointed to by src, into a string - * at the buffer pointed to by dst. If the destination buffer, - * limited by a pointer to its end --one after its last element--, - * isn't large enough to hold the copy, the resulting string is - * truncated. - * - * This function can be chained with calls to [v]stpeprintf(). - * - * RETURN VALUE - * dst + strlen(dst) - * • On success, this function returns a pointer to the - * terminating NUL byte. - * - * end - * • If this call truncated the resulting string. - * • If `dst == end` (a previous chained call to these - * functions truncated). - * NULL - * • If `dst == NULL` (a previous chained call to - * [v]stpeprintf() failed). - * - * ERRORS - * This function doesn't set errno. - */ - - #if !defined(HAVE_STPECPY) inline char * -stpecpy(char *dst, char *end, const char *restrict src) +stpecpy(char *dst, const char end[0], const char *restrict src) { - bool trunc; - size_t dsize, dlen, slen; + ssize_t dlen; - if (dst == end) - return end; if (dst == NULL) return NULL; - dsize = end - dst; - slen = strnlen(src, dsize); - trunc = (slen == dsize); - dlen = slen - trunc; + dlen = strtcpy(dst, src, end - dst); + if (dlen == -1) + return NULL; - return stpcpy(mempcpy(dst, src, dlen), "") + trunc; + return dst + dlen; } #endif diff --git a/lib/string/strcpy/strtcpy.h b/lib/string/strcpy/strtcpy.h index a440bcdfb3..a8c3f865ac 100644 --- a/lib/string/strcpy/strtcpy.h +++ b/lib/string/strcpy/strtcpy.h @@ -8,8 +8,10 @@ #include "config.h" +#include #include #include +#include #include #include @@ -34,7 +36,7 @@ strtcpy(char *restrict dst, const char *restrict src, size_t dsize) size_t dlen, slen; if (dsize == 0) - return -1; + abort(); slen = strnlen(src, dsize); trunc = (slen == dsize); @@ -42,8 +44,10 @@ strtcpy(char *restrict dst, const char *restrict src, size_t dsize) stpcpy(mempcpy(dst, src, dlen), ""); - if (trunc) + if (trunc) { + errno = E2BIG; return -1; + } return slen; } diff --git a/lib/subordinateio.c b/lib/subordinateio.c index acd3f1ffdc..5cc19d0a05 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -23,7 +23,7 @@ #include "alloc/reallocf.h" #include "atoi/a2i.h" #include "string/ctype/strisascii/strisdigit.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strtok/strsep2arr.h" @@ -823,7 +823,6 @@ static bool get_owner_id(const char *owner, enum subid_type id_type, char *id) { struct passwd *pw; struct group *gr; - int ret = 0; switch (id_type) { case ID_TYPE_UID: @@ -831,20 +830,16 @@ static bool get_owner_id(const char *owner, enum subid_type id_type, char *id) if (pw == NULL) { return false; } - ret = snprintf(id, ID_SIZE, "%u", pw->pw_uid); - if (ret < 0 || ret >= ID_SIZE) { + if (stprintf(id, ID_SIZE, "%u", pw->pw_uid) == -1) return false; - } break; case ID_TYPE_GID: gr = getgrnam(owner); if (gr == NULL) { return false; } - ret = snprintf(id, ID_SIZE, "%u", gr->gr_gid); - if (ret < 0 || ret >= ID_SIZE) { + if (stprintf(id, ID_SIZE, "%u", gr->gr_gid) == -1) return false; - } break; default: return false; diff --git a/lib/user_busy.c b/lib/user_busy.c index d08229cbe4..ca4e92a640 100644 --- a/lib/user_busy.c +++ b/lib/user_busy.c @@ -28,7 +28,7 @@ #include "subordinateio.h" #endif /* ENABLE_SUBIDS */ #include "shadowlog.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strneq.h" #include "string/strcmp/strprefix.h" diff --git a/po/bs.po b/po/bs.po index 3f41814628..49d1fc2c75 100644 --- a/po/bs.po +++ b/po/bs.po @@ -205,7 +205,7 @@ msgid "%s: Could not set caps\n" msgstr "%s: nepoznat član %s\n" #, fuzzy, c-format -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "nepoznata grupa: %s\n" #, fuzzy, c-format diff --git a/po/ca.po b/po/ca.po index 26457b447f..a6efb19606 100644 --- a/po/ca.po +++ b/po/ca.po @@ -229,8 +229,8 @@ msgid "%s: Could not set caps\n" msgstr "%s: No s'han pogut establir les «capabilities»\n" #, c-format -msgid "%s: stpeprintf failed!\n" -msgstr "%s: ha fallat stpeprintf!\n" +msgid "%s: seprintf failed!\n" +msgstr "%s: ha fallat seprintf!\n" #, c-format msgid "%s: open of %s failed: %s\n" diff --git a/po/cs.po b/po/cs.po index 615ce68e70..29ac71e99b 100644 --- a/po/cs.po +++ b/po/cs.po @@ -228,7 +228,7 @@ msgstr "Nelze nastavit jméno uživatele %s\n" #, fuzzy, c-format #| msgid "%s: snprintf failed!\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: snprintf selhalo!\n" #, c-format diff --git a/po/da.po b/po/da.po index 20666eddb2..73ccfa8b02 100644 --- a/po/da.po +++ b/po/da.po @@ -244,7 +244,7 @@ msgstr "Kunne ikke angive navn for %s\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: Linje %d: chown %s fejlede: %s\n" #, fuzzy, c-format diff --git a/po/de.po b/po/de.po index 0594ca2118..e245a04a3c 100644 --- a/po/de.po +++ b/po/de.po @@ -238,7 +238,7 @@ msgstr "Name für %s konnte nicht gesetzt werden\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: Zeile %d: chown %s (Eigentümer ändern) fehlgeschlagen: %s\n" #, fuzzy, c-format diff --git a/po/dz.po b/po/dz.po index 59771609f9..1cb6713e62 100644 --- a/po/dz.po +++ b/po/dz.po @@ -215,7 +215,7 @@ msgstr "རིམ་སྒྲིག་བརྡ་དོན་གྱི་དོ #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: ཡིག་སྣོད་ཁ་ཕྱེ་མི་ཚུགས།\n" #, fuzzy, c-format diff --git a/po/el.po b/po/el.po index 18fdc8a90a..59c010eaaf 100644 --- a/po/el.po +++ b/po/el.po @@ -238,7 +238,7 @@ msgstr "Αδυναμία ρύθμισης του ονόματος χρήστη % #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: αδυναμία ανοίγματος του αρχείου\n" #, fuzzy, c-format diff --git a/po/es.po b/po/es.po index 54863bfad3..e85b375dbc 100644 --- a/po/es.po +++ b/po/es.po @@ -264,7 +264,7 @@ msgstr "No se pudo reservar espacio para la información de configuración.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: no se puede abrir el fichero\n" #, fuzzy, c-format diff --git a/po/eu.po b/po/eu.po index f78b0ea44e..d6e2d45756 100644 --- a/po/eu.po +++ b/po/eu.po @@ -221,7 +221,7 @@ msgstr "Ezin izan da lekua esleitu, konfigurazioaren informaziorako.\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: %d lerroa: chown %s-ek huts egin du: %s\n" #, fuzzy, c-format diff --git a/po/fi.po b/po/fi.po index 94d4d1d7b9..0774becb02 100644 --- a/po/fi.po +++ b/po/fi.po @@ -209,7 +209,7 @@ msgstr "Asetustiedoille ei voi varata tilaa.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: tiedosta ei voi avata\n" #, fuzzy, c-format diff --git a/po/fr.po b/po/fr.po index 57c3531daf..6132505fee 100644 --- a/po/fr.po +++ b/po/fr.po @@ -254,8 +254,8 @@ msgid "%s: Could not set caps\n" msgstr "%s : Impossible de définir les plafonds\n" #, c-format -msgid "%s: stpeprintf failed!\n" -msgstr "%s : échec de stpeprintf !\n" +msgid "%s: seprintf failed!\n" +msgstr "%s : échec de seprintf !\n" #, c-format msgid "%s: open of %s failed: %s\n" diff --git a/po/gl.po b/po/gl.po index bbc7dfcc9f..f702fbdc93 100644 --- a/po/gl.po +++ b/po/gl.po @@ -211,7 +211,7 @@ msgstr "Non se puido reservar espacio para a información de configuración.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: non se pode abrir o ficheiro\n" #, fuzzy, c-format diff --git a/po/he.po b/po/he.po index 1648c78d58..c667720fdb 100644 --- a/po/he.po +++ b/po/he.po @@ -205,7 +205,7 @@ msgid "%s: Could not set caps\n" msgstr "לא יכול להקצות מקום בשביל מידע על הקונפיגורציה.\n" #, fuzzy, c-format -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: שורה %d: לא יכול לעדכן רשומת סיסמה\n" #, fuzzy, c-format diff --git a/po/hu.po b/po/hu.po index e7bf22a7c8..1d0691cb00 100644 --- a/po/hu.po +++ b/po/hu.po @@ -206,7 +206,7 @@ msgstr "Sikertelen helyfoglalás a beállítási infónak.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: nem tudom megnyitni a fájlt\n" #, fuzzy, c-format diff --git a/po/id.po b/po/id.po index 4c070a0752..3a71f03369 100644 --- a/po/id.po +++ b/po/id.po @@ -205,7 +205,7 @@ msgstr "Tidak dapat mengalokasikan ruang untuk informasi konfigurasi.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: tidak dapat membuka berkas\n" #, fuzzy, c-format diff --git a/po/it.po b/po/it.po index 4d3ec5cb9b..37f6a0b27e 100644 --- a/po/it.po +++ b/po/it.po @@ -232,7 +232,7 @@ msgstr "Impossibile allocare spazio per le informazioni di configurazione.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: impossibile aprire il file\n" #, fuzzy, c-format diff --git a/po/ja.po b/po/ja.po index 426e3302c7..2f32c0e800 100644 --- a/po/ja.po +++ b/po/ja.po @@ -231,7 +231,7 @@ msgstr "%s の名前を設定できません\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: %d 行: chown %s が失敗しました: %s\n" #, fuzzy, c-format diff --git a/po/ka.po b/po/ka.po index c633393927..e09a9adb6e 100644 --- a/po/ka.po +++ b/po/ka.po @@ -227,8 +227,8 @@ msgid "%s: Could not set caps\n" msgstr "%s: caps-ების დაყენების შედომა\n" #, c-format -msgid "%s: stpeprintf failed!\n" -msgstr "%s: stpeprintf ჩავარდა!\n" +msgid "%s: seprintf failed!\n" +msgstr "%s: seprintf ჩავარდა!\n" #, c-format msgid "%s: open of %s failed: %s\n" diff --git a/po/kk.po b/po/kk.po index 60cb95cd39..988b96bded 100644 --- a/po/kk.po +++ b/po/kk.po @@ -229,7 +229,7 @@ msgstr "%s үшін атын орнату мүмкін емес\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: жол %d: chown %s сәтсіз: %s\n" #, fuzzy, c-format diff --git a/po/km.po b/po/km.po index 513f284989..3e49c01773 100644 --- a/po/km.po +++ b/po/km.po @@ -219,7 +219,7 @@ msgstr "មិន​អាច​បម្រុង​ទុក​ទំហំ​ #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s ៖ មិន​អាច​បើក​​ឯកសារ​បានទេ\n" #, fuzzy, c-format diff --git a/po/ko.po b/po/ko.po index 980c30f387..89ea54d3ed 100644 --- a/po/ko.po +++ b/po/ko.po @@ -212,7 +212,7 @@ msgid "%s: Could not set caps\n" msgstr "설정 정보를 위한 공간을 확보할 수 없습니다.\n" #, fuzzy, c-format -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: %d번 줄: chown 실패했습니다\n" #, fuzzy, c-format diff --git a/po/nb.po b/po/nb.po index 1eb1e3be35..33e61d3ba1 100644 --- a/po/nb.po +++ b/po/nb.po @@ -251,7 +251,7 @@ msgstr "Klarte ikke å endre navn på %s\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: klarte ikke å åpne fil\n" #, fuzzy, c-format diff --git a/po/ne.po b/po/ne.po index 08f423fab6..abcea08922 100644 --- a/po/ne.po +++ b/po/ne.po @@ -212,7 +212,7 @@ msgstr "कनफिगरेसन सूचनाको लागि खाल #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: फाइल खोल्न सकिएन\n" #, fuzzy, c-format diff --git a/po/nl.po b/po/nl.po index aa824d3377..79ec110c76 100644 --- a/po/nl.po +++ b/po/nl.po @@ -232,8 +232,8 @@ msgid "%s: Could not set caps\n" msgstr "%s: Kon hoofdletters niet instellen\n" #, c-format -msgid "%s: stpeprintf failed!\n" -msgstr "%s: stpeprintf is mislukt!\n" +msgid "%s: seprintf failed!\n" +msgstr "%s: seprintf is mislukt!\n" #, c-format msgid "%s: open of %s failed: %s\n" diff --git a/po/nn.po b/po/nn.po index 60b7b53715..e00c1bb026 100644 --- a/po/nn.po +++ b/po/nn.po @@ -205,7 +205,7 @@ msgstr "Klarte ikkje finna plass for oppsettsinformasjon.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: klarer ikkje opna fil\n" #, fuzzy, c-format diff --git a/po/pl.po b/po/pl.po index 259d2c10b0..c1dfdea148 100644 --- a/po/pl.po +++ b/po/pl.po @@ -216,7 +216,7 @@ msgstr "Nie można przydzielić miejsca dla informacji o konfiguracji.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: nie można otworzyć pliku\n" #, fuzzy, c-format diff --git a/po/pt.po b/po/pt.po index cdc2195568..6620c91620 100644 --- a/po/pt.po +++ b/po/pt.po @@ -243,7 +243,7 @@ msgstr "Não foi possível definir nome para %s\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: linha %d: chown %s falhou: %s\n" #, fuzzy, c-format diff --git a/po/pt_BR.po b/po/pt_BR.po index e1e2c6a83b..6094bb4ee6 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -235,7 +235,7 @@ msgstr "Não foi possível alocar espaço para a informação de configuração. #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s : não foi possível abrir arquivo\n" #, fuzzy, c-format diff --git a/po/ro.po b/po/ro.po index a3e1b53b54..062c84749c 100644 --- a/po/ro.po +++ b/po/ro.po @@ -242,8 +242,8 @@ msgid "%s: Could not set caps\n" msgstr "%s: Nu s-au putut defini capacitățile\n" #, c-format -msgid "%s: stpeprintf failed!\n" -msgstr "%s: stpeprintf a eșuat!\n" +msgid "%s: seprintf failed!\n" +msgstr "%s: seprintf a eșuat!\n" #, c-format msgid "%s: open of %s failed: %s\n" diff --git a/po/ru.po b/po/ru.po index ba4787cc8f..d70989ff00 100644 --- a/po/ru.po +++ b/po/ru.po @@ -244,7 +244,7 @@ msgstr "Невозможно задать имя для %s\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: строка %d: вызов chown %s завершился неудачно: %s\n" #, fuzzy, c-format diff --git a/po/shadow.pot b/po/shadow.pot index 666060343c..add769f2bb 100644 --- a/po/shadow.pot +++ b/po/shadow.pot @@ -205,7 +205,7 @@ msgid "%s: Could not set caps\n" msgstr "" #, c-format -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "" #, c-format diff --git a/po/sk.po b/po/sk.po index bd632aedfc..1518c234eb 100644 --- a/po/sk.po +++ b/po/sk.po @@ -218,7 +218,7 @@ msgstr "Na konfiguračné údaje sa nedá vyhradiť dostatok miesta.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: nedá sa otvoriť súbor\n" #, fuzzy, c-format diff --git a/po/sq.po b/po/sq.po index 796c11755b..eb4983f8d4 100644 --- a/po/sq.po +++ b/po/sq.po @@ -206,7 +206,7 @@ msgid "%s: Could not set caps\n" msgstr "Kujdes: grup i panjohur %s\n" #, fuzzy, c-format -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "Kujdes: grup i panjohur %s\n" #, fuzzy, c-format diff --git a/po/sv.po b/po/sv.po index e7d79859b6..0a7d789d0b 100644 --- a/po/sv.po +++ b/po/sv.po @@ -231,7 +231,7 @@ msgstr "Kunde inte allokera plats för konfigurationsinformationen.\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: rad %d: chown %s misslyckades: %s\n" #, fuzzy, c-format diff --git a/po/tl.po b/po/tl.po index a104c11bb5..95a4aa1c49 100644 --- a/po/tl.po +++ b/po/tl.po @@ -219,7 +219,7 @@ msgstr "Hindi makapaglaan ng lugar para sa impormasyong pagsasaayos.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: hindi mabuksan ang talaksan\n" #, fuzzy, c-format diff --git a/po/tr.po b/po/tr.po index 91c2a541a7..e03d47648e 100644 --- a/po/tr.po +++ b/po/tr.po @@ -211,7 +211,7 @@ msgstr "Yapılandırma bilgileri için yer ayrılamadı.\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: dosya açılamıyor\n" #, fuzzy, c-format diff --git a/po/uk.po b/po/uk.po index 4fbb2eb82f..1dc3cfe2f4 100644 --- a/po/uk.po +++ b/po/uk.po @@ -235,7 +235,7 @@ msgstr "%s: не вдалося встановити можливості\n" #, fuzzy, c-format #| msgid "%s: snprintf failed!\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: помилка snprintf!\n" #, c-format diff --git a/po/vi.po b/po/vi.po index ac1663886f..9191e4b0b9 100644 --- a/po/vi.po +++ b/po/vi.po @@ -237,7 +237,7 @@ msgstr "Không thể đặt tên %s\n" #, fuzzy, c-format #| msgid "%s: line %d: chown %s failed: %s\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s: dòng %d: lỗi chown (thay đổi quyền sở hữu) %s: %s\n" #, fuzzy, c-format diff --git a/po/zh_CN.po b/po/zh_CN.po index d1efe715a1..7bcf8d0dee 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -213,7 +213,7 @@ msgstr "%s:无法设置上限\n" #, fuzzy, c-format #| msgid "%s: snprintf failed!\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s:snprintf 失败\n" #, c-format diff --git a/po/zh_TW.po b/po/zh_TW.po index be5782cfa1..cdd64d8568 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -224,7 +224,7 @@ msgstr "無法設定 %s 的名稱\n" #, fuzzy, c-format #| msgid "%s: can't open file\n" -msgid "%s: stpeprintf failed!\n" +msgid "%s: seprintf failed!\n" msgstr "%s:無法打開檔案\n" #, fuzzy, c-format diff --git a/src/chage.c b/src/chage.c index fffd22b994..906dc3aacf 100644 --- a/src/chage.c +++ b/src/chage.c @@ -29,7 +29,7 @@ #include "shadowio.h" #include "shadowlog.h" #include "string/memset/memzero.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" #include "string/strerrno.h" diff --git a/src/chfn.c b/src/chfn.c index 81e2a31bb8..dc00082587 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -35,7 +35,7 @@ #include "shadowlog.h" #include "sizeof.h" #include "sssd.h" -#include "string/sprintf/stpeprintf.h" +#include "string/sprintf/seprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" #include "string/strdup/strdup.h" @@ -653,12 +653,12 @@ int main (int argc, char **argv) /* Build the new GECOS field by plastering all the pieces together. */ p = new_gecos; e = new_gecos + countof(new_gecos); - p = stpeprintf(p, e, "%s", fullnm); - p = stpeprintf(p, e, ",%s", roomno); - p = stpeprintf(p, e, ",%s", workph); - p = stpeprintf(p, e, ",%s", homeph); + p = seprintf(p, e, "%s", fullnm); + p = seprintf(p, e, ",%s", roomno); + p = seprintf(p, e, ",%s", workph); + p = seprintf(p, e, ",%s", homeph); if (!streq(slop, "")) - p = stpeprintf(p, e, ",%s", slop); + p = seprintf(p, e, ",%s", slop); if (p == e || p == NULL) { fprintf (stderr, _("%s: fields too long\n"), Prog); diff --git a/src/gpasswd.c b/src/gpasswd.c index 14c8f4f609..0e4b13e2e3 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -36,7 +36,7 @@ #include "shadowlog.h" #include "sssd.h" #include "string/memset/memzero.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" #include "string/strdup/strdup.h" diff --git a/src/groupmod.c b/src/groupmod.c index ce265c8e43..d0e4ea6d2e 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -35,7 +35,7 @@ #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" #include "sssd.h" -#include "string/sprintf/stpeprintf.h" +#include "string/sprintf/seprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/stpecpy.h" #include "string/strdup/strdup.h" @@ -601,11 +601,11 @@ static void prepare_failure_reports (void) info_passwd.audit_msg = pw; pw_end = pw + 512; - gr = stpeprintf(gr, gr_end, "changing %s; ", gr_dbname ()); + gr = seprintf(gr, gr_end, "changing %s; ", gr_dbname()); #ifdef SHADOWGRP - sgr = stpeprintf(sgr, sgr_end, "changing %s; ", sgr_dbname ()); + sgr = seprintf(sgr, sgr_end, "changing %s; ", sgr_dbname()); #endif - pw = stpeprintf(pw, pw_end, "changing %s; ", pw_dbname ()); + pw = seprintf(pw, pw_end, "changing %s; ", pw_dbname()); info_group.action = gr; #ifdef SHADOWGRP @@ -613,14 +613,11 @@ static void prepare_failure_reports (void) #endif info_passwd.action = pw; - gr = stpeprintf(gr, gr_end, - "group %s/%ju", group_name, (uintmax_t) group_id); + gr = seprintf(gr, gr_end, "group %s/%ju", group_name, (uintmax_t) group_id); #ifdef SHADOWGRP - sgr = stpeprintf(sgr, sgr_end, - "group %s", group_name); + sgr = seprintf(sgr, sgr_end, "group %s", group_name); #endif - pw = stpeprintf(pw, pw_end, - "group %s/%ju", group_name, (uintmax_t) group_id); + pw = seprintf(pw, pw_end, "group %s/%ju", group_name, (uintmax_t) group_id); if (nflg) { gr = stpecpy(gr, gr_end, ", new name: "); @@ -640,10 +637,10 @@ static void prepare_failure_reports (void) } if (gflg) { gr = stpecpy(gr, gr_end, ", new gid: "); - stpeprintf(gr, gr_end, "%ju", (uintmax_t) group_newid); + seprintf(gr, gr_end, "%ju", (uintmax_t) group_newid); pw = stpecpy(pw, pw_end, ", new gid: "); - stpeprintf(pw, pw_end, "%ju", (uintmax_t) group_newid); + seprintf(pw, pw_end, "%ju", (uintmax_t) group_newid); } // FIXME: add a system cleanup diff --git a/src/login.c b/src/login.c index f5543796f3..2d951c34c3 100644 --- a/src/login.c +++ b/src/login.c @@ -40,7 +40,7 @@ #include "shadow/gshadow/endsgent.h" #include "shadowlog.h" #include "string/memset/memzero.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strneq.h" #include "string/strcmp/strprefix.h" diff --git a/src/newgrp.c b/src/newgrp.c index 5c4cc07b15..550dfd17ef 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -32,7 +32,7 @@ #include "shadow/gshadow/getsgnam.h" #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strdup/strdup.h" diff --git a/src/newusers.c b/src/newusers.c index 853218fd3e..1fb4514c4c 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -51,7 +51,7 @@ #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" #include "sssd.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" #include "string/strerrno.h" diff --git a/src/passwd.c b/src/passwd.c index 103393382b..ca4e142229 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -34,7 +34,7 @@ #include "sssd.h" #include "string/memset/memzero.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strcpy/strtcpy.h" diff --git a/src/useradd.c b/src/useradd.c index 330b52f8d5..7397933ac3 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -65,7 +65,7 @@ #include "sssd.h" #include "string/memset/memzero.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/strcaseeq.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/src/vipw.c b/src/vipw.c index cf574c9dba..180cc3d4ae 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -45,7 +45,7 @@ #include "sssd.h" #include "fs/mkstemp/fmkomstemp.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strerrno.h" diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 9c548240f2..1103e73d64 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -8,7 +8,7 @@ check_PROGRAMS = \ test_atoi_strtoi \ test_chkhash \ test_chkname \ - test_snprintf \ + test_stprintf \ test_strncpy \ test_strtcpy \ test_typetraits \ @@ -93,16 +93,16 @@ test_logind_LDADD = \ $(LIBSYSTEMD) \ $(NULL) -test_snprintf_SOURCES = \ - ../../lib/string/sprintf/snprintf.c \ - test_snprintf.c \ +test_stprintf_SOURCES = \ + ../../lib/string/sprintf/stprintf.c \ + test_stprintf.c \ $(NULL) -test_snprintf_CFLAGS = \ +test_stprintf_CFLAGS = \ $(AM_CFLAGS) \ $(NULL) -test_snprintf_LDFLAGS = \ +test_stprintf_LDFLAGS = \ $(NULL) -test_snprintf_LDADD = \ +test_stprintf_LDADD = \ $(CMOCKA_LIBS) \ $(NULL) diff --git a/tests/unit/test_snprintf.c b/tests/unit/test_stprintf.c similarity index 97% rename from tests/unit/test_snprintf.c rename to tests/unit/test_stprintf.c index df77891432..8d61267771 100644 --- a/tests/unit/test_snprintf.c +++ b/tests/unit/test_stprintf.c @@ -14,7 +14,7 @@ #include #include "sizeof.h" -#include "string/sprintf/snprintf.h" +#include "string/sprintf/stprintf.h" static void test_stprintf_a_trunc(void **);