~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source4/heimdal/lib/asn1/timegm.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* 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/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
43
43
}
44
44
 
 
45
static const unsigned ndays[2][12] ={
 
46
    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
 
47
    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
 
48
 
45
49
/*
46
50
 * This is a simplifed version of timegm(3) that doesn't accept out of
47
51
 * bound values that timegm(3) normally accepts but those are not
51
55
time_t
52
56
_der_timegm (struct tm *tm)
53
57
{
54
 
  static const unsigned ndays[2][12] ={
55
 
    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
56
 
    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
57
58
  time_t res = 0;
58
59
  unsigned i;
59
60
 
84
85
  res += tm->tm_sec;
85
86
  return res;
86
87
}
 
88
 
 
89
struct tm *
 
90
_der_gmtime(time_t t, struct tm *tm)
 
91
{
 
92
    time_t secday = t % (3600 * 24);
 
93
    time_t days = t / (3600 * 24);
 
94
 
 
95
    memset(tm, 0, sizeof(*tm));
 
96
 
 
97
    tm->tm_sec = secday % 60;
 
98
    tm->tm_min = (secday % 3600) / 60;
 
99
    tm->tm_hour = secday / 3600;
 
100
 
 
101
    tm->tm_year = 70;
 
102
    while(1) {
 
103
        unsigned dayinyear = (is_leap(tm->tm_year) ? 366 : 365);
 
104
        if (days < dayinyear)
 
105
            break;
 
106
        tm->tm_year += 1;
 
107
        days -= dayinyear;
 
108
    }
 
109
    tm->tm_mon = 0;
 
110
 
 
111
    while (1) {
 
112
        unsigned daysinmonth = ndays[is_leap(tm->tm_year)][tm->tm_mon];
 
113
        if (days < daysinmonth)
 
114
            break;
 
115
        days -= daysinmonth;
 
116
        tm->tm_mon++;
 
117
    }
 
118
    tm->tm_mday = days + 1;
 
119
 
 
120
    return tm;
 
121
}