* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,

libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
	lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
	lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
	lib/fputsx.c, lib/prototypes.h: Added splint annotations.
	* lib/groupio.c: Avoid implicit conversion of pointers to
	booleans.
	* lib/groupio.c: Free allocated buffers in case of failure.
This commit is contained in:
nekral-guest
2009-04-23 09:57:03 +00:00
parent fef6f9379a
commit 614c79defc
16 changed files with 80 additions and 64 deletions

View File

@@ -75,7 +75,7 @@ void do_cleanups (void)
/*
* add_cleanup - Add a cleanup_function to the cleanup_functions stack.
*/
void add_cleanup (cleanup_function pcf, void *arg)
void add_cleanup (cleanup_function pcf, /*@null@*/void *arg)
{
unsigned int i;
assert (NULL != pcf);

View File

@@ -44,7 +44,7 @@
* The string may be a valid GID or a valid groupname.
* If the group does not exist on the system, NULL is returned.
*/
extern struct group *getgr_nam_gid (const char *grname)
extern /*@null@*/struct group *getgr_nam_gid (const char *grname)
{
long long int gid;
char *endptr;

View File

@@ -43,7 +43,7 @@
* name, and if not present it is added to a freshly allocated
* list of users.
*/
char **add_list (char **list, const char *member)
/*@only@*/ /*@out@*/char **add_list (/*@returned@*/ /*@only@*/char **list, const char *member)
{
int i;
char **tmp;
@@ -93,7 +93,7 @@ char **add_list (char **list, const char *member)
* list of users.
*/
char **del_list (char **list, const char *member)
/*@only@*/ /*@out@*/char **del_list (/*@returned@*/ /*@only@*/char **list, const char *member)
{
int i, j;
char **tmp;
@@ -141,7 +141,7 @@ char **del_list (char **list, const char *member)
return tmp;
}
char **dup_list (char *const *list)
/*@only@*/ /*@out@*/char **dup_list (char *const *list)
{
int i;
char **tmp;
@@ -182,12 +182,13 @@ bool is_on_list (char *const *list, const char *member)
* comma_to_list - convert comma-separated list to (char *) array
*/
char **comma_to_list (const char *comma)
/*@only@*/char **comma_to_list (const char *comma)
{
char *members;
char **array;
int i;
char *cp, *cp2;
const char *cp;
char *cp2;
assert (NULL != comma);

View File

@@ -1,7 +1,7 @@
/*
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
* Copyright (c) 2003 - 2005, 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
@@ -41,7 +41,7 @@
#include "defines.h"
#include <pwd.h>
#include "prototypes.h"
struct passwd *get_my_pwent (void)
/*@null@*/struct passwd *get_my_pwent (void)
{
struct passwd *pw;
const char *cp = getlogin ();

View File

@@ -21,14 +21,14 @@
/* local function prototypes */
static void seedRNG (void);
static char *gensalt (size_t salt_size);
static /*@observer@*/const char *gensalt (size_t salt_size);
#ifdef USE_SHA_CRYPT
static size_t SHA_salt_size (void);
static const char *SHA_salt_rounds (int *prefered_rounds);
static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds);
#endif /* USE_SHA_CRYPT */
#ifndef HAVE_L64A
static char *l64a(long value)
static /*@observer@*/char *l64a(long value)
{
static char buf[8];
char *s = buf;
@@ -104,7 +104,7 @@ static size_t SHA_salt_size (void)
/*
* Return a salt prefix specifying the rounds number for the SHA crypt methods.
*/
static const char *SHA_salt_rounds (int *prefered_rounds)
static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds)
{
static char rounds_prefix[18];
long rounds;
@@ -168,7 +168,7 @@ static const char *SHA_salt_rounds (int *prefered_rounds)
#define MAX_SALT_SIZE 16
#define MIN_SALT_SIZE 8
static char *gensalt (size_t salt_size)
static /*@observer@*/const char *gensalt (size_t salt_size)
{
static char salt[32];
@@ -202,7 +202,7 @@ static char *gensalt (size_t salt_size)
* * For the SHA256 and SHA512 method, this specifies the number of rounds
* (if not NULL).
*/
char *crypt_make_salt (const char *meth, void *arg)
/*@observer@*/const char *crypt_make_salt (/*@null@*/const char *meth, /*@null@*/void *arg)
{
/* Max result size for the SHA methods:
* +3 $5$

View File

@@ -1,5 +1,5 @@
/*
* 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
@@ -64,7 +64,7 @@
#define STRINGIZE(name) STRINGIZE1 (name)
#define STRINGIZE1(name) #name
LOOKUP_TYPE *XFUNCTION_NAME (ARG_TYPE ARG_NAME)
/*@null@*/ /*@only@*/LOOKUP_TYPE *XFUNCTION_NAME (ARG_TYPE ARG_NAME)
{
#if HAVE_FUNCTION_R
LOOKUP_TYPE *result=NULL;