udhcpc: fix a problem with binary-encoded options #2
[oweals/busybox.git] / loginutils / addgroup.c
index e49278efe09778cc8da827805abcd86a7b3ff6fd..b37270ff0f3894e452d26b48f87f959930e1fa1f 100644 (file)
@@ -6,9 +6,17 @@
  * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
  * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it>
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  *
  */
+
+//usage:#define addgroup_trivial_usage
+//usage:       "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"
+//usage:#define addgroup_full_usage "\n\n"
+//usage:       "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n"
+//usage:     "\n       -g GID  Group id"
+//usage:     "\n       -S      Create a system group"
+
 #include "libbb.h"
 
 #if CONFIG_LAST_SYSTEM_ID < CONFIG_FIRST_SYSTEM_ID
@@ -79,7 +87,22 @@ static void new_group(char *group, gid_t gid)
        if (ENABLE_FEATURE_CLEAN_UP)
                free(p);
 #if ENABLE_FEATURE_SHADOWPASSWDS
-       /* Ignore errors: if file is missing we suppose admin doesn't want it */
+       /* /etc/gshadow fields:
+        * 1. Group name.
+        * 2. Encrypted password.
+        *    If set, non-members of the group can join the group
+        *    by typing the password for that group using the newgrp command.
+        *    If the value is of this field ! then no user is allowed
+        *    to access the group using the newgrp command. A value of !!
+        *    is treated the same as a value of ! only it indicates
+        *    that a password has never been set before. If the value is null,
+        *    only group members can log into the group.
+        * 3. Group administrators (comma delimited list).
+        *    Group members listed here can add or remove group members
+        *    using the gpasswd command.
+        * 4. Group members (comma delimited list).
+        */
+       /* Ignore errors: if file is missing we assume admin doesn't want it */
        update_passwd(bb_path_gshadow_file, group, "!::", NULL);
 #endif
 }
@@ -153,7 +176,6 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
        {
                die_if_bad_username(argv[0]);
                new_group(argv[0], gid);
-
        }
        /* Reached only on success */
        return EXIT_SUCCESS;