[66699] trunk/base/src/port1.0/portutil.tcl
jmr at macports.org
jmr at macports.org
Tue Apr 20 10:30:42 PDT 2010
Revision: 66699
http://trac.macports.org/changeset/66699
Author: jmr at macports.org
Date: 2010-04-20 10:30:38 -0700 (Tue, 20 Apr 2010)
Log Message:
-----------
make adduser/addgroup noops when not running as root
Modified Paths:
--------------
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2010-04-20 17:20:27 UTC (rev 66698)
+++ trunk/base/src/port1.0/portutil.tcl 2010-04-20 17:30:38 UTC (rev 66699)
@@ -2027,6 +2027,13 @@
proc adduser {name args} {
global os.platform
+
+ if {[getuid] != 0} {
+ ui_warn "adduser only works when running as root."
+ ui_warn "The requested user '$name' was not created."
+ return
+ }
+
set passwd {*}
set uid [nextuid]
set gid [existsgroup nogroup]
@@ -2054,13 +2061,20 @@
exec $dscl . -create /Users/${name} UserShell ${shell}
} else {
# XXX adduser is only available for darwin, add more support here
- ui_warn "WARNING: adduser is not implemented on ${os.platform}."
- ui_warn "The requested user was not created."
+ ui_warn "adduser is not implemented on ${os.platform}."
+ ui_warn "The requested user '$name' was not created."
}
}
proc addgroup {name args} {
global os.platform
+
+ if {[getuid] != 0} {
+ ui_warn "addgroup only works when running as root."
+ ui_warn "The requested group '$name' was not created."
+ return
+ }
+
set gid [nextgid]
set realname ${name}
set passwd {*}
@@ -2086,7 +2100,7 @@
}
} else {
# XXX addgroup is only available for darwin, add more support here
- ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
+ ui_warn "addgroup is not implemented on ${os.platform}."
ui_warn "The requested group was not created."
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100420/6e4ae35d/attachment.html>
More information about the macports-changes
mailing list