Esempio n. 1
0
 def _ReadEntry(self, entry):
     """Return a SshkeyMapEntry from a record in the target cache."""
     entry = entry.split(':')
     map_entry = sshkey.SshkeyMapEntry()
     # maps expect strict typing, so convert to int as appropriate.
     map_entry.name = entry[0]
     map_entry.sshkey = entry[1]
     return map_entry
Esempio n. 2
0
  def Transform(self, obj):
    """Transforms a LDAP posixAccount data structure into a SshkeyMapEntry."""

    skey = sshkey.SshkeyMapEntry()

    skey.name = obj['uid'][0]

    if 'sshPublicKey' in obj:
      skey.sshkey = obj['sshPublicKey']
    else:
      skey.sshkey = ''

    return skey
Esempio n. 3
0
  def Transform(self, obj):
    """Transforms a LDAP posixAccount data structure into a SshkeyMapEntry."""

    skey = sshkey.SshkeyMapEntry()

    if 'uidattr' in self.conf:
      skey.name = obj[uidattr][0]
    else:
      skey.name = obj['uid'][0]

    if hasattr(self, 'uidregex'):
      skey.name = ''.join([x for x in self.uidregex.findall(pw.name)])

    if 'sshPublicKey' in obj:
      skey.sshkey = obj['sshPublicKey']
    else:
      skey.sshkey = ''

    return skey