* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h, lib/commonio.h, lib/prototypes.h: Added splint annotations.
This commit is contained in:
parent
aebddca35d
commit
2c0f3ef707
@ -1,6 +1,9 @@
|
||||
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/utmp.c: Added splint annotations.
|
||||
* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
|
||||
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c,
|
||||
lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h,
|
||||
lib/commonio.h, lib/prototypes.h: Added splint annotations.
|
||||
|
||||
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ int commonio_remove (struct commonio_db *db, const char *name)
|
||||
*
|
||||
* Otherwise, it returns NULL.
|
||||
*/
|
||||
const void *commonio_locate (struct commonio_db *db, const char *name)
|
||||
/*@null@*/const void *commonio_locate (struct commonio_db *db, const char *name)
|
||||
{
|
||||
struct commonio_entry *p;
|
||||
|
||||
@ -1062,7 +1062,7 @@ int commonio_rewind (struct commonio_db *db)
|
||||
*
|
||||
* It returns the next entry, or NULL if no other entries could be found.
|
||||
*/
|
||||
const void *commonio_next (struct commonio_db *db)
|
||||
/*@null@*/const void *commonio_next (struct commonio_db *db)
|
||||
{
|
||||
void *eptr;
|
||||
|
||||
|
@ -44,9 +44,9 @@
|
||||
* Linked list entry.
|
||||
*/
|
||||
struct commonio_entry {
|
||||
char *line;
|
||||
void *eptr; /* struct passwd, struct spwd, ... */
|
||||
struct commonio_entry *prev, *next;
|
||||
/*@null@*/char *line;
|
||||
/*@null@*/void *eptr; /* struct passwd, struct spwd, ... */
|
||||
/*@null@*/struct commonio_entry *prev, *next;
|
||||
bool changed:1;
|
||||
};
|
||||
|
||||
@ -63,7 +63,7 @@ struct commonio_ops {
|
||||
/*
|
||||
* free() the object including any strings pointed by it.
|
||||
*/
|
||||
void (*free) (void *);
|
||||
void (*free) (/*@out@*/ /*@only@*/void *);
|
||||
|
||||
/*
|
||||
* Return the name of the object (for example, pw_name
|
||||
@ -96,8 +96,8 @@ struct commonio_ops {
|
||||
* is open or before it is closed.
|
||||
* They return 0 on failure and 1 on success.
|
||||
*/
|
||||
int (*open_hook) (void);
|
||||
int (*close_hook) (void);
|
||||
/*@null@*/int (*open_hook) (void);
|
||||
/*@null@*/int (*close_hook) (void);
|
||||
};
|
||||
|
||||
/*
|
||||
@ -117,7 +117,7 @@ struct commonio_db {
|
||||
/*
|
||||
* Currently open file stream.
|
||||
*/
|
||||
FILE *fp;
|
||||
/*@null@*/FILE *fp;
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
security_context_t scontext;
|
||||
@ -125,7 +125,7 @@ struct commonio_db {
|
||||
/*
|
||||
* Head, tail, current position in linked list.
|
||||
*/
|
||||
struct commonio_entry *head, *tail, *cursor;
|
||||
/*@null@*/struct commonio_entry *head, *tail, *cursor;
|
||||
|
||||
/*
|
||||
* Various flags.
|
||||
@ -141,11 +141,11 @@ extern bool commonio_present (const struct commonio_db *db);
|
||||
extern int commonio_lock (struct commonio_db *);
|
||||
extern int commonio_lock_nowait (struct commonio_db *);
|
||||
extern int commonio_open (struct commonio_db *, int);
|
||||
extern const void *commonio_locate (struct commonio_db *, const char *);
|
||||
extern /*@null@*/const void *commonio_locate (struct commonio_db *, const char *);
|
||||
extern int commonio_update (struct commonio_db *, const void *);
|
||||
extern int commonio_remove (struct commonio_db *, const char *);
|
||||
extern int commonio_rewind (struct commonio_db *);
|
||||
extern const void *commonio_next (struct commonio_db *);
|
||||
extern /*@null@*/const void *commonio_next (struct commonio_db *);
|
||||
extern int commonio_close (struct commonio_db *);
|
||||
extern int commonio_unlock (struct commonio_db *);
|
||||
extern void commonio_del_entry (struct commonio_db *,
|
||||
|
@ -55,7 +55,7 @@ static void *group_dup (const void *ent)
|
||||
return __gr_dup (gr);
|
||||
}
|
||||
|
||||
static void group_free (void *ent)
|
||||
static void group_free (/*@out@*/ /*@only@*/void *ent)
|
||||
{
|
||||
struct group *gr = ent;
|
||||
|
||||
@ -125,7 +125,7 @@ int gr_setdbname (const char *filename)
|
||||
return commonio_setname (&group_db, filename);
|
||||
}
|
||||
|
||||
const char *gr_dbname (void)
|
||||
/*@observer@*/const char *gr_dbname (void)
|
||||
{
|
||||
return group_db.filename;
|
||||
}
|
||||
@ -140,12 +140,12 @@ int gr_open (int mode)
|
||||
return commonio_open (&group_db, mode);
|
||||
}
|
||||
|
||||
const struct group *gr_locate (const char *name)
|
||||
/*@null@*/const struct group *gr_locate (const char *name)
|
||||
{
|
||||
return commonio_locate (&group_db, name);
|
||||
}
|
||||
|
||||
const struct group *gr_locate_gid (gid_t gid)
|
||||
/*@null@*/const struct group *gr_locate_gid (gid_t gid)
|
||||
{
|
||||
const struct group *grp;
|
||||
|
||||
@ -172,7 +172,7 @@ int gr_rewind (void)
|
||||
return commonio_rewind (&group_db);
|
||||
}
|
||||
|
||||
const struct group *gr_next (void)
|
||||
/*@null@*/const struct group *gr_next (void)
|
||||
{
|
||||
return commonio_next (&group_db);
|
||||
}
|
||||
@ -192,7 +192,7 @@ void __gr_set_changed (void)
|
||||
group_db.changed = true;
|
||||
}
|
||||
|
||||
struct commonio_entry *__gr_get_head (void)
|
||||
/*@null@*/struct commonio_entry *__gr_get_head (void)
|
||||
{
|
||||
return group_db.head;
|
||||
}
|
||||
|
@ -39,12 +39,12 @@
|
||||
#include <grp.h>
|
||||
|
||||
extern int gr_close (void);
|
||||
extern const struct group *gr_locate (const char *name);
|
||||
extern const struct group *gr_locate_gid (gid_t gid);
|
||||
extern /*@null@*/const struct group *gr_locate (const char *name);
|
||||
extern /*@null@*/const struct group *gr_locate_gid (gid_t gid);
|
||||
extern int gr_lock (void);
|
||||
extern int gr_setdbname (const char *filename);
|
||||
extern const char *gr_dbname (void);
|
||||
extern const struct group *gr_next (void);
|
||||
extern /*@observer@*/const char *gr_dbname (void);
|
||||
extern /*@null@*/const struct group *gr_next (void);
|
||||
extern int gr_open (int mode);
|
||||
extern int gr_remove (const char *name);
|
||||
extern int gr_rewind (void);
|
||||
|
@ -65,7 +65,7 @@ extern int add_groups (const char *);
|
||||
#endif
|
||||
|
||||
/* age.c */
|
||||
extern void agecheck (const struct spwd *);
|
||||
extern void agecheck (/*@null@*/const struct spwd *);
|
||||
extern int expire (const struct passwd *, const struct spwd *);
|
||||
extern int isexpired (const struct passwd *, const struct spwd *);
|
||||
|
||||
@ -168,12 +168,12 @@ extern int fputsx (const char *, FILE *);
|
||||
/* groupio.c */
|
||||
extern void __gr_del_entry (const struct commonio_entry *ent);
|
||||
extern struct commonio_db *__gr_get_db (void);
|
||||
extern struct commonio_entry *__gr_get_head (void);
|
||||
extern /*@null@*/struct commonio_entry *__gr_get_head (void);
|
||||
extern void __gr_set_changed (void);
|
||||
|
||||
/* groupmem.c */
|
||||
extern struct group *__gr_dup (const struct group *grent);
|
||||
extern void gr_free (struct group *grent);
|
||||
extern /*@null@*/ /*@only@*/struct group *__gr_dup (const struct group *grent);
|
||||
extern void gr_free (/*@out@*/ /*@only@*/struct group *grent);
|
||||
|
||||
/* hushed.c */
|
||||
extern bool hushed (const char *username);
|
||||
@ -255,11 +255,11 @@ extern void pwd_init (void);
|
||||
/* pwio.c */
|
||||
extern void __pw_del_entry (const struct commonio_entry *ent);
|
||||
extern struct commonio_db *__pw_get_db (void);
|
||||
extern struct commonio_entry *__pw_get_head (void);
|
||||
extern /*@null@*/struct commonio_entry *__pw_get_head (void);
|
||||
|
||||
/* pwmem.c */
|
||||
extern struct passwd *__pw_dup (const struct passwd *pwent);
|
||||
extern void pw_free (struct passwd *pwent);
|
||||
extern /*@null@*/ /*@only@*/struct passwd *__pw_dup (const struct passwd *pwent);
|
||||
extern void pw_free (/*@out@*/ /*@only@*/struct passwd *pwent);
|
||||
|
||||
/* rlogin.c */
|
||||
extern int do_rlogin (const char *remote_host, char *name, size_t namelen,
|
||||
@ -291,26 +291,26 @@ extern struct passwd *sgetpwent (const char *buf);
|
||||
|
||||
/* sgetspent.c */
|
||||
#ifndef HAVE_SGETSPENT
|
||||
extern struct spwd *sgetspent (const char *string)
|
||||
extern struct spwd *sgetspent (const char *string);
|
||||
#endif
|
||||
|
||||
/* 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 /*@null@*/ /*@only@*/struct sgrp *__sgr_dup (const struct sgrp *sgent);
|
||||
extern void sgr_free (/*@out@*/ /*@only@*/struct sgrp *sgent);
|
||||
extern /*@null@*/struct commonio_entry *__sgr_get_head (void);
|
||||
extern void __sgr_set_changed (void);
|
||||
|
||||
/* shadowio.c */
|
||||
extern struct commonio_entry *__spw_get_head (void);
|
||||
extern /*@null@*/struct commonio_entry *__spw_get_head (void);
|
||||
extern void __spw_del_entry (const struct commonio_entry *ent);
|
||||
|
||||
/* shadowmem.c */
|
||||
extern struct spwd *__spw_dup (const struct spwd *spent);
|
||||
extern void spw_free (struct spwd *spent);
|
||||
extern /*@null@*/ /*@only@*/struct spwd *__spw_dup (const struct spwd *spent);
|
||||
extern void spw_free (/*@out@*/ /*@only@*/struct spwd *spent);
|
||||
|
||||
/* shell.c */
|
||||
extern int shell (const char *, const char *, char *const *);
|
||||
extern int shell (const char *file, /*@null@*/const char *arg, char *const envp[]);
|
||||
|
||||
/* system.c */
|
||||
extern int safe_system (const char *command,
|
||||
@ -345,17 +345,17 @@ extern char *tz (const char *);
|
||||
extern int set_filesize_limit (int blocks);
|
||||
|
||||
/* utmp.c */
|
||||
extern struct utmp *get_current_utmp (void);
|
||||
extern /*@null@*/struct utmp *get_current_utmp (void);
|
||||
extern struct utmp *prepare_utmp (const char *name,
|
||||
const char *line,
|
||||
const char *host,
|
||||
struct utmp *ut);
|
||||
/*@null@*/const struct utmp *ut);
|
||||
extern int setutmp (struct utmp *ut);
|
||||
#ifdef HAVE_UTMPX_H
|
||||
extern struct utmpx *prepare_utmpx (const char *name,
|
||||
const char *line,
|
||||
const char *host,
|
||||
struct utmp *ut);
|
||||
/*@null@*/const struct utmp *ut);
|
||||
extern int setutmpx (struct utmpx *utx);
|
||||
#endif
|
||||
|
||||
@ -363,8 +363,8 @@ extern int setutmpx (struct utmpx *utx);
|
||||
extern bool valid (const char *, const struct passwd *);
|
||||
|
||||
/* xmalloc.c */
|
||||
extern char *xmalloc (size_t);
|
||||
extern char *xstrdup (const char *);
|
||||
extern /*@maynotreturn@*/ /*@only@*/char *xmalloc (size_t);
|
||||
extern /*@maynotreturn@*/ /*@only@*/char *xstrdup (const char *);
|
||||
|
||||
/* xgetpwnam.c */
|
||||
extern struct passwd *xgetpwnam (const char *);
|
||||
|
@ -49,7 +49,7 @@ static void *passwd_dup (const void *ent)
|
||||
return __pw_dup (pw);
|
||||
}
|
||||
|
||||
static void passwd_free (void *ent)
|
||||
static void passwd_free (/*@out@*/ /*@only@*/void *ent)
|
||||
{
|
||||
struct passwd *pw = ent;
|
||||
|
||||
@ -108,7 +108,7 @@ int pw_setdbname (const char *filename)
|
||||
return commonio_setname (&passwd_db, filename);
|
||||
}
|
||||
|
||||
const char *pw_dbname (void)
|
||||
/*@observer@*/const char *pw_dbname (void)
|
||||
{
|
||||
return passwd_db.filename;
|
||||
}
|
||||
@ -170,7 +170,7 @@ int pw_unlock (void)
|
||||
return commonio_unlock (&passwd_db);
|
||||
}
|
||||
|
||||
struct commonio_entry *__pw_get_head (void)
|
||||
/*@null@*/struct commonio_entry *__pw_get_head (void)
|
||||
{
|
||||
return passwd_db.head;
|
||||
}
|
||||
|
@ -39,12 +39,12 @@
|
||||
#include <pwd.h>
|
||||
|
||||
extern int pw_close (void);
|
||||
extern const struct passwd *pw_locate (const char *name);
|
||||
extern const struct passwd *pw_locate_uid (uid_t uid);
|
||||
extern /*@null@*/const struct passwd *pw_locate (const char *name);
|
||||
extern /*@null@*/const struct passwd *pw_locate_uid (uid_t uid);
|
||||
extern int pw_lock (void);
|
||||
extern int pw_setdbname (const char *filename);
|
||||
extern const char *pw_dbname (void);
|
||||
extern const struct passwd *pw_next (void);
|
||||
extern /*@observer@*/const char *pw_dbname (void);
|
||||
extern /*@null@*/const struct passwd *pw_next (void);
|
||||
extern int pw_open (int mode);
|
||||
extern int pw_remove (const char *name);
|
||||
extern int pw_rewind (void);
|
||||
|
@ -97,14 +97,14 @@ static void *gshadow_dup (const void *ent)
|
||||
return __sgr_dup (sg);
|
||||
}
|
||||
|
||||
static void gshadow_free (void *ent)
|
||||
static void gshadow_free (/*@out@*/ /*@only@*/void *ent)
|
||||
{
|
||||
struct sgrp *sg = ent;
|
||||
|
||||
sgr_free (sg);
|
||||
}
|
||||
|
||||
void sgr_free (struct sgrp *sgent)
|
||||
void sgr_free (/*@out@*/ /*@only@*/struct sgrp *sgent)
|
||||
{
|
||||
free (sgent->sg_name);
|
||||
memzero (sgent->sg_passwd, strlen (sgent->sg_passwd));
|
||||
@ -172,7 +172,7 @@ int sgr_setdbname (const char *filename)
|
||||
return commonio_setname (&gshadow_db, filename);
|
||||
}
|
||||
|
||||
const char *sgr_dbname (void)
|
||||
/*@observer@*/const char *sgr_dbname (void)
|
||||
{
|
||||
return gshadow_db.filename;
|
||||
}
|
||||
@ -212,7 +212,7 @@ int sgr_rewind (void)
|
||||
return commonio_rewind (&gshadow_db);
|
||||
}
|
||||
|
||||
const struct sgrp *sgr_next (void)
|
||||
/*@null@*/const struct sgrp *sgr_next (void)
|
||||
{
|
||||
return commonio_next (&gshadow_db);
|
||||
}
|
||||
@ -232,7 +232,7 @@ void __sgr_set_changed (void)
|
||||
gshadow_db.changed = true;
|
||||
}
|
||||
|
||||
struct commonio_entry *__sgr_get_head (void)
|
||||
/*@null@*/struct commonio_entry *__sgr_get_head (void)
|
||||
{
|
||||
return gshadow_db.head;
|
||||
}
|
||||
|
@ -37,11 +37,11 @@
|
||||
|
||||
extern int sgr_close (void);
|
||||
extern bool sgr_file_present (void);
|
||||
extern const struct sgrp *sgr_locate (const char *name);
|
||||
extern /*@null@*/const struct sgrp *sgr_locate (const char *name);
|
||||
extern int sgr_lock (void);
|
||||
extern int sgr_setdbname (const char *filename);
|
||||
extern const char *sgr_dbname (void);
|
||||
extern const struct sgrp *sgr_next (void);
|
||||
extern /*@observer@*/const char *sgr_dbname (void);
|
||||
extern /*@null@*/const struct sgrp *sgr_next (void);
|
||||
extern int sgr_open (int mode);
|
||||
extern int sgr_remove (const char *name);
|
||||
extern int sgr_rewind (void);
|
||||
|
@ -49,7 +49,7 @@ static void *shadow_dup (const void *ent)
|
||||
return __spw_dup (sp);
|
||||
}
|
||||
|
||||
static void shadow_free (void *ent)
|
||||
static void shadow_free (/*@out*//*@only@*/void *ent)
|
||||
{
|
||||
struct spwd *sp = ent;
|
||||
|
||||
@ -108,7 +108,7 @@ int spw_setdbname (const char *filename)
|
||||
return commonio_setname (&shadow_db, filename);
|
||||
}
|
||||
|
||||
const char *spw_dbname (void)
|
||||
/*@observer@*/const char *spw_dbname (void)
|
||||
{
|
||||
return shadow_db.filename;
|
||||
}
|
||||
@ -128,7 +128,7 @@ int spw_open (int mode)
|
||||
return commonio_open (&shadow_db, mode);
|
||||
}
|
||||
|
||||
const struct spwd *spw_locate (const char *name)
|
||||
/*@null@*/const struct spwd *spw_locate (const char *name)
|
||||
{
|
||||
return commonio_locate (&shadow_db, name);
|
||||
}
|
||||
@ -148,7 +148,7 @@ int spw_rewind (void)
|
||||
return commonio_rewind (&shadow_db);
|
||||
}
|
||||
|
||||
const struct spwd *spw_next (void)
|
||||
/*@null@*/const struct spwd *spw_next (void)
|
||||
{
|
||||
return commonio_next (&shadow_db);
|
||||
}
|
||||
|
@ -38,11 +38,11 @@
|
||||
|
||||
extern int spw_close (void);
|
||||
extern bool spw_file_present (void);
|
||||
extern const struct spwd *spw_locate (const char *name);
|
||||
extern /*@null@*/const struct spwd *spw_locate (const char *name);
|
||||
extern int spw_lock (void);
|
||||
extern int spw_setdbname (const char *filename);
|
||||
extern const char *spw_dbname (void);
|
||||
extern const struct spwd *spw_next (void);
|
||||
extern /*@observer@*/const char *spw_dbname (void);
|
||||
extern /*@null@*/const struct spwd *spw_next (void);
|
||||
extern int spw_open (int mode);
|
||||
extern int spw_remove (const char *name);
|
||||
extern int spw_rewind (void);
|
||||
|
@ -160,7 +160,7 @@ int expire (const struct passwd *pw, const struct spwd *sp)
|
||||
* to expire and warns the user of the pending password expiration.
|
||||
*/
|
||||
|
||||
void agecheck (const struct spwd *sp)
|
||||
void agecheck (/*@null@*/const struct spwd *sp)
|
||||
{
|
||||
long now = (long) time ((time_t *) 0) / SCALE;
|
||||
long remain;
|
||||
|
@ -53,7 +53,7 @@ extern size_t newenvc;
|
||||
* the file. If all that fails, give up in disgust ...
|
||||
*/
|
||||
|
||||
int shell (const char *file, const char *arg, char *const envp[])
|
||||
int shell (const char *file, /*@null@*/const char *arg, char *const envp[])
|
||||
{
|
||||
char arg0[1024];
|
||||
int err;
|
||||
|
@ -98,7 +98,7 @@ static bool is_my_tty (const char *tty)
|
||||
*
|
||||
* Return NULL if no entries exist in utmp for the current process.
|
||||
*/
|
||||
/*@null@*//*@only@*/struct utmp *get_current_utmp (void)
|
||||
/*@null@*/ /*@only@*/struct utmp *get_current_utmp (void)
|
||||
{
|
||||
struct utmp *ut;
|
||||
struct utmp *ret = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user