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

« back to all changes in this revision

Viewing changes to source/passdb/login_cache.c

  • 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:
1
1
/* 
2
2
   Unix SMB/CIFS implementation.
3
 
   SAM_ACCOUNT local cache for 
 
3
   struct samu local cache for 
4
4
   Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2004.
5
5
      
6
6
   This program is free software; you can redistribute it and/or modify
64
64
}
65
65
 
66
66
/* if we can't read the cache, oh well, no need to return anything */
67
 
LOGIN_CACHE * login_cache_read(SAM_ACCOUNT *sampass)
 
67
LOGIN_CACHE * login_cache_read(struct samu *sampass)
68
68
{
69
69
        TDB_DATA keybuf, databuf;
70
70
        LOGIN_CACHE *entry;
72
72
        if (!login_cache_init())
73
73
                return NULL;
74
74
 
 
75
        if (pdb_get_nt_username(sampass) == NULL) {
 
76
                return NULL;
 
77
        }
 
78
 
75
79
        keybuf.dptr = SMB_STRDUP(pdb_get_nt_username(sampass));
76
80
        if (!keybuf.dptr || !strlen(keybuf.dptr)) {
77
81
                SAFE_FREE(keybuf.dptr);
108
112
        return entry;
109
113
}
110
114
 
111
 
BOOL login_cache_write(const SAM_ACCOUNT *sampass, LOGIN_CACHE entry)
 
115
BOOL login_cache_write(const struct samu *sampass, LOGIN_CACHE entry)
112
116
{
113
117
 
114
118
        TDB_DATA keybuf, databuf;
117
121
        if (!login_cache_init())
118
122
                return False;
119
123
 
 
124
        if (pdb_get_nt_username(sampass) == NULL) {
 
125
                return False;
 
126
        }
 
127
 
120
128
        keybuf.dptr = SMB_STRDUP(pdb_get_nt_username(sampass));
121
129
        if (!keybuf.dptr || !strlen(keybuf.dptr)) {
122
130
                SAFE_FREE(keybuf.dptr);
155
163
        return ret == 0;
156
164
}
157
165
 
158
 
BOOL login_cache_delentry(const SAM_ACCOUNT *sampass)
 
166
BOOL login_cache_delentry(const struct samu *sampass)
159
167
{
160
168
        int ret;
161
169
        TDB_DATA keybuf;
163
171
        if (!login_cache_init()) 
164
172
                return False;   
165
173
 
 
174
        if (pdb_get_nt_username(sampass) == NULL) {
 
175
                return False;
 
176
        }
 
177
 
166
178
        keybuf.dptr = SMB_STRDUP(pdb_get_nt_username(sampass));
167
179
        if (!keybuf.dptr || !strlen(keybuf.dptr)) {
168
180
                SAFE_FREE(keybuf.dptr);