~ubuntu-branches/ubuntu/gutsy/samba/gutsy-updates

« back to all changes in this revision

Viewing changes to source/nsswitch/pam_winbind.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2006-11-28 20:14:37 UTC
  • mfrom: (0.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128201437-a6x4lzlhempazocp
Tags: 3.0.23d-1ubuntu1
* Merge from debian unstable.
* Drop python2.4-samba, replace with python-samba. Added Conflicts/Replaces
  on python2.4-samba
* Drop track-connection-dos.patch, ubuntu-winbind-panic.patch, 
  ubuntu-fix-ldap.patch, ubuntu-setlocale.patch, ubuntu-setlocale-fixes.patch
* Remaining Ubuntu changes:
  - Revert Debian's installation of mount.cifs and umount.cifs as suid
  - Comment out the default [homes] shares and add more verbose comments to
    explain what they do and how they work (closes: launchpad.net/27608)
  - Add a "valid users = %S" stanza to the commented-out [homes] section, to
    show users how to restrict access to \\server\username to only username.
  - Change the (commented-out) "printer admin" example to use "@lpadmin"
    instead of "@ntadmin", since the lpadmin group is used for spool admin.
  - Alter the panic-action script to encourage users to report their
    bugs in Ubuntu packages to Ubuntu, rather than reporting to Debian.
    Modify text to more closely match the Debian script
  - Munge our init script to deal with the fact that our implementation
    (or lack thereof) of log_daemon_msg and log_progress_msg differs
    from Debian's implementation of the same (Ubuntu #19691)
  - Kept ubuntu-auxsrc.patch: some auxilliary sources (undocumented in 
    previous changelogs)
  - Set default workgroup to MSHOME

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
#include <stdlib.h>
12
12
#include <unistd.h>
 
13
#include <limits.h>
13
14
#include <string.h>
14
15
#include <syslog.h>
15
16
#include <stdarg.h>
17
18
#include <sys/stat.h>
18
19
#include <fcntl.h>
19
20
#include <errno.h>
 
21
#include <time.h>
20
22
 
21
23
#include <config.h>
22
24
 
25
27
#define PAM_SM_ACCOUNT
26
28
#define PAM_SM_PASSWORD
27
29
 
28
 
#if defined(SUNOS5) || defined(SUNOS4) || defined(HPUX) || defined(FREEBSD)
 
30
#ifndef PAM_WINBIND_CONFIG_FILE
 
31
#define PAM_WINBIND_CONFIG_FILE "/etc/security/pam_winbind.conf"
 
32
#endif
 
33
 
 
34
#include <iniparser.h>
 
35
 
 
36
#if defined(SUNOS5) || defined(SUNOS4) || defined(HPUX) || defined(FREEBSD) || defined(AIX)
29
37
 
30
38
/* Solaris always uses dynamic pam modules */
31
39
#define PAM_EXTERN extern
83
91
#define WINBIND_USE_FIRST_PASS_ARG (1<<4)
84
92
#define WINBIND__OLD_PASSWORD (1<<5)
85
93
#define WINBIND_REQUIRED_MEMBERSHIP (1<<6)
86
 
 
87
 
#define PAM_WINBIND_NEW_AUTHTOK_REQD "PAM_WINBIND_NEW_AUTHTOK_REQD"
 
94
#define WINBIND_KRB5_AUTH (1<<7)
 
95
#define WINBIND_KRB5_CCACHE_TYPE (1<<8)
 
96
#define WINBIND_CACHED_LOGIN (1<<9)
 
97
#define WINBIND_CONFIG_FILE (1<<10)
88
98
 
89
99
/*
90
100
 * here is the string to inform the user that the new passwords they
96
106
#define on(x, y) (x & y)
97
107
#define off(x, y) (!(x & y))
98
108
 
 
109
#define PAM_WINBIND_NEW_AUTHTOK_REQD "PAM_WINBIND_NEW_AUTHTOK_REQD"
 
110
#define PAM_WINBIND_HOMEDIR "PAM_WINBIND_HOMEDIR"
 
111
#define PAM_WINBIND_LOGONSCRIPT "PAM_WINBIND_LOGONSCRIPT"
 
112
#define PAM_WINBIND_PROFILEPATH "PAM_WINBIND_PROFILEPATH"
 
113
#define PAM_WINBIND_PWD_LAST_SET "PAM_WINBIND_PWD_LAST_SET"
 
114
 
 
115
#define SECONDS_PER_DAY 86400
 
116
 
 
117
#define DAYS_TO_WARN_BEFORE_PWD_EXPIRES 5
 
118
 
99
119
#include "winbind_client.h"
 
120
 
 
121
#define PAM_WB_REMARK_DIRECT(h,x)\
 
122
{\
 
123
        const char *error_string = NULL; \
 
124
        error_string = _get_ntstatus_error_string(x);\
 
125
        if (error_string != NULL) {\
 
126
                _make_remark(h, PAM_ERROR_MSG, error_string);\
 
127
        } else {\
 
128
                _make_remark(h, PAM_ERROR_MSG, x);\
 
129
        };\
 
130
};
 
131
 
 
132
#define PAM_WB_REMARK_DIRECT_RET(h,x)\
 
133
{\
 
134
        const char *error_string = NULL; \
 
135
        error_string = _get_ntstatus_error_string(x);\
 
136
        if (error_string != NULL) {\
 
137
                _make_remark(h, PAM_ERROR_MSG, error_string);\
 
138
                return ret;\
 
139
        };\
 
140
        _make_remark(h, PAM_ERROR_MSG, x);\
 
141
        return ret;\
 
142
};
 
143
        
 
144
#define PAM_WB_REMARK_CHECK_RESPONSE_RET(h,x,y)\
 
145
{\
 
146
        const char *ntstatus = x.data.auth.nt_status_string; \
 
147
        const char *error_string = NULL; \
 
148
        if (!strcasecmp(ntstatus,y)) {\
 
149
                error_string = _get_ntstatus_error_string(y);\
 
150
                if (error_string != NULL) {\
 
151
                        _make_remark(h, PAM_ERROR_MSG, error_string);\
 
152
                        return ret;\
 
153
                };\
 
154
                if (x.data.auth.error_string[0] != '\0') {\
 
155
                        _make_remark(h, PAM_ERROR_MSG, x.data.auth.error_string);\
 
156
                        return ret;\
 
157
                };\
 
158
                _make_remark(h, PAM_ERROR_MSG, y);\
 
159
                return ret;\
 
160
        };\
 
161
};
 
162
 
 
163
/* from include/rpc_samr.h */
 
164
#define DOMAIN_PASSWORD_COMPLEX            0x00000001
 
165
 
 
166
#define REJECT_REASON_OTHER             0x00000000
 
167
#define REJECT_REASON_TOO_SHORT         0x00000001
 
168
#define REJECT_REASON_IN_HISTORY        0x00000002
 
169
#define REJECT_REASON_NOT_COMPLEX       0x00000005
 
170
 
 
171
/* from include/smb.h */
 
172
#define ACB_PWNOEXP                     0x00000200
 
173
 
 
174
/* from include/rpc_netlogon.h */
 
175
#define LOGON_CACHED_ACCOUNT            0x00000004
 
176