* lib/shadowio.c: Use spw_free() for shadow_free().
* lib/groupmem.c: Added gr_free().
* lib/groupio.c: Use gr_free() for group_free().
* lib/pwmem.c: Include define.h before prototypes.h
* lib/pwmem.c: Added pw_free().
* lib/pwio.c: Use pw_free() for passwd_free().
* lib/sgroupio.c: Added sgr_free().
* lib/sgroupio.c: Use sgr_free() for gshadow_free().
* lib/prototypes.h: Added gr_free(), pw_free(), sgr_free(),
spw_free().
+2009-04-21 Nicolas François <nicolas.francois@centraliens.net>
+
+ * lib/shadowmem.c: Added spw_free().
+ * lib/shadowio.c: Use spw_free() for shadow_free().
+ * lib/groupmem.c: Added gr_free().
+ * lib/groupio.c: Use gr_free() for group_free().
+ * lib/pwmem.c: Include define.h before prototypes.h
+ * lib/pwmem.c: Added pw_free().
+ * lib/pwio.c: Use pw_free() for passwd_free().
+ * lib/sgroupio.c: Added sgr_free().
+ * lib/sgroupio.c: Use sgr_free() for gshadow_free().
+ * lib/prototypes.h: Added gr_free(), pw_free(), sgr_free(),
+ spw_free().
+
2009-04-21 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/shell.c: Add brackets and parenthesis.
{
struct group *gr = ent;
- free (gr->gr_name);
- memzero (gr->gr_passwd, strlen (gr->gr_passwd));
- free (gr->gr_passwd);
- while (*(gr->gr_mem)) {
- free (*(gr->gr_mem));
- gr->gr_mem++;
- }
- free (gr);
+ gr_free (gr);
}
static const char *group_getname (const void *ent)
return gr;
}
+void gr_free (struct group *grent)
+{
+ free (grent->gr_name);
+ memzero (grent->gr_passwd, strlen (grent->gr_passwd));
+ free (grent->gr_passwd);
+ while (*(grent->gr_mem)) {
+ free (*(grent->gr_mem));
+ grent->gr_mem++;
+ }
+ free (grent);
+}
+
/* groupmem.c */
extern struct group *__gr_dup (const struct group *grent);
+extern void gr_free (struct group *grent);
/* hushed.c */
extern bool hushed (const char *username);
/* pwmem.c */
extern struct passwd *__pw_dup (const struct passwd *pwent);
+extern void pw_free (struct passwd *pwent);
/* rlogin.c */
extern int do_rlogin (const char *remote_host, char *name, size_t namelen,
/* sgroupio.c */
extern void __sgr_del_entry (const struct commonio_entry *ent);
extern struct sgrp *__sgr_dup (const struct sgrp *sgent);
+extern void sgr_free (struct sgrp *sgent);
extern struct commonio_entry *__sgr_get_head (void);
extern void __sgr_set_changed (void);
/* shadowmem.c */
extern struct spwd *__spw_dup (const struct spwd *spent);
+extern void spw_free (struct spwd *spent);
/* shell.c */
extern int shell (const char *, const char *, char *const *);
{
struct passwd *pw = ent;
- free (pw->pw_name);
- memzero (pw->pw_passwd, strlen (pw->pw_passwd));
- free (pw->pw_passwd);
- free (pw->pw_gecos);
- free (pw->pw_dir);
- free (pw->pw_shell);
- free (pw);
+ pw_free (pw);
}
static const char *passwd_getname (const void *ent)
#ident "$Id$"
#include <stdio.h>
-#include "prototypes.h"
#include "defines.h"
+#include "prototypes.h"
#include "pwio.h"
struct passwd *__pw_dup (const struct passwd *pwent)
return pw;
}
+void pw_free (struct passwd *pwent)
+{
+ free (pwent->pw_name);
+ memzero (pwent->pw_passwd, strlen (pwent->pw_passwd));
+ free (pwent->pw_passwd);
+ free (pwent->pw_gecos);
+ free (pwent->pw_dir);
+ free (pwent->pw_shell);
+ free (pwent);
+}
+
{
struct sgrp *sg = ent;
- free (sg->sg_name);
- memzero (sg->sg_passwd, strlen (sg->sg_passwd));
- free (sg->sg_passwd);
- while (NULL != *(sg->sg_adm)) {
- free (*(sg->sg_adm));
- sg->sg_adm++;
+ sgr_free (sg);
+}
+
+void sgr_free (struct sgrp *sgent)
+{
+ free (sgent->sg_name);
+ memzero (sgent->sg_passwd, strlen (sgent->sg_passwd));
+ free (sgent->sg_passwd);
+ while (NULL != *(sgent->sg_adm)) {
+ free (*(sgent->sg_adm));
+ sgent->sg_adm++;
}
- while (NULL != *(sg->sg_mem)) {
- free (*(sg->sg_mem));
- sg->sg_mem++;
+ while (NULL != *(sgent->sg_mem)) {
+ free (*(sgent->sg_mem));
+ sgent->sg_mem++;
}
- free (sg);
+ free (sgent);
}
static const char *gshadow_getname (const void *ent)
{
struct spwd *sp = ent;
- free (sp->sp_namp);
- memzero (sp->sp_pwdp, strlen (sp->sp_pwdp));
- free (sp->sp_pwdp);
- free (sp);
+ spw_free (sp);
}
static const char *shadow_getname (const void *ent)
return sp;
}
+void spw_free (struct spwd *spent)
+{
+ free (spent->sp_namp);
+ memzero (spent->sp_pwdp, strlen (spent->sp_pwdp));
+ free (spent->sp_pwdp);
+ free (spent);
+}
+