aboutsummaryrefslogtreecommitdiff
path: root/loginutils/addgroup.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-05-14 00:23:34 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-05-14 00:23:34 +0200
commit1b0a93edb93a93c30d7fbb35571f109ddf8a67a2 (patch)
tree73326fed28844ea23c13d4bbfe7abdd7b64bd270 /loginutils/addgroup.c
parent810b7161dcace56709038bf0cad93c925669c3b8 (diff)
downloadbusybox-w32-1b0a93edb93a93c30d7fbb35571f109ddf8a67a2.tar.gz
busybox-w32-1b0a93edb93a93c30d7fbb35571f109ddf8a67a2.tar.bz2
busybox-w32-1b0a93edb93a93c30d7fbb35571f109ddf8a67a2.zip
adduser/addgroup: make system id range configurable.
By Tito (farmatito AT tiscali.it). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils/addgroup.c')
-rw-r--r--loginutils/addgroup.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index cb839290d..dc60788e0 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -11,6 +11,10 @@
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13 13
14#if CONFIG_LAST_SYSTEM_ID < CONFIG_FIRST_SYSTEM_ID
15#error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config
16#endif
17
14#define OPT_GID (1 << 0) 18#define OPT_GID (1 << 0)
15#define OPT_SYSTEM_ACCOUNT (1 << 1) 19#define OPT_SYSTEM_ACCOUNT (1 << 1)
16 20
@@ -30,11 +34,11 @@ static void xgroup_study(struct group *g)
30 /* gid values is set to [0, INT_MAX] */ 34 /* gid values is set to [0, INT_MAX] */
31 if (!(option_mask32 & OPT_GID)) { 35 if (!(option_mask32 & OPT_GID)) {
32 if (option_mask32 & OPT_SYSTEM_ACCOUNT) { 36 if (option_mask32 & OPT_SYSTEM_ACCOUNT) {
33 g->gr_gid = 100; /* FIRST_SYSTEM_GID */ 37 g->gr_gid = CONFIG_FIRST_SYSTEM_ID;
34 max = 999; /* LAST_SYSTEM_GID */ 38 max = CONFIG_LAST_SYSTEM_ID;
35 } else { 39 } else {
36 g->gr_gid = 1000; /* FIRST_GID */ 40 g->gr_gid = CONFIG_LAST_SYSTEM_ID + 1;
37 max = 64999; /* LAST_GID */ 41 max = 64999;
38 } 42 }
39 } 43 }
40 /* Check if the desired gid is free 44 /* Check if the desired gid is free