]> granicus.if.org Git - shadow/commitdiff
* libmisc/root_flag.c, src/gpasswd.c, src/chsh.c: Add splint
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 19 Nov 2011 21:51:52 +0000 (21:51 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 19 Nov 2011 21:51:52 +0000 (21:51 +0000)
annotations.
* src/pwconv.c, src/pwunconv.c, src/grpconv.c, src/grpunconv.c:
Ignore return value of spw_rewind, pw_rewind, sgr_rewind, and
gr_rewind.
* lib/commonio.h: Both head and tail cannot be owned. Set tail as
dependent.
* src/expiry.c: Ignore return value of expire ().
* src/expiry.c: The catch_signals function does not use its sig
parameter.
* src/userdel.c: Last audit_logger parameter is a
shadow_audit_result, use SHADOW_AUDIT_FAILURE instead of 0.

ChangeLog
lib/commonio.h
libmisc/root_flag.c
src/chsh.c
src/expiry.c
src/gpasswd.c
src/grpconv.c
src/grpunconv.c
src/pwconv.c
src/pwunconv.c
src/userdel.c

index 743dad7ec463453d70b1162c3efcb36e27b63770..0dde209fe6ff1807d4c59c4dc092b3586774cedb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-11-19  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/root_flag.c, src/gpasswd.c, src/chsh.c: Add splint
+       annotations.
+       * src/pwconv.c, src/pwunconv.c, src/grpconv.c, src/grpunconv.c:
+       Ignore return value of spw_rewind, pw_rewind, sgr_rewind, and
+       gr_rewind.
+       * lib/commonio.h: Both head and tail cannot be owned. Set tail as
+       dependent.
+       * src/expiry.c: Ignore return value of expire ().
+       * src/expiry.c: The catch_signals function does not use its sig
+       parameter.
+       * src/userdel.c: Last audit_logger parameter is a
+       shadow_audit_result, use SHADOW_AUDIT_FAILURE instead of 0.
+
 2011-11-19  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/faillog.c: The fail_max field is a short, use a short also
index cf31ae8c582608b4e3f49e27015aaf9149cc958e..902cc6fdfe69434ab046468784884d9090bb3f72 100644 (file)
@@ -126,7 +126,8 @@ struct commonio_db {
        /*
         * Head, tail, current position in linked list.
         */
-       /*@owned@*/ /*@null@*/struct commonio_entry *head, *tail;
+       /*@owned@*/ /*@null@*/struct commonio_entry *head;
+       /*@dependent@*/ /*@null@*/struct commonio_entry *tail;
        /*@dependent@*/ /*@null@*/struct commonio_entry *cursor;
 
        /*
index f0349971e7380f679dad2c6c7d8ccad00e755334..717de51d318cdb3b4b3090039446169ccb469a4b 100644 (file)
@@ -36,6 +36,7 @@
 #include <assert.h>
 #include "defines.h"
 #include "prototypes.h"
+/*@-exitarg@*/
 #include "exitcodes.h"
 
 static void change_root (const char* newroot);
index 4bb47f5a9727d9d53b45be3479d04b6a8c893272..393a79ff353fd1c67f658f179083868668bbf96a 100644 (file)
@@ -71,8 +71,8 @@ static bool pw_locked = false;
 /* external identifiers */
 
 /* local function prototypes */
-static void fail_exit (int code);
-static void usage (int status);
+static /*@noreturn@*/void fail_exit (int code);
+static /*@noreturn@*/void usage (int status);
 static void new_fields (void);
 static bool shell_is_listed (const char *);
 static bool is_restricted_shell (const char *);
@@ -83,7 +83,7 @@ static void update_shell (const char *user, char *loginsh);
 /*
  * fail_exit - do some cleanup and exit with the given error code
  */
-static void fail_exit (int code)
+static /*@noreturn@*/void fail_exit (int code)
 {
        if (pw_locked) {
                if (pw_unlock () == 0) {
@@ -101,7 +101,7 @@ static void fail_exit (int code)
 /*
  * usage - print command line syntax and exit
  */
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
@@ -217,7 +217,7 @@ static void process_flags (int argc, char **argv)
                switch (c) {
                case 'h':
                        usage (E_SUCCESS);
-                       break;
+                       /*@notreached@*/break;
                case 'R': /* no-op, handled in process_root_flag () */
                        break;
                case 's':
index 643791ee494380cda7c0bb3ea5f9fa43823ca4f5..4ae47703744eed3862f11cbab615fec916e9f8eb 100644 (file)
@@ -49,7 +49,7 @@ const char *Prog;
 static bool cflg = false;
 
 /* local function prototypes */
-static RETSIGTYPE catch_signals (int);
+static RETSIGTYPE catch_signals (unused int sig);
 static /*@noreturn@*/void usage (int status);
 static void process_flags (int argc, char **argv);
 
@@ -203,7 +203,7 @@ int main (int argc, char **argv)
         * do.
         * It won't return unless the account is unexpired.
         */
-       expire (pwd, spwd);
+       (void) expire (pwd, spwd);
 
        return E_SUCCESS;
 }
index 0015dc41f72c72bc48f43cb18a029cdba75ef802..df8d714877d6075bb7b14d2cdd8407d292f8feb0 100644 (file)
@@ -113,14 +113,14 @@ static void update_group (struct group *gr);
 static void change_passwd (struct group *gr);
 #endif
 static void log_gpasswd_failure (const char *suffix);
-static void log_gpasswd_failure_system (unused void *arg);
-static void log_gpasswd_failure_group (unused void *arg);
+static void log_gpasswd_failure_system (/*@null@*/unused void *arg);
+static void log_gpasswd_failure_group (/*@null@*/unused void *arg);
 #ifdef SHADOWGRP
-static void log_gpasswd_failure_gshadow (unused void *arg);
+static void log_gpasswd_failure_gshadow (/*@null@*/unused void *arg);
 #endif
 static void log_gpasswd_success (const char *suffix);
-static void log_gpasswd_success_system (unused void *arg);
-static void log_gpasswd_success_group (unused void *arg);
+static void log_gpasswd_success_system (/*@null@*/unused void *arg);
+static void log_gpasswd_success_group (/*@null@*/unused void *arg);
 
 /*
  * usage - display usage message
@@ -185,9 +185,10 @@ static RETSIGTYPE catch_signals (int killed)
  */
 static bool is_valid_user_list (const char *users)
 {
-       char *username, *end;
+       const char *username;
+       char *end;
        bool is_valid = true;
-       char *tmpusers = xstrdup (users);
+       /*@owned@*/char *tmpusers = xstrdup (users);
 
        for (username = tmpusers;
             (NULL != username) && ('\0' != *username);
index 4568bc14077a29933f7461ecf492bcdf69bca6d3..ece8095d7ce7b933c4636694bb6f27d4cd711256 100644 (file)
@@ -183,7 +183,7 @@ int main (int argc, char **argv)
        /*
         * Remove /etc/gshadow entries for groups not in /etc/group.
         */
-       sgr_rewind ();
+       (void) sgr_rewind ();
        while ((sg = sgr_next ()) != NULL) {
                if (gr_locate (sg->sg_name) != NULL) {
                        continue;
@@ -204,7 +204,7 @@ int main (int argc, char **argv)
         * Update shadow group passwords if non-shadow password is not "x".
         * Add any missing shadow group entries.
         */
-       gr_rewind ();
+       (void) gr_rewind ();
        while ((gr = gr_next ()) != NULL) {
                sg = sgr_locate (gr->gr_name);
                if (NULL != sg) {
index 89fb97b2cebdb964ee6fdd86ded35a8f96baea5e..79c7d9565c0a1495c057af6d2aa88f4f9ba05ff6 100644 (file)
@@ -188,7 +188,7 @@ int main (int argc, char **argv)
        /*
         * Update group passwords if non-shadow password is "x".
         */
-       gr_rewind ();
+       (void) gr_rewind ();
        while ((gr = gr_next ()) != NULL) {
                sg = sgr_locate (gr->gr_name);
                if (   (NULL != sg)
index cb4ae4f7e849953a9334b30362f5b808be12eff9..bd246ac0aeb4737b0c386df22db3fe52ed7c10fa 100644 (file)
@@ -222,7 +222,7 @@ int main (int argc, char **argv)
        /*
         * Remove /etc/shadow entries for users not in /etc/passwd.
         */
-       spw_rewind ();
+       (void) spw_rewind ();
        while ((sp = spw_next ()) != NULL) {
                if (pw_locate (sp->sp_namp) != NULL) {
                        continue;
@@ -243,7 +243,7 @@ int main (int argc, char **argv)
         * Update shadow entries which don't have "x" as pw_passwd. Add any
         * missing shadow entries.
         */
-       pw_rewind ();
+       (void) pw_rewind ();
        while ((pw = pw_next ()) != NULL) {
                sp = spw_locate (pw->pw_name);
                if (NULL != sp) {
index 9b74614c47dddeb4010b464a6eabf41081656d61..c136ed40a0579650b0278aced3651fededb1f562 100644 (file)
@@ -187,7 +187,7 @@ int main (int argc, char **argv)
                fail_exit (1);
        }
 
-       pw_rewind ();
+       (void) pw_rewind ();
        while ((pw = pw_next ()) != NULL) {
                spwd = spw_locate (pw->pw_name);
                if (NULL == spwd) {
index 6d8d43e7be43aea6c138d43f75bc429ed16c0fb7..63c107bf8b96665ab9ec3a93d99cff0617c75a60 100644 (file)
@@ -1125,7 +1125,8 @@ int main (int argc, char **argv)
 #ifdef WITH_AUDIT
                        audit_logger (AUDIT_ADD_USER, Prog,
                                      "removing SELinux user mapping",
-                                     user_name, (unsigned int) user_id, 0);
+                                     user_name, (unsigned int) user_id,
+                                     SHADOW_AUDIT_FAILURE);
 #endif                         /* WITH_AUDIT */
                        fail_exit (E_SE_UPDATE);
                }