Add new users to necessary groups

Bug #8186 reported by Phil Housley
8
Affects Status Importance Assigned to Milestone
gnome-system-tools (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

When a new user is added, they should be put into a few groups to allow them to
actually do something. Possibles:

cdrom, floppy, audio, video, plugdev. Maybe dialout as an option.

Sub-bug: the first user isn't added to staff; I use staff, does anyone else?

Revision history for this message
Matt Zimmerman (mdz) wrote :

I'm not sure that we should change the way that adduser itself works, but the
higher-level g-s-t tool should do this.

Ideally, there would be a radio button to specify whether the user should have
these additional privileges (not all users should), but for Warty purposes, it
would probably be sufficient to assume that the user should be privileged.

Revision history for this message
Martin Pitt (pitti) wrote :

Shall we put new users into lpadmin?

Revision history for this message
Martin Pitt (pitti) wrote :

Created an attachment (id=118)
interdiff to solve this bug

Revision history for this message
James Henstridge (jamesh) wrote :

This is a rough review of the patch (attachment 118). I'm not a g-s-t
developer, so the comments are related to general Gnome API usage.

In user_new_prepare_standardgroups(), you loop through each child node under
&iter_all, and call gtk_tree_model_get() to retrieve the string in model column
0. This function returns a copy of the string, so you will need to free it in
order to not leak.

If the group name matches one of the standard groups, you are removing the row
&iter_all from groups_all. This will set &iter_all to the next tree row or
leave it invalid if it is the last row. This looks like it will cause problems
with the "increment" statement in the for loop. If you are going to be removing
members from the tree as you iterate through them, you probably want to
structure your code like this:
  gboolean has_more;
  GtkTreeIter iter, iter_next;

  has_more = gtk_tree_model_get_first (model, &iter_next);
  while (has_more) {
    iter = iter_next;
    has_more = gtk_tree_model_iter_next (model, &iter_next);

    /* do stuff with &iter here, possibly even removing it */
  }

Other than that, I can't see anything obviously wrong with the patch.

Revision history for this message
Martin Pitt (pitti) wrote :

Created an attachment (id=123)
Updated patch, fixed iteration and memory leak

Revision history for this message
Jeff Waugh (jdub) wrote :

upload approved

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in

 gnome-system-tools (1.0.0-0ubuntu2) warty; urgency=low
 .
   * 11_new_user_groups: put newly created users in some standard local groups
     by default: audio, cdrom, dialout, floppy, lpadmin, video, plugdev
     (Warty bug #8186)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.