src/: Use xasprintf() instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
44ba094766
commit
d9923431eb
+2
-3
@@ -21,6 +21,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "string/sprintf/xasprintf.h"
|
||||||
|
|
||||||
#if WITH_LIBBSD == 0
|
#if WITH_LIBBSD == 0
|
||||||
#include "freezero.h"
|
#include "freezero.h"
|
||||||
@@ -99,9 +100,7 @@ static /*@observer@*//*@null@*/const char *password_check (
|
|||||||
|
|
||||||
newmono = str_lower (xstrdup (new));
|
newmono = str_lower (xstrdup (new));
|
||||||
oldmono = str_lower (xstrdup (old));
|
oldmono = str_lower (xstrdup (old));
|
||||||
wrapped = XMALLOC(strlen(oldmono) * 2 + 1, char);
|
xasprintf(&wrapped, "%s%s", oldmono, oldmono);
|
||||||
strcpy (wrapped, oldmono);
|
|
||||||
strcat (wrapped, oldmono);
|
|
||||||
|
|
||||||
if (palindrome (oldmono, newmono)) {
|
if (palindrome (oldmono, newmono)) {
|
||||||
msg = _("a palindrome");
|
msg = _("a palindrome");
|
||||||
|
|||||||
+3
-4
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include "agetpass.h"
|
#include "agetpass.h"
|
||||||
#include "alloc.h"
|
|
||||||
#include "atoi/str2i.h"
|
#include "atoi/str2i.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
@@ -34,6 +33,7 @@
|
|||||||
#include "pwio.h"
|
#include "pwio.h"
|
||||||
#include "shadowio.h"
|
#include "shadowio.h"
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
|
#include "string/sprintf/xasprintf.h"
|
||||||
#include "string/strcpy/strtcpy.h"
|
#include "string/strcpy/strtcpy.h"
|
||||||
#include "time/day_to_str.h"
|
#include "time/day_to_str.h"
|
||||||
|
|
||||||
@@ -532,10 +532,9 @@ static char *update_crypt_pw (char *cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lflg && *cp != '!') {
|
if (lflg && *cp != '!') {
|
||||||
char *newpw = XMALLOC(strlen(cp) + 2, char);
|
char *newpw;
|
||||||
|
|
||||||
strcpy (newpw, "!");
|
xasprintf(&newpw, "!%s", cp);
|
||||||
strcat (newpw, cp);
|
|
||||||
if (!use_pam)
|
if (!use_pam)
|
||||||
{
|
{
|
||||||
if (do_update_pwd) {
|
if (do_update_pwd) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
#include "exitcodes.h"
|
#include "exitcodes.h"
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
#include "string/sprintf/snprintf.h"
|
#include "string/sprintf/snprintf.h"
|
||||||
|
#include "string/sprintf/xasprintf.h"
|
||||||
#include "string/strcpy/strtcpy.h"
|
#include "string/strcpy/strtcpy.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -1201,17 +1202,14 @@ int main (int argc, char **argv)
|
|||||||
* case they will be provided to the new user's shell as arguments.
|
* case they will be provided to the new user's shell as arguments.
|
||||||
*/
|
*/
|
||||||
if (fakelogin) {
|
if (fakelogin) {
|
||||||
char *arg0;
|
char *arg0;
|
||||||
|
|
||||||
cp = getdef_str ("SU_NAME");
|
cp = getdef_str ("SU_NAME");
|
||||||
if (NULL == cp) {
|
if (NULL == cp) {
|
||||||
cp = Basename (shellstr);
|
cp = Basename (shellstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg0 = XMALLOC(strlen(cp) + 2, char);
|
xasprintf(&arg0, "-%s", cp);
|
||||||
arg0[0] = '-';
|
|
||||||
strcpy (arg0 + 1, cp);
|
|
||||||
cp = arg0;
|
|
||||||
} else {
|
} else {
|
||||||
cp = Basename (shellstr);
|
cp = Basename (shellstr);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -412,15 +412,14 @@ usage (int status)
|
|||||||
static char *new_pw_passwd (char *pw_pass)
|
static char *new_pw_passwd (char *pw_pass)
|
||||||
{
|
{
|
||||||
if (Lflg && ('!' != pw_pass[0])) {
|
if (Lflg && ('!' != pw_pass[0])) {
|
||||||
char *buf = XMALLOC(strlen(pw_pass) + 2, char);
|
char *buf;
|
||||||
|
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"updating passwd", user_newname, user_newid, 0);
|
"updating passwd", user_newname, user_newid, 0);
|
||||||
#endif
|
#endif
|
||||||
SYSLOG ((LOG_INFO, "lock user '%s' password", user_newname));
|
SYSLOG ((LOG_INFO, "lock user '%s' password", user_newname));
|
||||||
strcpy (buf, "!");
|
xasprintf(&buf, "!%s", pw_pass);
|
||||||
strcat (buf, pw_pass);
|
|
||||||
pw_pass = buf;
|
pw_pass = buf;
|
||||||
} else if (Uflg && pw_pass[0] == '!') {
|
} else if (Uflg && pw_pass[0] == '!') {
|
||||||
if (pw_pass[1] == '\0') {
|
if (pw_pass[1] == '\0') {
|
||||||
|
|||||||
Reference in New Issue
Block a user