This name better reflects that it handles arrays, and doesn't shout.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
char tempbuf[1024];
/* init things */
- MEMZERO(buf);
- MEMZERO(name);
- MEMZERO(limits);
- MEMZERO(deflimits);
- MEMZERO(tempbuf);
+ memzero_a(buf);
+ memzero_a(name);
+ memzero_a(limits);
+ memzero_a(deflimits);
+ memzero_a(tempbuf);
/* start the checks */
fil = fopen (LIMITS_FILE, "r");
if (strprefix(buf, "#") || strprefix(buf, "\n")) {
continue;
}
- MEMZERO(tempbuf);
+ memzero_a(tempbuf);
/* a valid line should have a username, then spaces,
* then limits
* we allow the format:
* removed.
*/
- MEMZERO(buf);
+ memzero_a(buf);
if (fgets (buf, sizeof buf, stdin) != buf) {
exit (EXIT_FAILURE);
}
memzero()
Synonym of explicit_bzero(3).
- MEMZERO()
+ memzero_a()
Like memzero(), but takes an array.
strzero()
#include "sizeof.h"
-#define MEMZERO(arr) memzero(arr, sizeof_a(arr))
+// memzero_a - memory zero (explicit) array
+#define memzero_a(arr) memzero(arr, sizeof_a(arr))
inline void *memzero(void *ptr, size_t size);
inline char *strzero(char *s);
+// memzero - memory zero (explicit)
inline void *
memzero(void *ptr, size_t size)
{
}
+// strzero - string zero (explicit)
inline char *
strzero(char *s)
{
erase_pass (cp);
cp = agetpass (_("Re-enter new password: "));
if (NULL == cp) {
- MEMZERO(pass);
+ memzero_a(pass);
exit (1);
}
}
erase_pass (cp);
- MEMZERO(pass);
+ memzero_a(pass);
if (retries + 1 < RETRIES) {
puts (_("They don't match; try again"));
salt = crypt_make_salt (NULL, NULL);
cp = pw_encrypt (pass, salt);
- MEMZERO(pass);
+ memzero_a(pass);
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
erase_pass (cp);
if (ret == -1) {
(void) fputs (_("Password is too long.\n"), stderr);
- MEMZERO(pass);
+ memzero_a(pass);
return -1;
}
} else {
for (i = getdef_num ("PASS_CHANGE_TRIES", 5); i > 0; i--) {
cp = agetpass (_("New password: "));
if (NULL == cp) {
- MEMZERO(orig);
- MEMZERO(pass);
+ memzero_a(orig);
+ memzero_a(pass);
return -1;
}
if (warned && !streq(pass, cp)) {
erase_pass (cp);
if (ret == -1) {
(void) fputs (_("Password is too long.\n"), stderr);
- MEMZERO(orig);
- MEMZERO(pass);
+ memzero_a(orig);
+ memzero_a(pass);
return -1;
}
}
cp = agetpass (_("Re-enter new password: "));
if (NULL == cp) {
- MEMZERO(orig);
- MEMZERO(pass);
+ memzero_a(orig);
+ memzero_a(pass);
return -1;
}
if (!streq(cp, pass)) {
break;
}
}
- MEMZERO(orig);
+ memzero_a(orig);
if (i == 0) {
- MEMZERO(pass);
+ memzero_a(pass);
return -1;
}
}
*/
salt = crypt_make_salt (NULL, NULL);
cp = pw_encrypt (pass, salt);
- MEMZERO(pass);
+ memzero_a(pass);
if (NULL == cp) {
fprintf (stderr,