~ubuntu-branches/ubuntu/raring/libuser/raring

« back to all changes in this revision

Viewing changes to apps/lpasswd.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2006-12-28 19:18:14 UTC
  • mfrom: (2.1.1 edgy)
  • Revision ID: james.westby@ubuntu.com-20061228191814-i7ssaghc6shbsv95
Tags: 1:0.54.6-2.1.dfsg.1-1.2
* Non-maintainer upload.
* Moved all manpages of commands in /usr/sbin/ from section 1 to
  section 8 (Closes: #404020).
* Added autotools-dev as build-dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
17
 */
18
18
 
19
 
#ident "$Id: lpasswd.c,v 1.17 2005/01/15 14:19:53 mitr Exp $"
 
19
#ident "$Id: lpasswd.c,v 1.19 2005/12/02 17:32:24 mitr Exp $"
20
20
 
21
21
#ifdef HAVE_CONFIG_H
22
22
#include "config.h"
36
36
int
37
37
main(int argc, const char **argv)
38
38
{
39
 
        struct lu_context *ctx = NULL;
40
 
        struct lu_ent *ent = NULL;
 
39
        struct lu_context *ctx;
 
40
        struct lu_ent *ent;
41
41
        struct lu_error *error = NULL;
42
42
        char *password = NULL, *cryptedPassword = NULL;
43
 
        const char *user = NULL;
 
43
        const char *user;
44
44
        int c;
45
45
        int plain_fd = -1, crypted_fd = -1;
46
46
        int interactive = 0, groupflag = 0;
47
47
        poptContext popt;
48
 
        gboolean is_crypted = FALSE;
 
48
        gboolean is_crypted;
49
49
        struct poptOption options[] = {
50
50
                {"interactive", 'i', POPT_ARG_NONE, &interactive, 0,
51
51
                 "prompt for all information", NULL},
77
77
        }
78
78
        user = poptGetArg(popt);
79
79
 
80
 
        lu_authenticate_unprivileged(user, "passwd");
81
 
 
82
80
        if ((user == NULL) || (geteuid() != getuid())) {
83
81
                struct passwd *pwd;
84
82
                pwd = getpwuid(getuid());
92
90
                }
93
91
        }
94
92
 
 
93
        lu_authenticate_unprivileged(user, "passwd");
 
94
 
95
95
        ctx = lu_start(user, groupflag ? lu_group : lu_user, NULL, NULL,
96
96
                       interactive ? lu_prompt_console :
97
97
                       lu_prompt_console_quiet, NULL, &error);
103
103
 
104
104
        if ((password == NULL) && (cryptedPassword == NULL) &&
105
105
            (plain_fd == -1) && (crypted_fd == -1)) {
106
 
                struct lu_prompt prompts[2];
107
106
                do {
 
107
                        struct lu_prompt prompts[2];
 
108
 
108
109
                        memset(&prompts, 0, sizeof(prompts));
109
110
                        prompts[0].key = "lpasswd/password1";
110
111
                        prompts[0].prompt = N_("New password");