~ubuntu-branches/ubuntu/raring/shadow/raring-proposed

« back to all changes in this revision

Viewing changes to libmisc/pam_pass.c

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2009-05-05 09:45:21 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505094521-wpk2wn3q7957tlah
Tags: 1:4.1.3.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Ubuntu specific:
    + debian/login.defs: use SHA512 by default for password crypt routine.
  - debian/patches/stdout-encrypted-password.patch: chpasswd can report
    password hashes on stdout (debian bug 505640).
  - debian/login.pam: Enable SELinux support (debian bug 527106).
  - debian/securetty.linux: support Freescale MX-series (debian bug 527095).
* Add debian/patches/300_lastlog_failure: fixed upstream (debian bug 524873).
* Drop debian/patches/593_omit_lastchange_field_if_clock_is_misset: fixed
  upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 1997 - 1999, Marek Michałkiewicz
 
3
 * Copyright (c) 2001 - 2005, Tomasz Kłoczko
 
4
 * Copyright (c) 2008       , Nicolas François
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions
 
9
 * are met:
 
10
 * 1. Redistributions of source code must retain the above copyright
 
11
 *    notice, this list of conditions and the following disclaimer.
 
12
 * 2. Redistributions in binary form must reproduce the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer in the
 
14
 *    documentation and/or other materials provided with the distribution.
 
15
 * 3. The name of the copyright holders or contributors may not be used to
 
16
 *    endorse or promote products derived from this software without
 
17
 *    specific prior written permission.
 
18
 *
 
19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
20
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
21
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 
22
 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
 
23
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
24
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
25
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
26
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
27
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
29
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
30
 */
 
31
 
1
32
#include <config.h>
2
33
 
3
34
#ifdef USE_PAM
4
35
 
5
 
#ident "$Id: pam_pass.c 1648 2008-01-05 15:41:58Z nekral-guest $"
 
36
#ident "$Id: pam_pass.c 2038 2008-05-25 23:38:05Z nekral-guest $"
6
37
 
7
38
 
8
39
/*
19
50
#include "pam_defs.h"
20
51
#include "prototypes.h"
21
52
 
22
 
void do_pam_passwd (const char *user, int silent, int change_expired)
 
53
void do_pam_passwd (const char *user, bool silent, bool change_expired)
23
54
{
24
55
        pam_handle_t *pamh = NULL;
25
56
        int flags = 0, ret;
39
70
        ret = pam_chauthtok (pamh, flags);
40
71
        if (ret != PAM_SUCCESS) {
41
72
                fprintf (stderr, _("passwd: %s\n"), pam_strerror (pamh, ret));
 
73
                fputs (_("passwd: password unchanged\n"), stderr);
42
74
                pam_end (pamh, ret);
43
75
                exit (10);      /* XXX */
44
76
        }
45
77
 
46
78
        fputs (_("passwd: password updated successfully\n"), stderr);
47
 
        pam_end (pamh, PAM_SUCCESS);
 
79
        (void) pam_end (pamh, PAM_SUCCESS);
48
80
}
49
81
#else                           /* !USE_PAM */
50
82
extern int errno;               /* warning: ANSI C forbids an empty source file */