Skip to content
Snippets Groups Projects

Convert ldap account entries to inetOrgPerson

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by meskio
    Edited
    parser.py 476 B
    #!/usr/bin/python
    
    import sys
    
    
    uid = ""
    for line in sys.stdin:
        line = line[:-1]
    
        items = line.split(": ", 1)
        if len(items) != 2:
            print(line)
            continue
    
        if items[0] == "uid":
            uid = items[1]
    
        if items[1] == "account":
            print("%s: %s" % (items[0], "inetOrgPerson"))
            if items[0] == "structuralObjectClass":
                print("sn: %s" % uid)
                print("mail: %s@sindominio.net" % uid)
        else:
            print(line)
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment