~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcheckpass/kcheckpass.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
 *
 
3
 *      kcheckpass
 
4
 *
 
5
 *      Simple password checker. Just invoke and send it
 
6
 *      the password on stdin.
 
7
 *
 
8
 *      If the password was accepted, the program exits with 0;
 
9
 *      if it was rejected, it exits with 1. Any other exit
 
10
 *      code signals an error.
 
11
 *
 
12
 *
 
13
 * This program is free software; you can redistribute it and/or
 
14
 * modify it under the terms of the GNU General Public
 
15
 * License as published by the Free Software Foundation; either
 
16
 * version 2 of the License, or (at your option) any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
21
 * General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public
 
24
 * License along with this program; if not, write to the Free
 
25
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
26
 *
 
27
 *      Copyright (C) 1998, Caldera, Inc.
 
28
 *      Released under the GNU General Public License
 
29
 *
 
30
 *      Olaf Kirch <okir@caldera.de>      General Framework and PAM support
 
31
 *      Christian Esken <esken@kde.org>   Shadow and /etc/passwd support
 
32
 *      Oswald Buddenhagen <ossi@kde.org> Binary server mode
 
33
 *
 
34
 *      Other parts were taken from kscreensaver's passwd.cpp
 
35
 *****************************************************************/
 
36
 
 
37
#ifndef KCHECKPASS_H_
 
38
#define KCHECKPASS_H_
 
39
 
 
40
#include <config-workspace.h>
 
41
#include <config-unix.h>
 
42
#include <config-kcheckpass.h>
 
43
 
 
44
#ifdef HAVE_CRYPT_H
 
45
#include <crypt.h>
 
46
#endif
 
47
 
 
48
#ifdef HAVE_PATHS_H
 
49
#include <paths.h>
 
50
#endif
 
51
 
 
52
#include <pwd.h>
 
53
#include <sys/types.h>
 
54
 
 
55
#ifndef _PATH_TMP
 
56
#define _PATH_TMP "/tmp/"
 
57
#endif
 
58
 
 
59
 
 
60
#ifdef ultrix
 
61
#include <auth.h>
 
62
#endif
 
63
 
 
64
#include <unistd.h>
 
65
 
 
66
#ifdef OSF1_ENH_SEC
 
67
#include <sys/security.h>
 
68
#include <prot.h>
 
69
#endif
 
70
 
 
71
/* Make sure there is only one! */
 
72
#if defined(HAVE_PAM)
 
73
# undef HAVE_OSF_C2_PASSWD
 
74
#elif defined(HAVE_OSF_C2_PASSWD)
 
75
#elif defined(_AIX)
 
76
# define HAVE_AIX_AUTH
 
77
#elif defined(HAVE_GETSPNAM)
 
78
# define HAVE_SHADOW
 
79
#else
 
80
# define HAVE_ETCPASSWD
 
81
#endif
 
82
 
 
83
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
 
84
# define ATTR_UNUSED __attribute__((unused))
 
85
# define ATTR_NORETURN __attribute__((noreturn))
 
86
# define ATTR_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
 
87
#else
 
88
# define ATTR_UNUSED
 
89
# define ATTR_NORETURN
 
90
# define ATTR_PRINTFLIKE(fmt,var)
 
91
#endif
 
92
 
 
93
#include "kcheckpass-enums.h"
 
94
 
 
95
#ifdef __cplusplus
 
96
extern "C" {
 
97
#endif
 
98
 
 
99
/*****************************************************************
 
100
 * Authenticates user
 
101
 *****************************************************************/
 
102
AuthReturn Authenticate(
 
103
#ifdef HAVE_PAM
 
104
        const char *caller, 
 
105
#endif
 
106
        const char *method,
 
107
        const char *user,
 
108
        char *(*conv) (ConvRequest, const char *));
 
109
 
 
110
/*****************************************************************
 
111
 * Output a message to stderr
 
112
 *****************************************************************/
 
113
void message(const char *, ...) ATTR_PRINTFLIKE(1, 2);
 
114
 
 
115
/*****************************************************************
 
116
 * Overwrite and free the passed string
 
117
 *****************************************************************/
 
118
void dispose(char *);
 
119
 
 
120
#ifdef __cplusplus
 
121
}
 
122
#endif
 
123
#endif