~ubuntu-branches/ubuntu/wily/nss-pam-ldapd/wily-proposed

« back to all changes in this revision

Viewing changes to pynslcd/ether.py

  • Committer: Package Import Robot
  • Author(s): Arthur de Jong
  • Date: 2014-06-08 14:00:00 UTC
  • mfrom: (16.1.8) (14.1.12 experimental)
  • Revision ID: package-import@ubuntu.com-20140608140000-rt6fspljmk9252zd
Tags: 0.9.4-1
* upload to unstable
* new upstream release:
  - also handle password policy information on BIND failure (this makes it
    possible to distinguish between a wrong password and an expired
    password)
  - fix mapping the member attribute to an empty string
  - any buffers that may have held passwords are cleared before the memory
    is released
  - increase buffer size for passwords to support extremely long passwords
    (thanks ushi)
  - increase buffer size for DN to support very long names or names with
    non-ASCII characters
  - log an error in almost all places where a defined buffer is not large
    enough to hold the provided data instead of just (sometimes silently)
    failing
  - logging improvements (start-up problems, login failures)
* add signature checking option to watch file
* add a debian/upstream/metadata file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
# ether.py - lookup functions for ethernet addresses
3
3
#
4
 
# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 
4
# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
5
5
#
6
6
# This library is free software; you can redistribute it and/or
7
7
# modify it under the terms of the GNU Lesser General Public
23
23
import cache
24
24
import common
25
25
import constants
 
26
import search
26
27
 
27
28
 
28
29
def ether_aton(ether):
40
41
filter = '(objectClass=ieee802Device)'
41
42
 
42
43
 
43
 
class Search(common.Search):
 
44
class Search(search.LDAPSearch):
44
45
 
45
46
    case_insensitive = ('cn', )
46
47
    limit_attributes = ('cn', 'macAddress')
47
48
    required = ('cn', 'macAddress')
48
49
 
 
50
    def mk_filter(self):
 
51
        # we need a custom mk_filter because this is an | query
 
52
        if 'macAddress' in self.parameters:
 
53
            ether = self.parameters['macAddress']
 
54
            alt_ether = ':'.join('%02x' % int(x, 16) for x in ether.split(':'))
 
55
            return '(&%s(|(%s=%s)(%s=%s)))' % (self.filter,
 
56
                      attmap['macAddress'], ether,
 
57
                      attmap['macAddress'], alt_ether)
 
58
        return super(Search, self).mk_filter()
 
59
 
49
60
 
50
61
class Cache(cache.Cache):
51
 
    pass
 
62
 
 
63
    create_sql = '''
 
64
        CREATE TABLE IF NOT EXISTS `ether_cache`
 
65
          ( `cn` TEXT NOT NULL COLLATE NOCASE,
 
66
            `macAddress` TEXT NOT NULL COLLATE NOCASE,
 
67
            `mtime` TIMESTAMP NOT NULL,
 
68
            UNIQUE (`cn`, `macAddress`) );
 
69
    '''
52
70
 
53
71
 
54
72
class EtherRequest(common.Request):