~ubuntu-branches/ubuntu/utopic/samba/utopic

« back to all changes in this revision

Viewing changes to source3/passdb/pdb_get_set.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-21 09:06:34 UTC
  • mfrom: (0.39.23 sid)
  • Revision ID: package-import@ubuntu.com-20120221090634-svd7q7m33pfz0847
Tags: 2:3.6.3-1ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module.
* Dropped:
  - debian/patches/fix-samba-printer-browsing.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#define PDB_NOT_QUITE_NULL ""
40
40
 
41
41
/*********************************************************************
 
42
 Test if a change time is a max value. Copes with old and new values
 
43
 of max.
 
44
 ********************************************************************/
 
45
 
 
46
bool pdb_is_password_change_time_max(time_t test_time)
 
47
{
 
48
        if (test_time == get_time_t_max()) {
 
49
                return true;
 
50
        }
 
51
#if (defined(SIZEOF_TIME_T) && (SIZEOF_TIME_T == 8))
 
52
        if (test_time == 0x7FFFFFFFFFFFFFFFLL) {
 
53
                return true;
 
54
        }
 
55
#endif
 
56
        if (test_time == 0x7FFFFFFF) {
 
57
                return true;
 
58
        }
 
59
        return false;
 
60
}
 
61
 
 
62
/*********************************************************************
 
63
 Return an unchanging version of max password change time - 0x7FFFFFFF.
 
64
 ********************************************************************/
 
65
 
 
66
time_t pdb_password_change_time_max(void)
 
67
{
 
68
        return 0x7FFFFFFF;
 
69
}
 
70
 
 
71
/*********************************************************************
42
72
 Collection of get...() functions for struct samu.
43
73
 ********************************************************************/
44
74
 
86
116
           we're trying to update this real value from the sampass
87
117
           to indicate that the user cannot change their password.  jmcd
88
118
        */
89
 
        if (sampass->pass_can_change_time == get_time_t_max() &&
 
119
        if (pdb_is_password_change_time_max(sampass->pass_can_change_time) &&
90
120
            IS_SAM_CHANGED(sampass, PDB_CANCHANGETIME))
91
121
                return sampass->pass_can_change_time;
92
122
 
112
142
                return (time_t) 0;
113
143
 
114
144
        if (sampass->acct_ctrl & ACB_PWNOEXP)
115
 
                return get_time_t_max();
 
145
                return pdb_password_change_time_max();
116
146
 
117
147
        if (!pdb_get_account_policy(PDB_POLICY_MAX_PASSWORD_AGE, &expire)
118
148
            || expire == (uint32_t)-1 || expire == 0)
123
153
 
124
154
bool pdb_get_pass_can_change(const struct samu *sampass)
125
155
{
126
 
        if (sampass->pass_can_change_time == get_time_t_max())
 
156
        if (pdb_is_password_change_time_max(sampass->pass_can_change_time))
127
157
                return False;
128
158
        return True;
129
159
}
958
988
bool pdb_set_pass_can_change(struct samu *sampass, bool canchange)
959
989
{
960
990
        return pdb_set_pass_can_change_time(sampass, 
961
 
                                     canchange ? 0 : get_time_t_max(),
 
991
                                     canchange ? 0 : pdb_password_change_time_max(),
962
992
                                     PDB_CHANGED);
963
993
}
964
994