[cs615asa] Assignment #4 Questions
Jan Schaumann
jschauma at cs.stevens.edu
Wed Apr 21 15:24:17 EDT 2010
Lisa Joseph <ljoseph at stevens.edu> wrote:
> Adding user/group in remote system:
> 1) UID exists
> error: UID is not unique
> 2)Username exists
> error: user already exists
That's fine.
> 3)GID exists
> error: GID is not unique
This shouldn't be an error -- if you wish to add a user with gid X, and
gid X already exists on the host, then that's not an error scenario.
You just add the user and the user will become a member of the already
existing group with gid X.
> 4)groupname exists
> error: group already exists
Same as above.
> >> > What happens if the group name already exists and the GIDs (local and
> >> > remote) do not match?
> >>
> >> Hmmm. Name exists, but gid mismatch. Let's say: use given name, ie
> >> accept different gid.
>
> When i gave same groupname and different gid , groupadd command didnt
> allow me to add new group since name is already existing.
Right, you shouldn't try to add a new group with an existing name and a
different gid. You should just accept whatever gid exists on the system
for the given group name.
So what you need to do is:
for each user:
determine name of primary group
determine gid of primary group
attempt to add user on remote system with that gid
if uname already exists:
error
if uid already exists:
generate a warning
create user with different uid (ie let the
system pick one)
if gid does not exist already:
create group with gid and name as on the local system
if group name already exists:
error
(All not explicitly mentioned 'else' statements in the above pseudo-code
are implicitly 'ok' fall-throughs.)
I think that's the easiest approach that catches most circumstances to
the satisfaction of the invoking user. (If I'm contradicting myself
versus earlier emails, I apologize. But it serves as a good example of
how an even simple program can have ambigous use cases and error
scenarios need to be well defined.)
-Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.stevens.edu/cgi-bin/mailman/private/cs615asa/attachments/20100421/70731c25/attachment.pgp
More information about the cs615asa
mailing list