~xnox/ubuntu/quantal/shadow/clear-locks

« back to all changes in this revision

Viewing changes to libmisc/tz.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
1
/*
2
 
 * Copyright 1991 - 1994, Julianne Frances Haugh and Chip Rosenthal
 
2
 * Copyright (c) 1991 - 1994, Julianne Frances Haugh
 
3
 * Copyright (c) 1991 - 1994, Chip Rosenthal
 
4
 * Copyright (c) 1996 - 1998, Marek Michałkiewicz
 
5
 * Copyright (c) 2003 - 2005, Tomasz Kłoczko
 
6
 * Copyright (c) 2007 - 2008, Nicolas François
3
7
 * All rights reserved.
4
8
 *
5
9
 * Redistribution and use in source and binary forms, with or without
10
14
 * 2. Redistributions in binary form must reproduce the above copyright
11
15
 *    notice, this list of conditions and the following disclaimer in the
12
16
 *    documentation and/or other materials provided with the distribution.
13
 
 * 3. Neither the name of Julianne F. Haugh nor the names of its contributors
14
 
 *    may be used to endorse or promote products derived from this software
15
 
 *    without specific prior written permission.
 
17
 * 3. The name of the copyright holders or contributors may not be used to
 
18
 *    endorse or promote products derived from this software without
 
19
 *    specific prior written permission.
16
20
 *
17
 
 * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
18
 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 
 * ARE DISCLAIMED.  IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
21
 
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 
 * SUCH DAMAGE.
 
21
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
22
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
23
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 
24
 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
 
25
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
27
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
28
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
29
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
30
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
31
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
32
 */
29
33
 
30
34
#include <config.h>
31
35
 
32
 
#ident "$Id: tz.c 1633 2008-01-05 13:23:22Z nekral-guest $"
 
36
#ifndef USE_PAM
 
37
 
 
38
#ident "$Id: tz.c 2355 2008-09-06 16:42:41Z nekral-guest $"
33
39
 
34
40
#include <stdio.h>
35
41
#include <string.h>
36
42
#include "defines.h"
37
43
#include "prototypes.h"
38
44
#include "getdef.h"
 
45
 
39
46
/*
40
47
 * tz - return local timezone name
41
48
 *
49
56
        const char *def_tz = "TZ=CST6CDT";
50
57
 
51
58
        if ((fp = fopen (fname, "r")) == NULL ||
52
 
            fgets (tzbuf, sizeof (tzbuf), fp) == NULL) {
53
 
#ifndef USE_PAM
 
59
            fgets (tzbuf, (int) sizeof (tzbuf), fp) == NULL) {
54
60
                if (!(def_tz = getdef_str ("ENV_TZ")) || def_tz[0] == '/')
55
61
                        def_tz = "TZ=CST6CDT";
56
 
#endif                          /* !USE_PAM */
57
62
 
58
63
                strcpy (tzbuf, def_tz);
59
64
        } else
64
69
 
65
70
        return tzbuf;
66
71
}
 
72
#else                           /* !USE_PAM */
 
73
extern int errno;               /* warning: ANSI C forbids an empty source file */
 
74
#endif                          /* !USE_PAM */
 
75