From 6e357e14fc0ff5a7e00590debd1b0bbc2f95f245 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Thu, 23 Apr 2009 21:19:02 +0000 Subject: [PATCH] * lib/commonio.c, lib/commonio.h, lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h, lib/shadowio.c, lib/shadowio.h: Added splint annotations. The *_locate() and *_next() functions currently return an observer. As the structure are often modified by the caller, it could maybe be changed to exposed later. (and non-const). --- ChangeLog | 9 +++++++++ lib/commonio.c | 6 +++--- lib/commonio.h | 4 ++-- lib/groupio.c | 6 +++--- lib/groupio.h | 6 +++--- lib/pwio.c | 6 +++--- lib/pwio.h | 6 +++--- lib/shadowio.c | 4 ++-- lib/shadowio.h | 4 ++-- 9 files changed, 30 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 369c68fb..07d1ca6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-04-22 Nicolas François + + * lib/commonio.c, lib/commonio.h, lib/groupio.c, lib/groupio.h, + lib/pwio.c, lib/pwio.h, lib/shadowio.c, lib/shadowio.h: Added + splint annotations. The *_locate() and *_next() functions + currently return an observer. As the structure are often modified + by the caller, it could maybe be changed to exposed later. (and + non-const) + 2009-04-22 Nicolas François * lib/pwauth.c: Use a boolean for wipe_clear_pass and use_skey. diff --git a/lib/commonio.c b/lib/commonio.c index 77e46a95..5cfd9bab 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -2,7 +2,7 @@ * Copyright (c) 1990 - 1994, Julianne Frances Haugh * Copyright (c) 1996 - 2001, Marek Michałkiewicz * Copyright (c) 2001 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2008, Nicolas François + * Copyright (c) 2007 - 2009, Nicolas François * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1025,7 +1025,7 @@ int commonio_remove (struct commonio_db *db, const char *name) * * Otherwise, it returns NULL. */ -/*@null@*/const void *commonio_locate (struct commonio_db *db, const char *name) +/*@observer@*/ /*@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. */ -/*@null@*/const void *commonio_next (struct commonio_db *db) +/*@observer@*/ /*@null@*/const void *commonio_next (struct commonio_db *db) { void *eptr; diff --git a/lib/commonio.h b/lib/commonio.h index 668318ab..f9ece77e 100644 --- a/lib/commonio.h +++ b/lib/commonio.h @@ -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 /*@null@*/const void *commonio_locate (struct commonio_db *, const char *); +extern /*@observer@*/ /*@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 /*@null@*/const void *commonio_next (struct commonio_db *); +extern /*@observer@*/ /*@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 *, diff --git a/lib/groupio.c b/lib/groupio.c index 72b5c949..fe57d27e 100644 --- a/lib/groupio.c +++ b/lib/groupio.c @@ -141,12 +141,12 @@ int gr_open (int mode) return commonio_open (&group_db, mode); } -/*@null@*/const struct group *gr_locate (const char *name) +/*@observer@*/ /*@null@*/const struct group *gr_locate (const char *name) { return commonio_locate (&group_db, name); } -/*@null@*/const struct group *gr_locate_gid (gid_t gid) +/*@observer@*/ /*@null@*/const struct group *gr_locate_gid (gid_t gid) { const struct group *grp; @@ -173,7 +173,7 @@ int gr_rewind (void) return commonio_rewind (&group_db); } -/*@null@*/const struct group *gr_next (void) +/*@observer@*/ /*@null@*/const struct group *gr_next (void) { return commonio_next (&group_db); } diff --git a/lib/groupio.h b/lib/groupio.h index 4edb6a89..e1f1b029 100644 --- a/lib/groupio.h +++ b/lib/groupio.h @@ -39,12 +39,12 @@ #include extern int gr_close (void); -extern /*@null@*/const struct group *gr_locate (const char *name); -extern /*@null@*/const struct group *gr_locate_gid (gid_t gid); +extern /*@observer@*/ /*@null@*/const struct group *gr_locate (const char *name); +extern /*@observer@*/ /*@null@*/const struct group *gr_locate_gid (gid_t gid); extern int gr_lock (void); extern int gr_setdbname (const char *filename); extern /*@observer@*/const char *gr_dbname (void); -extern /*@null@*/const struct group *gr_next (void); +extern /*@observer@*/ /*@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); diff --git a/lib/pwio.c b/lib/pwio.c index 0489548a..fc6d8af4 100644 --- a/lib/pwio.c +++ b/lib/pwio.c @@ -123,12 +123,12 @@ int pw_open (int mode) return commonio_open (&passwd_db, mode); } -const struct passwd *pw_locate (const char *name) +/*@observer@*/ /*@null@*/const struct passwd *pw_locate (const char *name) { return commonio_locate (&passwd_db, name); } -const struct passwd *pw_locate_uid (uid_t uid) +/*@observer@*/ /*@null@*/const struct passwd *pw_locate_uid (uid_t uid) { const struct passwd *pwd; @@ -155,7 +155,7 @@ int pw_rewind (void) return commonio_rewind (&passwd_db); } -const struct passwd *pw_next (void) +/*@observer@*/ /*@null@*/const struct passwd *pw_next (void) { return commonio_next (&passwd_db); } diff --git a/lib/pwio.h b/lib/pwio.h index 4b241f26..2db85e01 100644 --- a/lib/pwio.h +++ b/lib/pwio.h @@ -39,12 +39,12 @@ #include extern int pw_close (void); -extern /*@null@*/const struct passwd *pw_locate (const char *name); -extern /*@null@*/const struct passwd *pw_locate_uid (uid_t uid); +extern /*@observer@*/ /*@null@*/const struct passwd *pw_locate (const char *name); +extern /*@observer@*/ /*@null@*/const struct passwd *pw_locate_uid (uid_t uid); extern int pw_lock (void); extern int pw_setdbname (const char *filename); extern /*@observer@*/const char *pw_dbname (void); -extern /*@null@*/const struct passwd *pw_next (void); +extern /*@observer@*/ /*@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); diff --git a/lib/shadowio.c b/lib/shadowio.c index 7921c996..9ea6a55b 100644 --- a/lib/shadowio.c +++ b/lib/shadowio.c @@ -128,7 +128,7 @@ int spw_open (int mode) return commonio_open (&shadow_db, mode); } -/*@null@*/const struct spwd *spw_locate (const char *name) +/*@observer@*/ /*@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); } -/*@null@*/const struct spwd *spw_next (void) +/*@observer@*/ /*@null@*/const struct spwd *spw_next (void) { return commonio_next (&shadow_db); } diff --git a/lib/shadowio.h b/lib/shadowio.h index a8b9cae5..229dfdb4 100644 --- a/lib/shadowio.h +++ b/lib/shadowio.h @@ -38,11 +38,11 @@ extern int spw_close (void); extern bool spw_file_present (void); -extern /*@null@*/const struct spwd *spw_locate (const char *name); +extern /*@observer@*/ /*@null@*/const struct spwd *spw_locate (const char *name); extern int spw_lock (void); extern int spw_setdbname (const char *filename); extern /*@observer@*/const char *spw_dbname (void); -extern /*@null@*/const struct spwd *spw_next (void); +extern /*@observer@*/ /*@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);