~ubuntu-branches/ubuntu/raring/accountsservice/raring

« back to all changes in this revision

Viewing changes to src/daemon.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-03-19 10:39:28 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20110319103928-m0nbc2u28vs0sv06
Tags: 0.6.6-2
* Rename 0001-buildsystem.patch -> 1001-buildsystem.patch
* Match Debian user/groups system;
  thanks to Frederic Peters for the patchset (Closes: #618764):
  - 0001-do-not-consider-system-users-returned-from-consolekit.patch.
  - 0002-create-and-manage-groups-like-on-a-debian-system.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
        gchar *username;
337
337
        gulong frequency;
338
338
        User *user;
 
339
        struct passwd *pw;
339
340
 
340
341
        frequency = 0;
341
342
        username = NULL;
344
345
                return;
345
346
        }
346
347
 
347
 
        if (user_is_excluded (daemon, username, daemon->priv->minimal_uid)) {
 
348
        pw = getpwnam (username);
 
349
 
 
350
        if (user_is_excluded (daemon, username, pw->pw_uid)) {
348
351
                g_debug ("excluding user '%s'", username);
349
352
                g_free (username);
350
353
                return;
1104
1107
        argv[1] = "-m";
1105
1108
        argv[2] = "-c";
1106
1109
        argv[3] = cd->real_name;
 
1110
        argv[4] = cd->user_name;
 
1111
        argv[5] = NULL;
 
1112
 
 
1113
        error = NULL;
 
1114
        if (!spawn_with_login_uid (context, argv, &error)) {
 
1115
                throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
 
1116
                g_error_free (error);
 
1117
                return;
 
1118
        }
 
1119
 
1107
1120
        if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR) {
1108
 
                argv[4] = "-G";
1109
 
                argv[5] = "wheel";
1110
 
                argv[6] = cd->user_name;
1111
 
                argv[7] = NULL;
1112
 
        }
1113
 
        else if (cd->account_type == ACCOUNT_TYPE_STANDARD) {
1114
 
                argv[6] = cd->user_name;
1115
 
                argv[7] = NULL;
1116
 
        }
1117
 
        else {
1118
 
                throw_error (context, ERROR_FAILED, "Don't know how to add user of type %d", cd->account_type);
1119
 
                return;
1120
 
        }
1121
 
 
1122
 
        error = NULL;
1123
 
        if (!spawn_with_login_uid (context, argv, &error)) {
1124
 
                throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
1125
 
                g_error_free (error);
1126
 
                return;
 
1121
                add_user_to_group (context, cd->user_name, "admin");
 
1122
        }
 
1123
        if (cd->account_type == ACCOUNT_TYPE_ADMINISTRATOR ||
 
1124
            cd->account_type == ACCOUNT_TYPE_STANDARD) {
 
1125
                add_user_to_group (context, cd->user_name, "audio");
 
1126
                add_user_to_group (context, cd->user_name, "cdrom");
 
1127
                add_user_to_group (context, cd->user_name, "dialout");
 
1128
                add_user_to_group (context, cd->user_name, "plugdev");
1127
1129
        }
1128
1130
 
1129
1131
        user = daemon_local_find_user_by_name (daemon, cd->user_name);