Open Directory deleted objects

Hi,
I am familiar with performing ldap searches on Active Directory. I was wondering if the Open Directory has support for tombstone objects like AD or does it have other method to store the deleted objects which can be retrieved using an ldap search?

The article is still valid so you can refer to it and apply what is mentioned.
Of course, it is always recommend to try changes in a test environment before going to production.
This posting is provided AS IS with no warranties or guarantees , and confers no rights.
Ahmed MALEK
My Website Link
My Linkedin Profile
My MVP Profile

Similar Messages

  • Does mac server 3.2.1 open directory support object class "sambaSamAccount"?

    Hi:
         I use open directory to be a directory service in mac server 3.2.1, and in client side is a linux os.
    I want the user can access data via samba. So i add "objectclass: sambaSamAccount" to user by directory utility,
    and i also copy linux samba.schema replace the default samba.schema but always show the error message.
    The attribute value could not be used because it does not meet the requirements of the attribute.
    What problem with it? I miss do something?
              thanks

    Just to clarify - this is where i get to and after somehow right-clicking and opening this red-marked folder, the contents are seemingly empty
    However I tried drag-dropping the folder to the field where you browse for backup and it found contents as it requested passowrd for archive. I input it but then get this:
    And If I want to create one, I get the "Invalid hostname" error and can not continue
    What now?

  • Can't delete any object (usr/compt) in my Open Directory

    I'm having some old computers object stuck in my Open Directory server I can't remove. Those are some previously joined computers who aren't existing anymore or have changing their names. When I go in my Workground Manager utility and select the computer object and hit the delete button, I got a error message and bad objet stay there. My OD server is running on a brand new XServe Intel running on Mac OS-X Server 10.5.6 and I've done all updates. My OD is an "OD Master Server" and my clients computers are both joined to an Active Directory Server (Windows 2003) and on the OD server. My OD Server are mainly used to manage system preferences and for files/printers sharing.
    *By the way, I can't delete NONE of the objects in my OD. All computers objects and all user objects do the same error message.*
    Too bad I can't just post screenshot of the error message, but here it is :
    *Got unexpected error*
    Error of type eDSAuthNoAuthServerFound (-14102) on line 1645 of /SourceCache/WorkgrounpManager/Workgroupmanager-319.1.1/PMMUGMainView.mm
    I do some several search on Google and on Apple Discussions about this problem, but I can't find how to fix it. I'm not really interested by wiping all my server if it's possible...
    Thank you for your help!

    It appears that your browser is also having problems!
    When you say you "click stop" do you mean a programmatic stop in a loop or whatever, or do you mean the "stop sign" in the LabVIEW toolbar? If it is the later then you are probably not performing the proper clean up. I don't know how your C# objects are called, but in our project using .NET components I have a call that produces a reference, the reference is used by various calls to the methods, then I have a discrete close that signals the .NET to dispose. If I used the "stop sign" to stop the close would occur and resources would probably be left open.
    As another poster says in his signature (I'm paraphrasing)  "Using the stop button is like using a tree to stop your car, it works, but isn't recommended"  Sorry for the misquote!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Querying deleted objects container in Active Directory using JNDI

    Hi,
    I am trying to query deleted objects container using JNDI which fails with error 64.
    Has anyone seen this or knows how to query AD using binary data in JNDI.
    Seems to me there is some problem with the search base.
    search base: <GUID=18E2EA80684F11D2B9AA00C04F79F805,dc=engserver,dc=com>.
    filter: objectclass=*
    search scope: subtree
    This is the error:
    Search example failed.
    javax.naming.InvalidNameException: <GUID=18E2EA80684F11D2B9AA00C04F79F805,dc=eng
    server,dc=com>: [LDAP: error code 64 - 00000057: LdapErr: DSID-0C090563, comment
    : Error processing name, data 0, v893 ]; remaining name '<GUID=18E2EA80684F11D2B
    9AA00C04F79F805,dc=engserver,dc=com>'
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2802)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2616)
    at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1744)
    at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1667)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirCon
    text.java:368)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCom
    positeDirContext.java:328)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCom
    positeDirContext.java:313)
    at javax.naming.directory.InitialDirContext.search(InitialDirContext.jav
    a:245)
    at jSearch.main(jSearch.java, Compiled Code)
    Thanks,
    Chetan

    I thought I had posted one of these. How remiss of me !/**
    * deleted.java
    * 5 July 2001
    * Sample JNDI application to search for deleted objects
    * Modified December 2004 to add Win2K3 lastKnownParent
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import com.sun.jndi.ldap.ctl.*;
    class DeletedControl implements Control {
         public byte[] getEncodedValue() {
              return new byte[] {};
         public String getID() {
              return "1.2.840.113556.1.4.417";
         public boolean isCritical() {
              return true;
    public class deleted     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls           
                   SearchControls searchCtls = new SearchControls();
                   //Specify the attributes to return
                   String returnedAtts[]={"distinguishedName","lastKnownParent"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(isDeleted=TRUE))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the results
                   int totalResults = 0;
                   //specify the Deleted control
                   Control[] rqstCtls = new Control[] {new DeletedControl()};
                   ctx.setRequestControls(rqstCtls);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        totalResults++;
                        System.out.println(totalResults + ". " + sr.getName().toString());
                        // Print out some of the attributes, catch the exception if the attributes have no values
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();System.out.println("   " + e.next().toString()));
                             catch (NullPointerException e)     {
                             System.err.println("Problem listing attributes: " + e);
                   System.out.println("Deleted objects: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
              System.err.println("Problem searching directory: " + e);
    }

  • Cfldap and deleted objects container in Active Directory

    Hello,
    I am trying to use a CFLDAP query to bind and search in the
    Deleted Objects container of Active Directory. This would allow me
    to get the sAMAccountname values of the users who have been deleted
    within the last default 60 days (searching tombstone objects in
    Deleted Objects).
    I have tried various methods including <cfldap
    start="CN=Deleted Objects, DC=<domain>, DC=<com>> (I
    am omitting the rest of the CFLDAP attributes in the example
    above). I'm not sure if CFLDAP can even query the deleted objects
    container. Has anyone had any experience with this?
    Thanks,
    Ben

    Hi Michael,
    Thanks for your help! I have however already explored those
    solutions offered by Microsoft. Sadly, they only work in separate
    programs (i.e. ldap.exe which comes with Windows Server tools).
    After lots of research I have found a Java method that can bind
    with the container and return the results. CFLDAP, I'm afraid is
    just not capable of doing this - or at least I have had no luck
    with it (I was connecting as domain admin btw).
    The challenge now is to get the Java class to communicate
    with the rest of my cf code.
    Thanks again,
    Ben

  • Scripts for adding/deleting/modifying Open Directory accounts?

    I think I have searched high and low for an answer to this question, but if I missed it please point me in the right direction. Where can I find information on scripts for adding/deleting/modifying open directory accounts? At the very least, a command line utility with some syntax guidelines! Any help would be greatly appreciated.

    Hi
    I personally don't know if any scripts although you can use the command line to do pretty much anything you want with the Open Directory. Consult the manual: man dscl. If you launch terminal and issue dscl you should see something like this:
    my-Laptop:~ me$ dscl
    dscl (v20.4)
    usage: dscl [options] [<datasource> [<command>]]
    datasource:
    localhost (default) or
    <hostname> (requires DS proxy support, >= DS-158) or
    <nodename> (Directory Service style node name) or
    <domainname> (NetInfo style domain name)
    options:
    -u <user> authenticate as user (required when using DS Proxy)
    -P <password> authentication password
    -p prompt for password
    -raw don't strip off prefix from DS constants
    -url print record attribute values in URL-style encoding
    -q quiet - no interactive prompt
    commands:
    -read <path> [<key>...]
    -create <record path> [<key> [<val>...]]
    -delete <path> [<key> [<val>...]]
    -list <path> [<key>]
    -append <record path> <key> <val>...
    -merge <record path> <key> <val>...
    -change <record path> <key> <old value> <new value>
    -changei <record path> <key> <value index> <new value>
    -search <path> <key> <val>
    -auth [<user> [<password>]]
    -authonly [<user> [<password>]]
    -passwd <user path> [<new password> | <old password> <new password>]
    Entering interactive mode...
    The above is for 10.4 and should server equally as well for 10.5.
    Hope this helps, Tony

  • Deleted Open Directory but WGM Policies are stuck

    I removed my Macbook Pro from our Open Directory server (unbind) and then I sold the server. The problem is now my MacBook is suddenly locking me out of the exact same preference panels that the WGM in the server used to lock me out of (as per policy). I can't access the Account panel, Sharing panel, or any custom ones such as Growl/ NTFS-3G or anything that wasn't on the server itself. How can I delete the WGM prefences restrictions that are on my machine? I have full access to the Terminal, and can su to the root account, as well as me being an Administrator on the OS itself. I just can't access these panels as they were blocked from all network users. I really don't want to reformat my Mac over this. Thanks

    Hi, I'm having a similar issue, but the client is Snow Leopard 10.6.6, not Snow Leopard Server. I don't believe Workgroup Manager comes with the client (plain Snow Leopard) OS. If it does, please help me find it. I have found these (http://discussions.apple.com/thread.jspa?threadID=726115&tstart=855) command line options, but they're from an old post and it hasn't seemed to work. Here is my post: http://discussions.apple.com/thread.jspa?messageID=13262474&#13262474

  • After Updating to Server 4.1 Open directory and LPAD gone

    Hello,
    two days ago I discovered that Open directory was not working on our Server (Mac Mini 2012). I suspect it stopped working after updating to 10.10.3 and OS-X Server 4.1. When I try to start Open directory in the Server App the Server App prompts: Unable to load Replica List. When I try to recreate my Open directory Server I Get: OD Server already exists.
    I get the following log entries:
    LDAP Log
    Apr 11 22:03:02 server.seju.eu slapd[925]: @(#) $OpenLDAP: slapd 2.4.28 (Feb 24 2015 21:45:59) $
      [email protected]:/BinaryCache/OpenLDAP/OpenLDAP-499.32.4~1/Objects/servers/slapd
    Apr 11 22:03:02 server.seju.eu slapd[925]: daemon: SLAP_SOCK_INIT: dtblsize=8192
    Apr 11 22:03:02 server.seju.eu slapd[925]: TLS: OPENDIRECTORY_SSL_IDENTITY identity preference overrode configured olcTLSIdentity "APPLE:server.seju.eu"
    Apr 11 22:03:02 server.seju.eu slapd[925]: slap_add_listener: opened additional listener 'ldaps:///'
    Apr 11 22:03:02 server.seju.eu slapd[925]: bdb(dc=server,dc=seju,dc=eu): unable to allocate memory for mutex; resize mutex region
    Apr 11 22:03:02 server.seju.eu slapd[925]: bdb_db_open: database "dc=server,dc=seju,dc=eu" cannot be opened, err 12. Restore from backup!
    Apr 11 22:03:02 server.seju.eu slapd[925]: bdb(dc=server,dc=seju,dc=eu): txn_checkpoint interface requires an environment configured for the transaction subsystem
    Apr 11 22:03:02 server.seju.eu slapd[925]: bdb_db_close: database "dc=server,dc=seju,dc=eu": txn_checkpoint failed: Invalid argument (22).
    Apr 11 22:03:02 server.seju.eu slapd[925]: backend_startup_one (type=bdb, suffix="dc=server,dc=seju,dc=eu"): bi_db_open failed! (12)
    Apr 11 22:03:02 server.seju.eu slapd[925]: bdb_db_close: database "dc=server,dc=seju,dc=eu": alock_close failed
    Apr 11 22:03:02 server.seju.eu slapd[925]: slapd stopped.
    Open Directory Log
    2015-04-11 21:57:10.624284 CEST - AID: 0x0000000000000000 - opendirectoryd (build 382.20.2) launched...
    2015-04-11 21:57:10.752590 CEST - AID: 0x0000000000000000 - Logging level limit changed to 'error'
    2015-04-11 21:57:10.916732 CEST - AID: 0x0000000000000000 - Initialize trigger support
    2015-04-11 21:57:10.951833 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/SystemCache.bundle'
    2015-04-11 21:57:10.958469 CEST - AID: 0x0000000000000000 - Module: SystemCache - failed to load persistent state - Input/output error
    2015-04-11 21:57:10.962533 CEST - AID: 0x0000000000000000 - Registered node with name '/Active Directory' as hidden
    2015-04-11 21:57:10.962833 CEST - AID: 0x0000000000000000 - Registered node with name '/Configure' as hidden
    2015-04-11 21:57:10.963182 CEST - AID: 0x0000000000000000 - Discovered configuration for node name '/Contacts' at path '/Library/Preferences/OpenDirectory/Configurations//Contacts.plist'
    2015-04-11 21:57:10.963194 CEST - AID: 0x0000000000000000 - Registered node with name '/Contacts'
    2015-04-11 21:57:10.963438 CEST - AID: 0x0000000000000000 - Registered node with name '/LDAPv3' as hidden
    2015-04-11 21:57:10.966901 CEST - AID: 0x0000000000000000 - Registered node with name '/Local' as hidden
    2015-04-11 21:57:10.968600 CEST - AID: 0x0000000000000000 - Registered node with name '/NIS' as hidden
    2015-04-11 21:57:11.031990 CEST - AID: 0x0000000000000000 - Discovered configuration for node name '/Search' at path '/Library/Preferences/OpenDirectory/Configurations//Search.plist'
    2015-04-11 21:57:11.032007 CEST - AID: 0x0000000000000000 - Registered node with name '/Search'
    2015-04-11 21:57:12.343838 CEST - AID: 0x0000000000000000 - Discovered configuration for node name '/LDAPv3/127.0.0.1' at path '/Library/Preferences/OpenDirectory/Configurations/LDAPv3/127.0.0.1.plist'
    2015-04-11 21:57:12.343888 CEST - AID: 0x0000000000000000 - Registered subnode with name '/LDAPv3/127.0.0.1'
    2015-04-11 21:57:13.549377 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/legacy.bundle'
    2015-04-11 21:57:13.551131 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/search.bundle'
    2015-04-11 21:57:13.554053 CEST - AID: 0x0000000000000000 - '/Search' has registered, loading additional services
    2015-04-11 21:57:13.554064 CEST - AID: 0x0000000000000000 - Initialize augmentation support
    2015-04-11 21:57:13.557920 CEST - AID: 0x0000000000000000 - Successfully registered for Kernel identity service requests
    2015-04-11 21:57:13.557940 CEST - AID: 0x0000000000000000 - Adjusting kernel ID cache (100 -> 250) and membership cache (100 -> 500)
    2015-04-11 21:57:13.575235 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/PlistFile.bundle'
    2015-04-11 21:57:13.578418 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/FDESupport.bundle'
    2015-04-11 21:57:13.583810 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/AppleID.bundle'
    2015-04-11 21:57:13.615788 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/ConfigurationProfiles.bundle'
    2015-04-11 21:57:13.619666 CEST - AID: 0x0000000000000000 - Registered subnode with name '/Local/Default'
    2015-04-11 21:57:13.632498 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/ldap.bundle'
    2015-04-11 21:57:13.845588 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/AppleODClientLDAP.bundle'
    2015-04-11 21:57:13.849664 CEST - AID: 0x0000000000000000 - Loaded bundle at path '/System/Library/OpenDirectory/Modules/AppleODClientPWS.bundle'

    I had a similar problem. A couple days after upgrading, I encountered OD's "Unable to load replica" problem and had my server's certificate deleted from my system keychain!
    Server.app + OD + LDAP are all extremely fragile and I just don't trust them during transitions, so I always keep an independent bootable backup with Carbon Copy Cloner and this preflight script. I'll post my notes for recovering OD below, but in my case, nothing worked this time, and I couldn't start OD robustly across reboots. Fortunately for me, my 12 hour old bootable backup was working, so I just used CCC to copy my bootable backup back. Not sure what I would have done had that not worked short of rebuilding everything from scratch.
    Pre-steps:
    0. Bootable backups, Time Machine backups, and dirserv backups of everything.
    1. Disk Utility: Fix disk permissions, Fix disk
    2. PRAM reset, Command-Option-P-R at boot
    3. DiskWarrior to rebuild the disk directory
    Possible steps to fix OD:
    # Fix Open Directory "Unable to load replica"
    # Try this first:
    # https://support.apple.com/en-us/HT200018
    # Quit Server.app
    sudo mkdir /var/db/openldap/migration/
    sudo touch /var/db/openldap/migration/.rekerberize
    sudo killall PasswordService
    # Open Server.app
    # Try this second:
    # http://apple.stackexchange.com/questions/79141/how-to-fix-failing-open-directory -database-cn-authdata-cannot-be-opened-err
    sudo serveradmin stop dirserv
    sudo launchctl unload -w /System/Library/LaunchDaemons/org.openldap.slapd.plist
    sudo db_recover -h /var/db/openldap/authdata/
    sudo /usr/libexec/slapd -Tt
    sudo launchctl load -w /System/Library/LaunchDaemons/org.openldap.slapd.plist
    sudo serveradmin start dirserv
    # Try this third:
    # https://discussions.apple.com/thread/6018956
    sudo serveradmin stop dirserv
    sudo slapconfig -restoredb /private/var/backups/ServerBackup_OpenDirectoryMaster.sparseimage
    sudo serveradmin start dirserv
    # Try this fourth (assuming ccc_preflight od backup):
    # https://discussions.apple.com/thread/6018956
    sudo serveradmin stop dirserv
    sudo slapconfig -restoredb /private/var/backups/odbackup/od_2015-04-11.sparseimage
    sudo serveradmin start dirserv
    # Try this last:
    sudo rsync -va /your-backup-drive-possibly-TM/private/var/db/openldap/authdata/ /private/var/db/openldap/authdata/
    If your server cert gets deleted from the System keychain, you'll need to boot into the bootable backup and export the certificate+key that looks like hostname.domainname.tld, signed by IntermediateCA_HOSTNAME.DOMAINNAME.TLD_1, copy this to the server drive, import back into the System keychain. The cert should then appear within Server.app again. See here for how to do this if all you have is the System keychain file.
    If anyone has reliable advice how to fix a corrupt OD that would be a huge help.

  • RoundCube Webmail Authenticating against Open Directory on Mountain Lion 10.8.x

    Hello all,
    I've been battling this issue for over a month with no success. Here is what we got:
    Mac Mini Server running Mountain Lion Server 10.8.2 running Calendar, Contacts, Mail and Web services.
    With there being no webmail present I've gone thru the process of installing RoundCube.
    I'm using Postgres as the database.
    When I test the ability to login I get the following error messages in the console.app
    10/12/12 10:13:27.071 AM log[182]: auth: Error: od(andrew,::1): Authentication server failed to complete the requested operation.
    10/12/12 10:13:27.071 AM log[182]: auth: Error: od(andrew,::1): authentication failed for user=andrew, method=DIGEST-MD5
    The first line I find the most interesting but have had no success determinign exactly what it means.
    I'm using open directory to authenticate and it is working perfectly with every other service so I'm led to believe it's an issue between RoundCube and Open Directory.
    ANY help would be appreciated emmensely!

    Sorry about taking so long to get back on here working on this. I've switched over to MySQL. I had a hard time because mysql.sock was located under /tmp/ rather than /var/mysql/ but I fixed that by using the following command:
    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
    Then I reinstalled roundcube. Here is my main.inc.php file:
    <?php
    +-----------------------------------------------------------------------+
    | Main configuration file                                               |
    |                                                                       |
    | This file is part of the Roundcube Webmail client                     |
    | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
    |                                                                       |
    | Licensed under the GNU General Public License version 3 or            |
    | any later version with exceptions for skins & plugins.                |
    | See the README file for a full license statement.                     |
    |                                                                       |
    +-----------------------------------------------------------------------+
    $rcmail_config = array();
    // LOGGING/DEBUGGING
    // system error reporting: 1 = log; 2 = report (not implemented yet), 4 = show, 8 = trace
    $rcmail_config['debug_level'] = 1;
    // log driver:  'syslog' or 'file'.
    $rcmail_config['log_driver'] = 'file';
    // date format for log entries
    // (read http://php.net/manual/en/function.date.php for all format characters) 
    $rcmail_config['log_date_format'] = 'd-M-Y H:i:s O';
    // Syslog ident string to use, if using the 'syslog' log driver.
    $rcmail_config['syslog_id'] = 'roundcube';
    // Syslog facility to use, if using the 'syslog' log driver.
    // For possible values see installer or http://php.net/manual/en/function.openlog.php
    $rcmail_config['syslog_facility'] = LOG_USER;
    // Log sent messages to <log_dir>/sendmail or to syslog
    $rcmail_config['smtp_log'] = true;
    // Log successful logins to <log_dir>/userlogins or to syslog
    $rcmail_config['log_logins'] = false;
    // Log session authentication errors to <log_dir>/session or to syslog
    $rcmail_config['log_session'] = false;
    // Log SQL queries to <log_dir>/sql or to syslog
    $rcmail_config['sql_debug'] = false;
    // Log IMAP conversation to <log_dir>/imap or to syslog
    $rcmail_config['imap_debug'] = false;
    // Log LDAP conversation to <log_dir>/ldap or to syslog
    $rcmail_config['ldap_debug'] = false;
    // Log SMTP conversation to <log_dir>/smtp or to syslog
    $rcmail_config['smtp_debug'] = false;
    // IMAP
    // the mail host chosen to perform the log-in
    // leave blank to show a textbox at login, give a list of hosts
    // to display a pulldown menu or set one host as string.
    // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
    // Supported replacement variables:
    // %n - http hostname ($_SERVER['SERVER_NAME'])
    // %d - domain (http hostname without the first part)
    // %s - domain name after the '@' from e-mail address provided at login screen
    // For example %n = mail.domain.tld, %d = domain.tld
    $rcmail_config['default_host'] = 'localhost';
    // TCP port used for IMAP connections
    $rcmail_config['default_port'] = 143;
    // IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
    // best server supported one)
    $rcmail_config['imap_auth_type'] = null;
    // If you know your imap's folder delimiter, you can specify it here.
    // Otherwise it will be determined automatically
    $rcmail_config['imap_delimiter'] = null;
    // If IMAP server doesn't support NAMESPACE extension, but you're
    // using shared folders or personal root folder is non-empty, you'll need to
    // set these options. All can be strings or arrays of strings.
    // Folders need to be ended with directory separator, e.g. "INBOX."
    // (special directory "~" is an exception to this rule)
    // These can be used also to overwrite server's namespaces
    $rcmail_config['imap_ns_personal'] = null;
    $rcmail_config['imap_ns_other']    = null;
    $rcmail_config['imap_ns_shared']   = null;
    // By default IMAP capabilities are readed after connection to IMAP server
    // In some cases, e.g. when using IMAP proxy, there's a need to refresh the list
    // after login. Set to True if you've got this case.
    $rcmail_config['imap_force_caps'] = false;
    // By default list of subscribed folders is determined using LIST-EXTENDED
    // extension if available. Some servers (dovecot 1.x) returns wrong results
    // for shared namespaces in this case. http://trac.roundcube.net/ticket/1486225
    // Enable this option to force LSUB command usage instead.
    $rcmail_config['imap_force_lsub'] = false;
    // Some server configurations (e.g. Courier) doesn't list folders in all namespaces
    // Enable this option to force listing of folders in all namespaces
    $rcmail_config['imap_force_ns'] = false;
    // IMAP connection timeout, in seconds. Default: 0 (no limit)
    $rcmail_config['imap_timeout'] = 0;
    // Optional IMAP authentication identifier to be used as authorization proxy
    $rcmail_config['imap_auth_cid'] = null;
    // Optional IMAP authentication password to be used for imap_auth_cid
    $rcmail_config['imap_auth_pw'] = null;
    // Type of IMAP indexes cache. Supported values: 'db', 'apc' and 'memcache'.
    $rcmail_config['imap_cache'] = null;
    // Enables messages cache. Only 'db' cache is supported.
    $rcmail_config['messages_cache'] = false;
    // SMTP
    // SMTP server host (for sending mails).
    // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
    // If left blank, the PHP mail() function is used
    // Supported replacement variables:
    // %h - user's IMAP hostname
    // %n - http hostname ($_SERVER['SERVER_NAME'])
    // %d - domain (http hostname without the first part)
    // %z - IMAP domain (IMAP hostname without the first part)
    // For example %n = mail.domain.tld, %d = domain.tld
    $rcmail_config['smtp_server'] = 'localhost';
    // SMTP port (default is 25; use 587 for STARTTLS or 465 for the
    // deprecated SSL over SMTP (aka SMTPS))
    $rcmail_config['smtp_port'] = 25;
    // SMTP username (if required) if you use %u as the username Roundcube
    // will use the current username for login
    $rcmail_config['smtp_user'] = '';
    // SMTP password (if required) if you use %p as the password Roundcube
    // will use the current user's password for login
    $rcmail_config['smtp_pass'] = '';
    // SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
    // best server supported one)
    $rcmail_config['smtp_auth_type'] = '';
    // Optional SMTP authentication identifier to be used as authorization proxy
    $rcmail_config['smtp_auth_cid'] = null;
    // Optional SMTP authentication password to be used for smtp_auth_cid
    $rcmail_config['smtp_auth_pw'] = null;
    // SMTP HELO host
    // Hostname to give to the remote server for SMTP 'HELO' or 'EHLO' messages
    // Leave this blank and you will get the server variable 'server_name' or
    // localhost if that isn't defined.
    $rcmail_config['smtp_helo_host'] = '';
    // SMTP connection timeout, in seconds. Default: 0 (no limit)
    $rcmail_config['smtp_timeout'] = 0;
    // SYSTEM
    // THIS OPTION WILL ALLOW THE INSTALLER TO RUN AND CAN EXPOSE SENSITIVE CONFIG DATA.
    // ONLY ENABLE IT IF YOU'RE REALLY SURE WHAT YOU'RE DOING!
    $rcmail_config['enable_installer'] = false;
    // provide an URL where a user can get support for this Roundcube installation
    // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
    $rcmail_config['support_url'] = 'http://www.crawfordworks.ca/contact';
    // replace Roundcube logo with this image
    // specify an URL relative to the document root of this Roundcube installation
    $rcmail_config['skin_logo'] = null;
    // automatically create a new Roundcube user when log-in the first time.
    // a new user will be created once the IMAP login succeeds.
    // set to false if only registered users can use this service
    $rcmail_config['auto_create_user'] = true;
    // use this folder to store log files (must be writeable for apache user)
    // This is used by the 'file' log driver.
    $rcmail_config['log_dir'] = 'logs/';
    // use this folder to store temp files (must be writeable for apache user)
    $rcmail_config['temp_dir'] = 'temp/';
    // lifetime of message cache
    // possible units: s, m, h, d, w
    $rcmail_config['message_cache_lifetime'] = '10d';
    // enforce connections over https
    // with this option enabled, all non-secure connections will be redirected.
    // set the port for the ssl connection as value of this option if it differs from the default 443
    $rcmail_config['force_https'] = false;
    // tell PHP that it should work as under secure connection
    // even if it doesn't recognize it as secure ($_SERVER['HTTPS'] is not set)
    // e.g. when you're running Roundcube behind a https proxy
    // this option is mutually exclusive to 'force_https' and only either one of them should be set to true.
    $rcmail_config['use_https'] = false;
    // Allow browser-autocompletion on login form.
    // 0 - disabled, 1 - username and host only, 2 - username, host, password
    $rcmail_config['login_autocomplete'] = 0;
    // Forces conversion of logins to lower case.
    // 0 - disabled, 1 - only domain part, 2 - domain and local part.
    // If users authentication is not case-sensitive this must be enabled.
    // After enabling it all user records need to be updated, e.g. with query:
    // UPDATE users SET username = LOWER(username);
    $rcmail_config['login_lc'] = 0;
    // Includes should be interpreted as PHP files
    $rcmail_config['skin_include_php'] = false;
    // display software version on login screen
    $rcmail_config['display_version'] = false;
    // Session lifetime in minutes
    // must be greater than 'keep_alive'/60
    $rcmail_config['session_lifetime'] = 10;
    // session domain: .example.org
    $rcmail_config['session_domain'] = '';
    // session name. Default: 'roundcube_sessid'
    $rcmail_config['session_name'] = null;
    // Backend to use for session storage. Can either be 'db' (default) or 'memcache'
    // If set to memcache, a list of servers need to be specified in 'memcache_hosts'
    // Make sure the Memcache extension (http://pecl.php.net/package/memcache) version >= 2.0.0 is installed
    $rcmail_config['session_storage'] = 'db';
    // Use these hosts for accessing memcached
    // Define any number of hosts in the form of hostname:port or unix:///path/to/sock.file
    $rcmail_config['memcache_hosts'] = null; // e.g. array( 'localhost:11211', '192.168.1.12:11211', 'unix:///var/tmp/memcached.sock' );
    // check client IP in session athorization
    $rcmail_config['ip_check'] = false;
    // check referer of incoming requests
    $rcmail_config['referer_check'] = false;
    // X-Frame-Options HTTP header value sent to prevent from Clickjacking.
    // Possible values: sameorigin|deny. Set to false in order to disable sending them
    $rcmail_config['x_frame_options'] = 'sameorigin';
    // this key is used to encrypt the users imap password which is stored
    // in the session record (and the client cookie if remember password is enabled).
    // please provide a string of exactly 24 chars.
    $rcmail_config['des_key'] = 'Qw4jLYQK+MyNLPIRmON7Lq+Z';
    // Automatically add this domain to user names for login
    // Only for IMAP servers that require full e-mail addresses for login
    // Specify an array with 'host' => 'domain' values to support multiple hosts
    // Supported replacement variables:
    // %h - user's IMAP hostname
    // %n - http hostname ($_SERVER['SERVER_NAME'])
    // %d - domain (http hostname without the first part)
    // %z - IMAP domain (IMAP hostname without the first part)
    // For example %n = mail.domain.tld, %d = domain.tld
    $rcmail_config['username_domain'] = '';
    // This domain will be used to form e-mail addresses of new users
    // Specify an array with 'host' => 'domain' values to support multiple hosts
    // Supported replacement variables:
    // %h - user's IMAP hostname
    // %n - http hostname ($_SERVER['SERVER_NAME'])
    // %d - domain (http hostname without the first part)
    // %z - IMAP domain (IMAP hostname without the first part)
    // For example %n = mail.domain.tld, %d = domain.tld
    $rcmail_config['mail_domain'] = '';
    // Password charset.
    // Use it if your authentication backend doesn't support UTF-8.
    // Defaults to ISO-8859-1 for backward compatibility
    $rcmail_config['password_charset'] = 'ISO-8859-1';
    // How many seconds must pass between emails sent by a user
    $rcmail_config['sendmail_delay'] = 0;
    // Maximum number of recipients per message. Default: 0 (no limit)
    $rcmail_config['max_recipients'] = 0;
    // Maximum allowednumber of members of an address group. Default: 0 (no limit)
    // If 'max_recipients' is set this value should be less or equal
    $rcmail_config['max_group_members'] = 0;
    // add this user-agent to message headers when sending
    $rcmail_config['useragent'] = 'Roundcube Webmail/'.RCMAIL_VERSION;
    // use this name to compose page titles
    $rcmail_config['product_name'] = 'Tri Innovations Webmail';
    // try to load host-specific configuration
    // see http://trac.roundcube.net/wiki/Howto_Config for more details
    $rcmail_config['include_host_config'] = false;
    // path to a text file which will be added to each sent message
    // paths are relative to the Roundcube root folder
    $rcmail_config['generic_message_footer'] = '';
    // path to a text file which will be added to each sent HTML message
    // paths are relative to the Roundcube root folder
    $rcmail_config['generic_message_footer_html'] = '';
    // add a received header to outgoing mails containing the creators IP and hostname
    $rcmail_config['http_received_header'] = false;
    // Whether or not to encrypt the IP address and the host name
    // these could, in some circles, be considered as sensitive information;
    // however, for the administrator, these could be invaluable help
    // when tracking down issues.
    $rcmail_config['http_received_header_encrypt'] = false;
    // This string is used as a delimiter for message headers when sending
    // a message via mail() function. Leave empty for auto-detection
    $rcmail_config['mail_header_delimiter'] = NULL;
    // number of chars allowed for line when wrapping text.
    // text wrapping is done when composing/sending messages
    $rcmail_config['line_length'] = 72;
    // send plaintext messages as format=flowed
    $rcmail_config['send_format_flowed'] = true;
    // don't allow these settings to be overriden by the user
    $rcmail_config['dont_override'] = array();
    // Set identities access level:
    // 0 - many identities with possibility to edit all params
    // 1 - many identities with possibility to edit all params but not email address
    // 2 - one identity with possibility to edit all params
    // 3 - one identity with possibility to edit all params but not email address
    $rcmail_config['identities_level'] = 0;
    // Mimetypes supported by the browser.
    // attachments of these types will open in a preview window
    // either a comma-separated list or an array: 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/pdf'
    $rcmail_config['client_mimetypes'] = null;  # null == default
    // mime magic database
    $rcmail_config['mime_magic'] = '/usr/share/misc/magic';
    // path to imagemagick identify binary
    $rcmail_config['im_identify_path'] = null;
    // path to imagemagick convert binary
    $rcmail_config['im_convert_path'] = null;
    // maximum size of uploaded contact photos in pixel
    $rcmail_config['contact_photo_size'] = 160;
    // Enable DNS checking for e-mail address validation
    $rcmail_config['email_dns_check'] = false;
    // PLUGINS
    // List of active plugins (in plugins/ directory)
    $rcmail_config['plugins'] = array();
    // USER INTERFACE
    // default messages sort column. Use empty value for default server's sorting,
    // or 'arrival', 'date', 'subject', 'from', 'to', 'fromto', 'size', 'cc'
    $rcmail_config['message_sort_col'] = '';
    // default messages sort order
    $rcmail_config['message_sort_order'] = 'DESC';
    // These cols are shown in the message list. Available cols are:
    // subject, from, to, fromto, cc, replyto, date, size, status, flag, attachment, 'priority'
    $rcmail_config['list_cols'] = array('subject', 'status', 'fromto', 'date', 'size', 'flag', 'attachment');
    // the default locale setting (leave empty for auto-detection)
    // RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
    $rcmail_config['language'] = null;
    // use this format for date display (date or strftime format)
    $rcmail_config['date_format'] = 'Y-m-d';
    // give this choice of date formats to the user to select from
    $rcmail_config['date_formats'] = array('Y-m-d', 'd-m-Y', 'Y/m/d', 'm/d/Y', 'd/m/Y', 'd.m.Y', 'j.n.Y');
    // use this format for time display (date or strftime format)
    $rcmail_config['time_format'] = 'H:i';
    // give this choice of time formats to the user to select from
    $rcmail_config['time_formats'] = array('G:i', 'H:i', 'g:i a', 'h:i A');
    // use this format for short date display (derived from date_format and time_format)
    $rcmail_config['date_short'] = 'D H:i';
    // use this format for detailed date/time formatting (derived from date_format and time_format)
    $rcmail_config['date_long'] = 'Y-m-d H:i';
    // store draft message is this mailbox
    // leave blank if draft messages should not be stored
    // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
    $rcmail_config['drafts_mbox'] = 'Drafts';
    // store spam messages in this mailbox
    // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
    $rcmail_config['junk_mbox'] = 'Junk';
    // store sent message is this mailbox
    // leave blank if sent messages should not be stored
    // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
    $rcmail_config['sent_mbox'] = 'Sent Messages';
    // move messages to this folder when deleting them
    // leave blank if they should be deleted directly
    // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
    $rcmail_config['trash_mbox'] = 'Trash';
    // display these folders separately in the mailbox list.
    // these folders will also be displayed with localized names
    // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
    $rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent Messages', 'Junk', 'Trash');
    // automatically create the above listed default folders on first login
    $rcmail_config['create_default_folders'] = false;
    // protect the default folders from renames, deletes, and subscription changes
    $rcmail_config['protect_default_folders'] = true;
    // if in your system 0 quota means no limit set this option to true
    $rcmail_config['quota_zero_as_unlimited'] = false;
    // Make use of the built-in spell checker. It is based on GoogieSpell.
    // Since Google only accepts connections over https your PHP installatation
    // requires to be compiled with Open SSL support
    $rcmail_config['enable_spellcheck'] = true;
    // Enables spellchecker exceptions dictionary.
    // Setting it to 'shared' will make the dictionary shared by all users.
    $rcmail_config['spellcheck_dictionary'] = false;
    // Set the spell checking engine. 'googie' is the default. 'pspell' is also available,
    // but requires the Pspell extensions. When using Nox Spell Server, also set 'googie' here.
    $rcmail_config['spellcheck_engine'] = 'googie';
    // For a locally installed Nox Spell Server, please specify the URI to call it.
    // Get Nox Spell Server from http://orangoo.com/labs/?page_id=72
    // Leave empty to use the Google spell checking service, what means
    // that the message content will be sent to Google in order to check spelling
    $rcmail_config['spellcheck_uri'] = '';
    // These languages can be selected for spell checking.
    // Configure as a PHP style hash array: array('en'=>'English', 'de'=>'Deutsch');
    // Leave empty for default set of available language.
    $rcmail_config['spellcheck_languages'] = NULL;
    // Makes that words with all letters capitalized will be ignored (e.g. GOOGLE)
    $rcmail_config['spellcheck_ignore_caps'] = false;
    // Makes that words with numbers will be ignored (e.g. g00gle)
    $rcmail_config['spellcheck_ignore_nums'] = false;
    // Makes that words with symbols will be ignored (e.g. g@@gle)
    $rcmail_config['spellcheck_ignore_syms'] = false;
    // Use this char/string to separate recipients when composing a new message
    $rcmail_config['recipients_separator'] = ',';
    // don't let users set pagesize to more than this value if set
    $rcmail_config['max_pagesize'] = 200;
    // Minimal value of user's 'keep_alive' setting (in seconds)
    // Must be less than 'session_lifetime'
    $rcmail_config['min_keep_alive'] = 60;
    // Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option.
    // By default refresh time is set to 1 second. You can set this value to true
    // or any integer value indicating number of seconds.
    $rcmail_config['upload_progress'] = false;
    // Specifies for how many seconds the Undo button will be available
    // after object delete action. Currently used with supporting address book sources.
    // Setting it to 0, disables the feature.
    $rcmail_config['undo_timeout'] = 0;
    // ADDRESSBOOK SETTINGS
    // This indicates which type of address book to use. Possible choises:
    // 'sql' (default) and 'ldap'.
    // If set to 'ldap' then it will look at using the first writable LDAP
    // address book as the primary address book and it will not display the
    // SQL address book in the 'Address Book' view.
    $rcmail_config['address_book_type'] = 'sql';
    // In order to enable public ldap search, configure an array like the Verisign
    // example further below. if you would like to test, simply uncomment the example.
    // Array key must contain only safe characters, ie. a-zA-Z0-9_
    $rcmail_config['ldap_public'] = array();
    // If you are going to use LDAP for individual address books, you will need to
    // set 'user_specific' to true and use the variables to generate the appropriate DNs to access it.
    // The recommended directory structure for LDAP is to store all the address book entries
    // under the users main entry, e.g.:
    //  o=root
    //   ou=people
    //    uid=user@domain
    //  mail=contact@contactdomain
    // So the base_dn would be uid=%fu,ou=people,o=root
    // The bind_dn would be the same as based_dn or some super user login.
    * example config for Verisign directory
    $rcmail_config['ldap_public']['Verisign'] = array(
      'name'          => 'Verisign.com',
      // Replacement variables supported in host names:
      // %h - user's IMAP hostname
      // %n - http hostname ($_SERVER['SERVER_NAME'])
      // %d - domain (http hostname without the first part)
      // %z - IMAP domain (IMAP hostname without the first part)
      // For example %n = mail.domain.tld, %d = domain.tld
      'hosts'         => array('directory.verisign.com'),
      'port'          => 389,
      'use_tls'                => false,
      'ldap_version'  => 3,       // using LDAPv3
      'user_specific' => false,   // If true the base_dn, bind_dn and bind_pass default to the user's IMAP login.
      // %fu - The full username provided, assumes the username is an email
      //       address, uses the username_domain value if not an email address.
      // %u  - The username prior to the '@'.
      // %d  - The domain name after the '@'.
      // %dc - The domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
      // %dn - DN found by ldap search when search_filter/search_base_dn are used
      'base_dn'       => '',
      'bind_dn'       => '',
      'bind_pass'     => '',
      // It's possible to bind for an individual address book
      // The login name is used to search for the DN to bind with
      'search_base_dn' => '',
      'search_filter'  => '',   // e.g. '(&(objectClass=posixAccount)(uid=%u))'
      // DN and password to bind as before searching for bind DN, if anonymous search is not allowed
      'search_bind_dn' => '',
      'search_bind_pw' => '',
      // Default for %dn variable if search doesn't return DN value
      'search_dn_default' => '',
      // Optional authentication identifier to be used as SASL authorization proxy
      // bind_dn need to be empty
      'auth_cid'       => '',
      // SASL authentication method (for proxy auth), e.g. DIGEST-MD5
      'auth_method'    => '',
      // Indicates if the addressbook shall be hidden from the list.
      // With this option enabled you can still search/view contacts.
      'hidden'        => false,
      // Indicates if the addressbook shall not list contacts but only allows searching.
      'searchonly'    => false,
      // Indicates if we can write to the LDAP directory or not.
      // If writable is true then these fields need to be populated:
      // LDAP_Object_Classes, required_fields, LDAP_rdn
      'writable'       => false,
      // To create a new contact these are the object classes to specify
      // (or any other classes you wish to use).
      'LDAP_Object_Classes' => array('top', 'inetOrgPerson'),
      // The RDN field that is used for new entries, this field needs
      // to be one of the search_fields, the base of base_dn is appended
      // to the RDN to insert into the LDAP directory.
      'LDAP_rdn'       => 'cn',
      // The required fields needed to build a new contact as required by
      // the object classes (can include additional fields not required by the object classes).
      'required_fields' => array('cn', 'sn', 'mail'),
      'search_fields'   => array('mail', 'cn'),  // fields to search in
      // mapping of contact fields to directory attributes
      //   for every attribute one can specify the number of values (limit) allowed.
      //   default is 1, a wildcard * means unlimited
      'fieldmap' => array(
        // Roundcube  => LDAP:limit
        'name'        => 'cn',
        'surname'     => 'sn',
        'firstname'   => 'givenName',
        'title'       => 'title',
        'email'       => 'mail:*',
        'phone:home'  => 'homePhone',
        'phone:work'  => 'telephoneNumber',
        'phone:mobile' => 'mobile',
        'phone:pager' => 'pager',
        'street'      => 'street',
        'zipcode'     => 'postalCode',
        'region'      => 'st',
        'locality'    => 'l',
    // if you uncomment country, you need to modify 'sub_fields' above
    //    'country'     => 'c',
        'department'  => 'departmentNumber',
        'notes'       => 'description',
    // these currently don't work:
    //    'phone:workfax' => 'facsimileTelephoneNumber',
    //    'photo'        => 'jpegPhoto',
    //    'organization' => 'o',
    //    'manager'      => 'manager',
    //    'assistant'    => 'secretary',
      // Map of contact sub-objects (attribute name => objectClass(es)), e.g. 'c' => 'country'
      'sub_fields' => array(),
      'sort'          => 'cn',    // The field to sort the listing by.
      'scope'         => 'sub',   // search mode: sub|base|list
      'filter'        => '(objectClass=inetOrgPerson)',      // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
      'fuzzy_search'  => true,    // server allows wildcard search
      'vlv'           => false,   // Enable Virtual List View to more efficiently fetch paginated data (if server supports it)
      'numsub_filter' => '(objectClass=organizationalUnit)',   // with VLV, we also use numSubOrdinates to query the total number of records. Set this filter to get all numSubOrdinates attributes for counting
      'sizelimit'     => '0',     // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
      'timelimit'     => '0',     // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
      'referrals'     => true|false,  // Sets the LDAP_OPT_REFERRALS option. Mostly used in multi-domain Active Directory setups
      // definition for contact groups (uncomment if no groups are supported)
      // for the groups base_dn, the user replacements %fu, %u, $d and %dc work as for base_dn (see above)
      // if the groups base_dn is empty, the contact base_dn is used for the groups as well
      // -> in this case, assure that groups and contacts are separated due to the concernig filters!
      'groups'        => array(
        'base_dn'     => '',
        'scope'       => 'sub',   // search mode: sub|base|list
        'filter'      => '(objectClass=groupOfNames)',
        'object_classes' => array("top", "groupOfNames"),
        'member_attr'  => 'member',   // name of the member attribute, e.g. uniqueMember
        'name_attr'    => 'cn',       // attribute to be used as group name
    // An ordered array of the ids of the addressbooks that should be searched
    // when populating address autocomplete fields server-side. ex: array('sql','Verisign');
    $rcmail_config['autocomplete_addressbooks'] = array('sql');
    // The minimum number of characters required to be typed in an autocomplete field
    // before address books will be searched. Most useful for LDAP directories that
    // may need to do lengthy results building given overly-broad searches
    $rcmail_config['autocomplete_min_length'] = 1;
    // Number of parallel autocomplete requests.
    // If there's more than one address book, n parallel (async) requests will be created,
    // where each request will search in one address book. By default (0), all address
    // books are searched in one request.
    $rcmail_config['autocomplete_threads'] = 0;
    // Max. numer of entries in autocomplete popup. Default: 15.
    $rcmail_config['autocomplete_max'] = 15;
    // show address fields in this order
    // available placeholders: {street}, {locality}, {zipcode}, {country}, {region}
    $rcmail_config['address_template'] = '{street}<br/>{locality} {zipcode}<br/>{country} {region}';
    // Matching mode for addressbook search (including autocompletion)
    // 0 - partial (*abc*), default
    // 1 - strict (abc)
    // 2 - prefix (abc*)
    // Note: For LDAP sources fuzzy_search must be enabled to use 'partial' or 'prefix' mode
    $rcmail_config['addressbook_search_mode'] = 0;
    // USER PREFERENCES
    // Use this charset as fallback for message decoding
    $rcmail_config['default_charset'] = 'ISO-8859-1';
    // skin name: folder from skins/
    $rcmail_config['skin'] = 'larry';
    // show up to X items in messages list view
    $rcmail_config['mail_pagesize'] = 50;
    // show up to X items in contacts list view
    $rcmail_config['addressbook_pagesize'] = 50;
    // sort contacts by this col (preferably either one of name, firstname, surname)
    $rcmail_config['addressbook_sort_col'] = 'surname';
    // the way how contact names are displayed in the list
    // 0: display name
    // 1: (prefix) firstname middlename surname (suffix)
    // 2: (prefix) surname firstname middlename (suffix)
    // 3: (prefix) surname, firstname middlename (suffix)
    $rcmail_config['addressbook_name_listing'] = 0;
    // use this timezone to display date/time
    // valid timezone identifers are listed here: php.net/manual/en/timezones.php
    // 'auto' will use the browser's timezone settings
    $rcmail_config['timezone'] = 'auto';
    // prefer displaying HTML messages
    $rcmail_config['prefer_html'] = true;
    // display remote inline images
    // 0 - Never, always ask
    // 1 - Ask if sender is not in address book
    // 2 - Always show inline images
    $rcmail_config['show_images'] = 0;
    // compose html formatted messages by default
    // 0 - never, 1 - always, 2 - on reply to HTML message only
    $rcmail_config['htmleditor'] = 0;
    // show pretty dates as standard
    $rcmail_config['prettydate'] = true;
    // save compose message every 300 seconds (5min)
    $rcmail_config['draft_autosave'] = 300;
    // default setting if preview pane is enabled
    $rcmail_config['preview_pane'] = false;
    // Mark as read when viewed in preview pane (delay in seconds)
    // Set to -1 if messages in preview pane should not be marked as read
    $rcmail_config['preview_pane_mark_read'] = 0;
    // Clear Trash on logout
    $rcmail_config['logout_purge'] = false;
    // Compact INBOX on logout
    $rcmail_config['logout_expunge'] = false;
    // Display attached images below the message body
    $rcmail_config['inline_images'] = true;
    // Encoding of long/non-ascii attachment names:
    // 0 - Full RFC 2231 compatible
    // 1 - RFC 2047 for 'name' and RFC 2231 for 'filename' parameter (Thunderbird's default)
    // 2 - Full 2047 compatible
    $rcmail_config['mime_param_folding'] = 0;
    // Set true if deleted messages should not be displayed
    // This will make the application run slower
    $rcmail_config['skip_deleted'] = false;
    // Set true to Mark deleted messages as read as well as deleted
    // False means that a message's read status is not affected by marking it as deleted
    $rcmail_config['read_when_deleted'] = true;
    // Set to true to never delete messages immediately
    // Use 'Purge' to remove messages marked as deleted
    $rcmail_config['flag_for_deletion'] = false;
    // Default interval for keep-alive/check-recent requests (in seconds)
    // Must be greater than or equal to 'min_keep_alive' and less than 'session_lifetime'
    $rcmail_config['keep_alive'] = 60;
    // If true all folders will be checked for recent messages
    $rcmail_config['check_all_folders'] = false;
    // If true, after message delete/move, the next message will be displayed
    $rcmail_config['display_next'] = false;
    // 0 - Do not expand threads
    // 1 - Expand all threads automatically
    // 2 - Expand only threads with unread messages
    $rcmail_config['autoexpand_threads'] = 0;
    // When replying place cursor above original message (top posting)
    $rcmail_config['top_posting'] = false;
    // When replying strip original signature from message
    $rcmail_config['strip_existing_sig'] = true;
    // Show signature:
    // 0 - Never
    // 1 - Always
    // 2 - New messages only
    // 3 - Forwards and Replies only
    $rcmail_config['show_sig'] = 1;
    // When replying or forwarding place sender's signature above existing message
    $rcmail_config['sig_above'] = false;
    // Use MIME encoding (quoted-printable) for 8bit characters in message body
    $rcmail_config['force_7bit'] = false;
    // Defaults of the search field configuration.
    // The array can contain a per-folder list of header fields which should be considered when searching
    // The entry with key '*' stands for all folders which do not have a specific list set.
    // Please note that folder names should to be in sync with $rcmail_config['default_folders']
    $rcmail_config['search_mods'] = null;  // Example: array('*' => array('subject'=>1, 'from'=>1), 'Sent' => array('subject'=>1, 'to'=>1));
    // Defaults of the addressbook search field configuration.
    $rcmail_config['addressbook_search_mods'] = null;  // Example: array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1, '*'=>1);
    // 'Delete always'
    // This setting reflects if mail should be always deleted
    // when moving to Trash fails. This is necessary in some setups
    // when user is over quota and Trash is included in the quota.
    $rcmail_config['delete_always'] = false;
    // Directly delete messages in Junk instead of moving to Trash
    $rcmail_config['delete_junk'] = false;
    // Behavior if a received message requests a message delivery notification (read receipt)
    // 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
    // 3 = send automatically if sender is in addressbook, otherwise ask the user
    // 4 = send automatically if sender is in addressbook, otherwise ignore
    $rcmail_config['mdn_requests'] = 0;
    // Return receipt checkbox default state
    $rcmail_config['mdn_default'] = 0;
    // Delivery Status Notification checkbox default state
    $rcmail_config['dsn_default'] = 0;
    // Place replies in the folder of the message being replied to
    $rcmail_config['reply_same_folder'] = false;
    // Sets default mode of Forward feature to "forward as attachment"
    $rcmail_config['forward_attachment'] = false;
    // Defines address book (internal index) to which new contacts will be added
    // By default it is the first writeable addressbook.
    // Note: Use '0' for built-in address book.
    $rcmail_config['default_addressbook'] = null;
    // Enables spell checking before sending a message.
    $rcmail_config['spellcheck_before_send'] = false;
    // Skip alternative email addresses in autocompletion (show one address per contact)
    $rcmail_config['autocomplete_single'] = false;
    // Default font for composed HTML message.
    // Supported values: Andale Mono, Arial, Arial Black, Book Antiqua, Courier New,
    // Georgia, Helvetica, Impact, Tahoma, Terminal, Times New Roman, Trebuchet MS, Verdana
    $rcmail_config['default_font'] = '';
    // end of config file

  • Strange login problem with Open Directory

    Hi,
    I created a web tool that calls dscl to create users in Open Directory from a bound web server.
    Most of the accounts work fine. A couple do not. The particular account in question could login to machines in one computer group, but not on others, using the login window. But it could login on the command-line via su.
    Now here's the kicker. I deleted the user completely and re-created the user account with the same login name, and assigned it to the same groups as other new accounts that work fine. The problem persists.
    The only thing I've found that indicates a problem is the following from the ldap log:
    Sep 17 10:36:14 poseidon slapd[61]: Entry (uid=<username changed>,cn=users,dc=<redacted>,dc=<redacted>,dc=<redacted>): object class 'posixAccount' requires attribute 'homeDirectory'
    (note the redactions and username were put in by me...paranoia etc)
    I used 'Inspector' in Workgroup Manager and verified that the account does in fact have the required homeDirectory attribute, and the account is not unlike other accounts that work fine, save the username and unique ID.
    I hope this provides enough info for someone to give some guidance...this is certainly a strange problem.
    Thanks ahead of time!
    -Matt

    Hi,
    I created a web tool that calls dscl to create users in Open Directory from a bound web server.
    Most of the accounts work fine. A couple do not. The particular account in question could login to machines in one computer group, but not on others, using the login window. But it could login on the command-line via su.
    Now here's the kicker. I deleted the user completely and re-created the user account with the same login name, and assigned it to the same groups as other new accounts that work fine. The problem persists.
    The only thing I've found that indicates a problem is the following from the ldap log:
    Sep 17 10:36:14 poseidon slapd[61]: Entry (uid=<username changed>,cn=users,dc=<redacted>,dc=<redacted>,dc=<redacted>): object class 'posixAccount' requires attribute 'homeDirectory'
    (note the redactions and username were put in by me...paranoia etc)
    I used 'Inspector' in Workgroup Manager and verified that the account does in fact have the required homeDirectory attribute, and the account is not unlike other accounts that work fine, save the username and unique ID.
    I hope this provides enough info for someone to give some guidance...this is certainly a strange problem.
    Thanks ahead of time!
    -Matt

  • Open Directory: "Unable to load replica list"

    I'm currently running Mavericks Server 3.1 on my Mac Mini at the home network. I had some issues with the client logins and went for local accounts on the clients instead. Today I finally wanted to fix the problem and go all Open Directory. But the Open Directory service was shut off when I opened the server software. I tried to turn it on but got a message saying "Unable to load replica list". I updated the software to the latest 3.1 but are still having the same issue. I never had any replica list, I only had a standard one from the start, but it seems I can't do anyhing there now.
    LDAP log:
    Mar 21 22:48:38 xxYY.com slapd[172]: @(#) $OpenLDAP: slapd 2.4.28 (Nov 12 2013 12:02:47) $
    [email protected]:/private/var/tmp/OpenLDAP/OpenLDAP-491.1~1/servers/slapd
    Mar 21 22:48:38 xxYY.com.com slapd[172]: daemon: SLAP_SOCK_INIT: dtblsize=8192
    Mar 21 22:48:39 xxYY.com.com slapd[172]: TLS: found identity in keychain using identity preference.
    Mar 21 22:48:42 xxYY.com.com slapd[172]: slap_add_listener: opened additional listener 'ldaps:///'
    Mar 21 22:48:42 xxYY.com.com slapd[172]: bdb_monitor_db_open: monitoring disabled; configure monitor database to enable
    Mar 21 22:48:44 xxYY.com.com slapd[172]: slapd starting
    Mar 21 22:48:44 xxYY.com.com slapd[172]: daemon: posting com.apple.slapd.startup notification
    Mar 21 22:48:54 xxYY.com.com slapd[172]: => bdb_idl_delete_key: c_del id failed: DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock (-30994)
    Mar 21 22:48:54 xxYY.com.com slapd[172]: conn=1022 op=3: attribute "entryCSN" index delete failure
    Mar 21 22:50:02 xxYY.com.com slapd[172]: => bdb_idl_delete_key: c_get failed: DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock (-30994)
    Mar 21 22:50:02 xxYY.com.com slapd[172]: conn=1042 op=3: attribute "entryCSN" index delete failure
    I don't understand any of this other than the obvious failure words. Can anyone understand this and help me here?

    This procedure is a diagnostic test. It makes no changes to your data. If you have more than one user account, you must be logged in as an administrator to carry out these instructions.
    Please triple-click anywhere in the line below on this page to select it:
    sudo /usr/libexec/slapd -Tt | pbcopy
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing the key combination command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting. You'll be prompted for your login password. Nothing will be displayed when you type it. If you don’t have a login password, you’ll need to set one before you can run the command. You may get a one-time warning to be careful. Confirm. You don't need to post the warning.
    If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. Log in as one and start over.
    Wait for a new line ending in a dollar sign ($) to appear below what you entered.
    The output of the command will be automatically copied to the Clipboard. If the command produced no output, the Clipboard will be empty. Paste into a reply to this message.
    The Terminal window doesn't show the output. Please don't copy anything from there.

  • Open Directory Migration Question

    Setup:
    My company has two servers, both running 10.5.6. We are migrating from the server Fubar (xserve) as it has had a lot of problems and we want to do a fresh install on it (I was not the admin who initially set it up).
    In order to get a 'fresh' OD going, we are recreating all the accounts on the new server Edoras (powerpc mac pro), making sure to preserve UID of the users.
    Problem:
    User A cannot change his password on Edoras after Directory Utility has been changed to point at it. He can change his password locally, but it does not propagate to Edoras, nor does a password change on Edoras affect his local machine.
    The questions I haven't been able to get answers for are:
    * Should the OD search string be different on Fubar and Edoras? Currently our search string is 'dc=fubar,dc=domain,dc=com'.
    * Are there other attributes that have to be setup in OD besides UID? I noticed when using the Target tab in Workgroup Manager that there is a GeneratedUID attribute, does this need to match?
    Thanks for any information/help.

    I did something like this recently. Unfortunately I couldn't get an answer on the Internet and had to re-configure Directory Access on the client machines manually.
    I moved our system from a POwerMac G4 with several upgrades (eSATA card, eSATA Coolgear Enclosure, 7200.11 (yeah I know, bad drives to use) Seagate drives, 1.8 GHz PPC 7447 upgrade, 1.5GB of ram) to a new Mac Pro with a Highpoint RAID controller. The old G4 was very unreliable and couldn't hand
    I had to go to each machine with ARD, open Directory Access, delete the LDAP entry and re-enter it. This was really annoying and confusing for me as the old server and the new server had:
    The same version of OSX (ok, one was a PPC version and I special ordered the Intel version from Apple Tech Support), but they both were running 10.4.11 with the newest security patches.
    The same OD Search Strings
    The same IP Address for the Server
    The same DNS name for the server
    and the same user IDs and group settings
    and I still had to re-do Directory Access using the client machines. Before re-doing the Directory Access re-binding I would try to login. The "other" icon would appear on the loging window, but when I would loging with the correct username and password the login windows would "shake it's head" and wouldn't let me login.
    The biggest pain was that portable directories didn't sync correct anymore, so I had to manually backup, then delete the account, then re-bind, then re-create and restore the portable directory on each laptop manually.
    Unfortunately I do not know the unix command to change directory binding to client computers using ARD. If such a command exists it would make things much easier for you. Does anyone know if a command exists?

  • Reconfigure Open Directory in Yosemite Server

    Is it possible to delete and reconfigure Open Directory in Yosemite server?
    The host name and configuration were modified after Open Directory was activated and I get the message "Unable to load replica list" in the Settings Tab of Open Directory on the Server App (Server 4.0.3 (Build 14S350)). I think the best way would be to start over the automatic configuration.

    Many Open Directory problems can be resolved by taking the following steps. Test after each one, and back up all data before making any changes.
    1. The OD master must have a static IP address on the local network, not a dynamic address. It must not be connected to the same network with more than one interface; e.g., Ethernet and Wi-Fi.
    2. You must have a working DNS service, and the server's hostname must match its fully-qualified domain name. To confirm, select the server by name in the sidebar of the Server application window, then select the Overview tab. Click the Edit button on the Host Name line. On the Accessing your Server sheet, Domain Name should be selected. Change the Host Name, if necessary. The server must have at least a three-level name (e.g. "server.yourdomain.com"), and the name must not be in the ".local" top-level domain, which is reserved for Bonjour.
    3. The primary DNS server used by the server must be itself, unless you're using another server for internal DNS. The only DNS server set on the clients should be the internal one, which they should get from DHCP if applicable.
    4. Only if you're still running Mavericks server, follow these instructions to rebuild the Kerberos configuration on the server.
    5. If you use authenticated binding, check the validity of the master's certificate. The common name must match the hostname and domain name. Deselecting and then reselecting the certificate in Server.app has been reported to have an effect in some cases. Otherwise delete all certificates and create new ones.
    6. Unbind and then rebind the clients in the Users & Groups preference pane. Use the fully-qualified domain name of the master.
    7. Reboot the master and the clients.
    8. Don't log in to the server with a network user's account.
    9. Disable any internal firewalls in use, including third-party "security" software.
    10. If you've created any replica servers, delete them.
    11. If OD has only recently stopped working when it was working before, you may be able to restore it from the automatic backup in /var/db/backups, or from a Time Machine snapshot of that backup.
    12. As a last resort, export all OD users. In the Open Directory pane of Server, delete the OD server. Then recreate it and import the users. Ensure that the UID's are in the 1001+ range.
    If you get this far without solving the problem, then you'll need to examine the logs in the Open Directory section of the log list in the Server app, and also the system log on the clients.

  • Directory Binding Script (Active and Open Directory) 10.7

    Hi everyone
    I'm reposting this in the right thread. I've written a Directory Binding Script for 10.6 and ported it now to 10.7 as among the things that have changed in the upgraded version is a refurbished directory binding enviroment.
    The original thread can be found here: https://discussions.apple.com/thread/3090068. The script is applicable for clients as well and simplifies the binding process considerably.
    Be aware that the reformatted script here contains some faulty line breaks. So you'll have to correct them in a proper text editor.
    #!/bin/sh
    #Uncomment the following line to abort the script on errors
    #trap exit ERR
    ## Script to automate OD and AD Binding of Mac OS X 10.7 Servers
    ## Script written by Marc Horat, URZ Basel, 11.6.2010
    ## Updated: 12.08.2011
    # With the use of the following sources as inspiration:
    # http://www.howtomac.co.uk/?p=247
    #Created by Ross Hamilton
    #Clock restart / Remove existing settings
    #Join to Open Directory and Active Directory
    # Bombich's AD-Bind Script:
    # This script binds to AD and configures advanced options of the AD plugin
    # As this scripts contains a password, be sure to take appropriate security
    # precautions
    # A good way to run this script is to set it as a login hook on your master machine
    # Because it only needs to be run once, the last thing this script does is to delete
    # itself. If you have another login script that you typically run, include the
    # script on your master machine, and indicate its path in the "newLoginScript"
    # variable.
    # If running this as a one-time login hook to bind to AD after imaging,
    # be sure to enable auto-login (for any local user) before creating your master image
    #################CONFIGURATION##########################
    #OD
    # These variables need to be configured for your env
    odAdmin="YOURODADMIN" #enter your OD admin name between the quotes
    odPassword="YOURODPW"  # Enter your OD admin password between the quotes
    oddomain="YOURODDOMAIN" # FQDN of your OD domain
    computerGroup="YOURNEWODCOMPGROUP"  # Add appropriate computer group you want machines to be added to, case sensitive
    oldComputerGroup="YOUROLDODCOMPGROUP" # If the Computer is in a Group already
    #AD
    # Standard parameters
    domain="YOURADDOMAIN"                              # fully qualified DNS name of Active Directory Domain
    domainname="YOURADDOMAINNAME"                    #Name of the Domain as specified in the search paths
    udn="YOURADADMIN"                              # username of a privileged network user
    password="YOURADPW"                                                  # password of a privileged network user
    ou="OU=YOUR,OU=OU,OU=URZ,OU=IN,DC=YOUR,DC=AD,DC=DOMAIN"                    # Distinguished name of container for the computer E.G. OU=Macs,OU=Computers,DC=AD,DC=DOMAIN,DC=CH
    # Advanced options AD Plugin
    alldomains="disable"                              # 'enable' or 'disable' automatic multi-domain authentication
    localhome="disable"                              # 'enable' or 'disable' force home directory to local drive
    protocol="smb"                                        # 'afp', 'smb' or 'nfs' (since 10.7) change how home is mounted from server
    mobile="enable"                              # 'enable' or 'disable' mobile account support for offline logon
    mobileconfirm="enable"                    # 'enable' or 'disable' warn the user that a mobile acct will be created
    useuncpath="enable"                              # 'enable' or 'disable' use AD SMBHome attribute to determine the home dir
    user_shell="/bin/bash"                    # e.g., /bin/bash or "none"
    preferred="-preferred $domain"          # Use the specified server for all Directory lookups and authentication
    # (e.g. "-nopreferred" or "-preferred ad.server.edu")
    admingroups="$domainname\YOURADADMINGROUP" # These comma-separated AD groups may administer the machine (e.g. "" or "APPLE\macadmins")
    packetsign="allow"                              # allow | disable | require
    packetencrypt="allow"                    # allow | disable | require
    passinterval="14"                              # number of days
    namespace="domain"                              # forest | domain
    # Login hook setting -- specify the path to a login hook that you want to run instead of this script
    newLoginHook=""                    # e.g., "/Library/Management/login.sh"
    ################################# End of configuration
    ############ Begin of Script
    # Host-specific parameters
    # computerid should be set dynamically, this value must be machine-specific
    # This value may be restricted to 19 characters! The only error you'll receive upon entering
    # an invalid computer id is to the effect of not having appropriate privileges to perform the requested operation
    #computerid=`/sbin/ifconfig en0 | awk '/ether/ { gsub(":", ""); print $2 }'` # MAC Address
    #computerid=`hostname | sed 's/.unibas.ch//'`
    #computerid=`/usr/sbin/scutil --get LocalHostName | cut -c 1-19` # Assure that this will produce unique names!
    #computerid=`/usr/sbin/scutil --get LocalHostName`
    computerid=`scutil --get ComputerName`
    adcomputerid=`echo "$computerid" | tr [:lower:] [:upper:]`
    # These variables probably don't need to be changed
    # Determing if any directory binding exists
    nicAddress=`ifconfig en0 | grep ether | awk '{print $2}'`
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              check4ODtmp=`dscl localhost -list /LDAPv3 | grep -n 1 | sed 's/1://' | sed 's/2://'`
              check4OD=${check4ODtmp//[[:space:]]/}
              echo "Found LDAP: "$check4ODtmp
              check4ODaccttmp=`dscl /LDAPv3/"$check4OD" -read Computers/"$computerid" RealName | cut -c 11-`
              check4ODacct=${check4ODaccttmp//[[:space:]]/}
              echo "Found LDAP-Computer-Account: "$check4ODacct
    else
              check4OD=""
              check4ODacct=""
              echo "No bound LDAP Server found"
    fi
    if [ $oldComputerGroup != "" ] && dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              check4ODgroupMembershiptmp=`dscl /LDAPv3/"$check4OD" -read ComputerGroups/"$oldComputerGroup" | grep "$computerid"`
              check4ODgroupMembership=$check4ODgroupMembershiptmp
              echo "LDAP Group Membership in Group: "$oldComputerGroup
    else
              check4ODgroupMembership=""
              echo "No LDAP Group Membership defined or not bound to a server"
    fi
    if dscl localhost -list "/Active Directory" | grep $domainname > /dev/null
    then
              check4ADtmp=`dsconfigad -show | grep "Active Directory Domain" | sed 's/Active Directory Domain//'  | sed 's/=//'`
              check4AD=${check4ADtmp//[[:space:]]/}
              echo "Found AD: "$check4AD
              check4ADaccttmp=`dsconfigad -show | grep "Computer Account" | sed 's/Computer Account//' | sed 's/=//'`
              check4ADacct=${check4ADaccttmp//[[:space:]]/}
              echo "Found AD-Account: "$check4ADacct
    else
              check4AD=""
              check4ADacct=""
              echo "No AD-Account found"
    fi
    osversionlong=`sw_vers -productVersion`
    osvers=${osversionlong:3:1}
    #Time Sync
    #Restart ntpdate
    StartService ()
    if [ "${TIMESYNC:=-YES-}" = "-YES-" ] && ! GetPID ntpd > /dev/null; then
              CheckForNetwork
    if [ -f /var/run/NetworkTime.StartupItem -o "${NETWORKUP}" = "-NO-" ]; then exit; fi
              touch /var/run/NetworkTime.StartupItem
              echo "Starting network time synchronization"
    # Synchronize our clock to the network’s time,
    # then fire off ntpd to keep the clock in sync.
              ntpdate -bvs
              ntpd -f /var/run/ntp.drift -p /var/run/ntpd.pid
    fi
    echo ""
    echo ""
    sleep 5
    #### Removing any existing directory bindings
    #Clear OD Computer Account and delete entry from Computer group
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              echo "This computer is bound to the following Open Directory Services:"
              dscl localhost -list /LDAPv3
              echo "With the Search Path entries:"
              dscl /Search -read / CSPSearchPath | grep /LDAP
              sleep 5
              if [ "${check4ODacct}" == "${computerid}" ]
              then
                        echo "This machine already has a computer account on $oddomain."
                        # Set the GUID
                        GUID="$(dscl /LDAPv3/$oddomain -read /Computers/${computerid} GeneratedUID | awk '{ print $2 }')"
                        echo "Found GUID: "$GUID
                        if [ "$oldComputerGroup" != "" ] && [ "$check4ODgroupMembership" != "" ]
                        then
                                  echo "Removing entry from group $oldComputerGroup"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerGroups/"$oldComputerGroup" GroupMembership "${computerid}"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerGroups/"$oldComputerGroup" GroupMembers "${GUID}"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerLists/"$oldComputerGroup" Computers "${computerid}"
                        fi
                        echo "Removing Computer entry $computerid in OD"
                        dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /Computers/"${computerid}"
              fi
              #List existing Directories
              echo "Removing OD-Binding to "$check4OD
              dsconfigldap -r "$check4OD"
              echo "Removing Search Path entries"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4OD"
              dscl /Search/Contacts -delete / CSPSearchPath /LDAPv3/"$check4OD"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4OD"
              sleep 5
    else
              echo "No LDAP or OD Binding present.";
    fi
    echo ""
    # Check a second time in order to delete any remaining LDAP-Bindings
    echo "Scanning for further LDAP servers"
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              echo "Found:"
              dscl localhost -list /LDAPv3
              echo "Removing OD-Binding to "$check4ODtmp
              dsconfigldap -r "$check4ODtmp"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              dscl /Search/Contacts -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              sleep 5
    else
              echo "No further LDAP or OD Binding present."
    fi
    echo ""
    echo ""
    #Remove the Active Directory binding
    if [ "$check4AD" != "" ]
    then
              echo "This computer is bound to the following Active Directory Services:"
              dscl localhost -list "/Active Directory"
              echo "With the Search Path entries:"
              dscl /Search -read / CSPSearchPath | grep /Active
              sleep 5
              echo "Removing any existing AD-Binding to "$check4AD
        dsconfigad -f -remove -username "$udn" -password "$password"
        echo "Removing Search Path entries"
              if [ "$preferred" != "-nopreferred" ]
              then
                        dscl /Search -delete / CSPSearchPath /Active Directory/"$domainname"
                        dscl /Search/Contacts -delete / CSPSearchPath /Active Directory/"$domainname"
                        dscl /Search -delete / CSPSearchPath /Active Directory/"$domainname"
              fi
              dscl /Search -delete / CSPSearchPath "/Active Directory/$domainname/All Domains"
              dscl /Search/Contacts -delete / CSPSearchPath "/Active Directory/$domainname/All Domains"
    #remove search path entries from 10.6
        if dscl /Search -read / CSPSearchPath | grep /Active > /dev/null
        then
            dscl /Search -delete / CSPSearchPath "/Active Directory/$domainname/$domain"
            dscl /Search/Contacts -delete / CSPSearchPath "/Active Directory/$domainname/$domain"
        fi
              sleep 5
    else
              echo "No Active Directory Binding present."
    fi
    echo ""
    #Remove Existing Directory Services Config
    echo "Removing existing DS Config"
    if [ -d "/Library/Preferences/edu.mit.Kerberos" ]
    then
              rm -R /Library/Preferences/edu.mit.Kerberos
    fi
    if [ -d "/etc/krb5.keytab" ]
    then
              rm -R /etc/krb5.keytab
    fi
    # Clean up the DirectoryService configuration files
    rm -Rfv /Library/Preferences/DirectoryService/*
    #OD
    echo ""
    echo ""
    echo "Binding to OD-Damin "$oddomain
    sleep 5
    dsconfigldap -v -a "$oddomain" -n "$oddomain" -c "$computerid"
    echo "Killing opendirectoryd"
    killall opendirectoryd
    sleep 5
    echo "Adding computer account $computerid to /LDAPv3/${oddomain} on $oddomain"
    dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -create /Computers/"$computerid" ENetAddress "$nicAddress"
    dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /Computers/"$computerid" RealName "$computerid"
    # Set the GUID
    GUID="$(dscl /LDAPv3/$oddomain -read /Computers/${computerid} GeneratedUID | awk '{ print $2 }')"
    # Add computer to ComputerList and ComputerGroup
    if [ $computerGroup != "" ]
    then
              echo "Adding computer $computerid to OD group $computerGroup on $oddomain"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerLists/"$computerGroup" apple-computers "$computerid"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerGroups/"$computerGroup" apple-group-memberguid "${GUID}"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerGroups/"$computerGroup" memberUid "$computerid"
    fi
    echo "Finished OD Binding."
    sleep 5 # Give DS a chance to catch up
    echo ""
    echo ""
    echo "Performing the AD Binding"
    #AD
    # Activate the AD plugin
    defaults write /Library/Preferences/DirectoryService/DirectoryService "Active Directory" "Active"
    plutil -convert xml1 /Library/Preferences/DirectoryService/DirectoryService.plist
    #Use the existing AD-Computername or generate a new one
    computeridtmp="default"
    if [ "$check4ADacct" == "" ]
    then
              LEN=$(echo ${#adcomputerid})
              if [ $LEN -lt 15 ]; then
                      echo "ComputerID "$adcomputerid " has 15 characters or less and is therefore suitable for AD-Binding. It is $adcomputerid"
                      computeridtmp=$adcomputerid
              else
                      echo "ComputerID "$adcomputerid " has 16 or more characters and needs to be modified for AD-Binding."
                        echo "Removing any -"
                      computeridtmp=${adcomputerid//-/}
                                  LEN=$(echo ${#computeridtmp})
                                  if [ $LEN -lt 15 ]; then
                                            echo "ComputerID "$computeridtmp" has now 15 characters or less and is therefore suitable for AD-Binding."
                                  else
                                            echo "Only using the last 15 characters of the Computer name to be able to bind to AD."
                                            computeridtmp=${computeridtmp:(-15)}
                                  fi
                      echo "Cropped Computername to "$computeridtmp
              fi
    else
        computeridtmp=${check4ADacct//$/}
        echo "Found existing AD Account previously, attempting to recreate in the OU: "$computeridtmp
    fi
    echo ""
    # Bind to AD
    echo "Binding to AD-Domain "$domain" with computerid "$computeridtmp
    dsconfigad -f -add "$domain" -username "$udn" -password "$password" -ou "$ou" -computer "$computeridtmp"
    echo ""
    echo "Setting the Advanced AD Plugin options"
    # Configure advanced AD plugin options
    if [ "$admingroups" = "" ]
    then
              dsconfigad -nogroups
    else
              dsconfigad -groups "$admingroups"
    fi
    dsconfigad -alldomains "$alldomains"
    dsconfigad -localhome "$localhome"
    dsconfigad -protocol "$protocol"
    dsconfigad -mobile "$mobile"
    dsconfigad -mobileconfirm "$mobileconfirm"
    dsconfigad -useuncpath "$useuncpath"
    dsconfigad -shell "$user_shell"
    dsconfigad "$preferred"
    dsconfigad -packetsign "$packetsign" -packetencrypt "$packetencrypt" -passinterval "$passinterval"
    dsconfigad -namespace "$namespace"
    sleep 5
    echo ""
    echo ""
    # Add the OD & AD node to the search path
    if [ "$alldomains" = "enable" ]
    then
              csp="/Active Directory/$domainname/All Domains"
    else
              csp="/Active Directory/$domainname"
    fi
    echo "Finished AD Binding."
    echo "Adding Domain /LDAPv3/"$oddomain" and "$csp" to Search Path"
    dscl /Search -create / SearchPolicy CSPSearchPath
    dscl /Search/Contacts -create / SearchPolicy CSPSearchPath
    echo "Adding OD.."
    dscl /Search -append / CSPSearchPath /LDAPv3/"$oddomain"
    dscl /Search/Contacts -append / CSPSearchPath /LDAPv3/"$oddomain"
    echo "Adding AD.."
    #Adding all Domains first to improve reliability under 10.7
    if [ "$alldomains" != "enable" ]
    then
        cspadall="/Active Directory/$domainname/All Domains"
        dscl /Search/Contacts -append / CSPSearchPath "$cspadall"
        dscl /Search -append / CSPSearchPath "$cspadall"
    fi
    dscl /Search/Contacts -append / CSPSearchPath "$csp"
    dscl /Search -append / CSPSearchPath "$csp"
    echo "Finished Updating Search Paths."
    echo ""
    echo ""
    # Restart DirectoryService (necessary to reload AD plugin activation settings)
    killall opendirectoryd
    # Destroy the login hook (or change it)
    if [ "${newLoginHook}" == "" ]
    then
              defaults delete /var/root/Library/Preferences/com.apple.loginwindow LoginHook
    else
              defaults write /var/root/Library/Preferences/com.apple.loginwindow LoginHook $newLoginHook
    fi
    sleep 5
    # Customizing the login-Window
    #defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo DSStatus
    #defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool TRUE
    #defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool TRUE
    # This works in a pinch if the above code does not
    #defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Node Custom Path Array" -array "/Active Directory/All Domains"
    #defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Policy" -int 3
    #plutil -convert xml1 /Library/Preferences/DirectoryService/SearchNodeConfig.plist
    #killall opendirectoryd
    # Disable autologin
    defaults delete /Library/Preferences/com.apple.loginwindow autoLoginUser
    srm /etc/kcpassword
    echo ""
    echo ""
    echo ""
    echo "Now bound to OD Domain:"
    dscl localhost -list /LDAPv3
    echo "With Search Path entries:"
    dscl /Search -read / CSPSearchPath | grep /LDAP
    echo "Now bound to AD Domain:"
    dscl localhost -list "/Active Directory"
    echo "With Search Path entries:"
    dscl /Search -read / CSPSearchPath | grep /Active
    exit 0                    ## Success
    exit 1                    ## Failure
    Any inputs, questions and improvement suggestions are, of course, most welcome!
    Cheers
    See

    Hi everyone
    I'm reposting this in the right thread. I've written a Directory Binding Script for 10.6 and ported it now to 10.7 as among the things that have changed in the upgraded version is a refurbished directory binding enviroment.
    The original thread can be found here: https://discussions.apple.com/thread/3090068. The script is applicable for clients as well and simplifies the binding process considerably.
    Be aware that the reformatted script here contains some faulty line breaks. So you'll have to correct them in a proper text editor.
    #!/bin/sh
    #Uncomment the following line to abort the script on errors
    #trap exit ERR
    ## Script to automate OD and AD Binding of Mac OS X 10.7 Servers
    ## Script written by Marc Horat, URZ Basel, 11.6.2010
    ## Updated: 12.08.2011
    # With the use of the following sources as inspiration:
    # http://www.howtomac.co.uk/?p=247
    #Created by Ross Hamilton
    #Clock restart / Remove existing settings
    #Join to Open Directory and Active Directory
    # Bombich's AD-Bind Script:
    # This script binds to AD and configures advanced options of the AD plugin
    # As this scripts contains a password, be sure to take appropriate security
    # precautions
    # A good way to run this script is to set it as a login hook on your master machine
    # Because it only needs to be run once, the last thing this script does is to delete
    # itself. If you have another login script that you typically run, include the
    # script on your master machine, and indicate its path in the "newLoginScript"
    # variable.
    # If running this as a one-time login hook to bind to AD after imaging,
    # be sure to enable auto-login (for any local user) before creating your master image
    #################CONFIGURATION##########################
    #OD
    # These variables need to be configured for your env
    odAdmin="YOURODADMIN" #enter your OD admin name between the quotes
    odPassword="YOURODPW"  # Enter your OD admin password between the quotes
    oddomain="YOURODDOMAIN" # FQDN of your OD domain
    computerGroup="YOURNEWODCOMPGROUP"  # Add appropriate computer group you want machines to be added to, case sensitive
    oldComputerGroup="YOUROLDODCOMPGROUP" # If the Computer is in a Group already
    #AD
    # Standard parameters
    domain="YOURADDOMAIN"                              # fully qualified DNS name of Active Directory Domain
    domainname="YOURADDOMAINNAME"                    #Name of the Domain as specified in the search paths
    udn="YOURADADMIN"                              # username of a privileged network user
    password="YOURADPW"                                                  # password of a privileged network user
    ou="OU=YOUR,OU=OU,OU=URZ,OU=IN,DC=YOUR,DC=AD,DC=DOMAIN"                    # Distinguished name of container for the computer E.G. OU=Macs,OU=Computers,DC=AD,DC=DOMAIN,DC=CH
    # Advanced options AD Plugin
    alldomains="disable"                              # 'enable' or 'disable' automatic multi-domain authentication
    localhome="disable"                              # 'enable' or 'disable' force home directory to local drive
    protocol="smb"                                        # 'afp', 'smb' or 'nfs' (since 10.7) change how home is mounted from server
    mobile="enable"                              # 'enable' or 'disable' mobile account support for offline logon
    mobileconfirm="enable"                    # 'enable' or 'disable' warn the user that a mobile acct will be created
    useuncpath="enable"                              # 'enable' or 'disable' use AD SMBHome attribute to determine the home dir
    user_shell="/bin/bash"                    # e.g., /bin/bash or "none"
    preferred="-preferred $domain"          # Use the specified server for all Directory lookups and authentication
    # (e.g. "-nopreferred" or "-preferred ad.server.edu")
    admingroups="$domainname\YOURADADMINGROUP" # These comma-separated AD groups may administer the machine (e.g. "" or "APPLE\macadmins")
    packetsign="allow"                              # allow | disable | require
    packetencrypt="allow"                    # allow | disable | require
    passinterval="14"                              # number of days
    namespace="domain"                              # forest | domain
    # Login hook setting -- specify the path to a login hook that you want to run instead of this script
    newLoginHook=""                    # e.g., "/Library/Management/login.sh"
    ################################# End of configuration
    ############ Begin of Script
    # Host-specific parameters
    # computerid should be set dynamically, this value must be machine-specific
    # This value may be restricted to 19 characters! The only error you'll receive upon entering
    # an invalid computer id is to the effect of not having appropriate privileges to perform the requested operation
    #computerid=`/sbin/ifconfig en0 | awk '/ether/ { gsub(":", ""); print $2 }'` # MAC Address
    #computerid=`hostname | sed 's/.unibas.ch//'`
    #computerid=`/usr/sbin/scutil --get LocalHostName | cut -c 1-19` # Assure that this will produce unique names!
    #computerid=`/usr/sbin/scutil --get LocalHostName`
    computerid=`scutil --get ComputerName`
    adcomputerid=`echo "$computerid" | tr [:lower:] [:upper:]`
    # These variables probably don't need to be changed
    # Determing if any directory binding exists
    nicAddress=`ifconfig en0 | grep ether | awk '{print $2}'`
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              check4ODtmp=`dscl localhost -list /LDAPv3 | grep -n 1 | sed 's/1://' | sed 's/2://'`
              check4OD=${check4ODtmp//[[:space:]]/}
              echo "Found LDAP: "$check4ODtmp
              check4ODaccttmp=`dscl /LDAPv3/"$check4OD" -read Computers/"$computerid" RealName | cut -c 11-`
              check4ODacct=${check4ODaccttmp//[[:space:]]/}
              echo "Found LDAP-Computer-Account: "$check4ODacct
    else
              check4OD=""
              check4ODacct=""
              echo "No bound LDAP Server found"
    fi
    if [ $oldComputerGroup != "" ] && dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              check4ODgroupMembershiptmp=`dscl /LDAPv3/"$check4OD" -read ComputerGroups/"$oldComputerGroup" | grep "$computerid"`
              check4ODgroupMembership=$check4ODgroupMembershiptmp
              echo "LDAP Group Membership in Group: "$oldComputerGroup
    else
              check4ODgroupMembership=""
              echo "No LDAP Group Membership defined or not bound to a server"
    fi
    if dscl localhost -list "/Active Directory" | grep $domainname > /dev/null
    then
              check4ADtmp=`dsconfigad -show | grep "Active Directory Domain" | sed 's/Active Directory Domain//'  | sed 's/=//'`
              check4AD=${check4ADtmp//[[:space:]]/}
              echo "Found AD: "$check4AD
              check4ADaccttmp=`dsconfigad -show | grep "Computer Account" | sed 's/Computer Account//' | sed 's/=//'`
              check4ADacct=${check4ADaccttmp//[[:space:]]/}
              echo "Found AD-Account: "$check4ADacct
    else
              check4AD=""
              check4ADacct=""
              echo "No AD-Account found"
    fi
    osversionlong=`sw_vers -productVersion`
    osvers=${osversionlong:3:1}
    #Time Sync
    #Restart ntpdate
    StartService ()
    if [ "${TIMESYNC:=-YES-}" = "-YES-" ] && ! GetPID ntpd > /dev/null; then
              CheckForNetwork
    if [ -f /var/run/NetworkTime.StartupItem -o "${NETWORKUP}" = "-NO-" ]; then exit; fi
              touch /var/run/NetworkTime.StartupItem
              echo "Starting network time synchronization"
    # Synchronize our clock to the network’s time,
    # then fire off ntpd to keep the clock in sync.
              ntpdate -bvs
              ntpd -f /var/run/ntp.drift -p /var/run/ntpd.pid
    fi
    echo ""
    echo ""
    sleep 5
    #### Removing any existing directory bindings
    #Clear OD Computer Account and delete entry from Computer group
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              echo "This computer is bound to the following Open Directory Services:"
              dscl localhost -list /LDAPv3
              echo "With the Search Path entries:"
              dscl /Search -read / CSPSearchPath | grep /LDAP
              sleep 5
              if [ "${check4ODacct}" == "${computerid}" ]
              then
                        echo "This machine already has a computer account on $oddomain."
                        # Set the GUID
                        GUID="$(dscl /LDAPv3/$oddomain -read /Computers/${computerid} GeneratedUID | awk '{ print $2 }')"
                        echo "Found GUID: "$GUID
                        if [ "$oldComputerGroup" != "" ] && [ "$check4ODgroupMembership" != "" ]
                        then
                                  echo "Removing entry from group $oldComputerGroup"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerGroups/"$oldComputerGroup" GroupMembership "${computerid}"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerGroups/"$oldComputerGroup" GroupMembers "${GUID}"
                                  dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /ComputerLists/"$oldComputerGroup" Computers "${computerid}"
                        fi
                        echo "Removing Computer entry $computerid in OD"
                        dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$check4OD" -delete /Computers/"${computerid}"
              fi
              #List existing Directories
              echo "Removing OD-Binding to "$check4OD
              dsconfigldap -r "$check4OD"
              echo "Removing Search Path entries"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4OD"
              dscl /Search/Contacts -delete / CSPSearchPath /LDAPv3/"$check4OD"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4OD"
              sleep 5
    else
              echo "No LDAP or OD Binding present.";
    fi
    echo ""
    # Check a second time in order to delete any remaining LDAP-Bindings
    echo "Scanning for further LDAP servers"
    if dscl localhost -list /LDAPv3 | grep . > /dev/null
    then
              echo "Found:"
              dscl localhost -list /LDAPv3
              echo "Removing OD-Binding to "$check4ODtmp
              dsconfigldap -r "$check4ODtmp"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              dscl /Search/Contacts -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              dscl /Search -delete / CSPSearchPath /LDAPv3/"$check4ODtmp"
              sleep 5
    else
              echo "No further LDAP or OD Binding present."
    fi
    echo ""
    echo ""
    #Remove the Active Directory binding
    if [ "$check4AD" != "" ]
    then
              echo "This computer is bound to the following Active Directory Services:"
              dscl localhost -list "/Active Directory"
              echo "With the Search Path entries:"
              dscl /Search -read / CSPSearchPath | grep /Active
              sleep 5
              echo "Removing any existing AD-Binding to "$check4AD
        dsconfigad -f -remove -username "$udn" -password "$password"
        echo "Removing Search Path entries"
              if [ "$preferred" != "-nopreferred" ]
              then
                        dscl /Search -delete / CSPSearchPath /Active Directory/"$domainname"
                        dscl /Search/Contacts -delete / CSPSearchPath /Active Directory/"$domainname"
                        dscl /Search -delete / CSPSearchPath /Active Directory/"$domainname"
              fi
              dscl /Search -delete / CSPSearchPath "/Active Directory/$domainname/All Domains"
              dscl /Search/Contacts -delete / CSPSearchPath "/Active Directory/$domainname/All Domains"
    #remove search path entries from 10.6
        if dscl /Search -read / CSPSearchPath | grep /Active > /dev/null
        then
            dscl /Search -delete / CSPSearchPath "/Active Directory/$domainname/$domain"
            dscl /Search/Contacts -delete / CSPSearchPath "/Active Directory/$domainname/$domain"
        fi
              sleep 5
    else
              echo "No Active Directory Binding present."
    fi
    echo ""
    #Remove Existing Directory Services Config
    echo "Removing existing DS Config"
    if [ -d "/Library/Preferences/edu.mit.Kerberos" ]
    then
              rm -R /Library/Preferences/edu.mit.Kerberos
    fi
    if [ -d "/etc/krb5.keytab" ]
    then
              rm -R /etc/krb5.keytab
    fi
    # Clean up the DirectoryService configuration files
    rm -Rfv /Library/Preferences/DirectoryService/*
    #OD
    echo ""
    echo ""
    echo "Binding to OD-Damin "$oddomain
    sleep 5
    dsconfigldap -v -a "$oddomain" -n "$oddomain" -c "$computerid"
    echo "Killing opendirectoryd"
    killall opendirectoryd
    sleep 5
    echo "Adding computer account $computerid to /LDAPv3/${oddomain} on $oddomain"
    dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -create /Computers/"$computerid" ENetAddress "$nicAddress"
    dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /Computers/"$computerid" RealName "$computerid"
    # Set the GUID
    GUID="$(dscl /LDAPv3/$oddomain -read /Computers/${computerid} GeneratedUID | awk '{ print $2 }')"
    # Add computer to ComputerList and ComputerGroup
    if [ $computerGroup != "" ]
    then
              echo "Adding computer $computerid to OD group $computerGroup on $oddomain"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerLists/"$computerGroup" apple-computers "$computerid"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerGroups/"$computerGroup" apple-group-memberguid "${GUID}"
              dscl -u "${odAdmin}" -P "${odPassword}" /LDAPv3/"$oddomain" -merge /ComputerGroups/"$computerGroup" memberUid "$computerid"
    fi
    echo "Finished OD Binding."
    sleep 5 # Give DS a chance to catch up
    echo ""
    echo ""
    echo "Performing the AD Binding"
    #AD
    # Activate the AD plugin
    defaults write /Library/Preferences/DirectoryService/DirectoryService "Active Directory" "Active"
    plutil -convert xml1 /Library/Preferences/DirectoryService/DirectoryService.plist
    #Use the existing AD-Computername or generate a new one
    computeridtmp="default"
    if [ "$check4ADacct" == "" ]
    then
              LEN=$(echo ${#adcomputerid})
              if [ $LEN -lt 15 ]; then
                      echo "ComputerID "$adcomputerid " has 15 characters or less and is therefore suitable for AD-Binding. It is $adcomputerid"
                      computeridtmp=$adcomputerid
              else
                      echo "ComputerID "$adcomputerid " has 16 or more characters and needs to be modified for AD-Binding."
                        echo "Removing any -"
                      computeridtmp=${adcomputerid//-/}
                                  LEN=$(echo ${#computeridtmp})
                                  if [ $LEN -lt 15 ]; then
                                            echo "ComputerID "$computeridtmp" has now 15 characters or less and is therefore suitable for AD-Binding."
                                  else
                                            echo "Only using the last 15 characters of the Computer name to be able to bind to AD."
                                            computeridtmp=${computeridtmp:(-15)}
                                  fi
                      echo "Cropped Computername to "$computeridtmp
              fi
    else
        computeridtmp=${check4ADacct//$/}
        echo "Found existing AD Account previously, attempting to recreate in the OU: "$computeridtmp
    fi
    echo ""
    # Bind to AD
    echo "Binding to AD-Domain "$domain" with computerid "$computeridtmp
    dsconfigad -f -add "$domain" -username "$udn" -password "$password" -ou "$ou" -computer "$computeridtmp"
    echo ""
    echo "Setting the Advanced AD Plugin options"
    # Configure advanced AD plugin options
    if [ "$admingroups" = "" ]
    then
              dsconfigad -nogroups
    else
              dsconfigad -groups "$admingroups"
    fi
    dsconfigad -alldomains "$alldomains"
    dsconfigad -localhome "$localhome"
    dsconfigad -protocol "$protocol"
    dsconfigad -mobile "$mobile"
    dsconfigad -mobileconfirm "$mobileconfirm"
    dsconfigad -useuncpath "$useuncpath"
    dsconfigad -shell "$user_shell"
    dsconfigad "$preferred"
    dsconfigad -packetsign "$packetsign" -packetencrypt "$packetencrypt" -passinterval "$passinterval"
    dsconfigad -namespace "$namespace"
    sleep 5
    echo ""
    echo ""
    # Add the OD & AD node to the search path
    if [ "$alldomains" = "enable" ]
    then
              csp="/Active Directory/$domainname/All Domains"
    else
              csp="/Active Directory/$domainname"
    fi
    echo "Finished AD Binding."
    echo "Adding Domain /LDAPv3/"$oddomain" and "$csp" to Search Path"
    dscl /Search -create / SearchPolicy CSPSearchPath
    dscl /Search/Contacts -create / SearchPolicy CSPSearchPath
    echo "Adding OD.."
    dscl /Search -append / CSPSearchPath /LDAPv3/"$oddomain"
    dscl /Search/Contacts -append / CSPSearchPath /LDAPv3/"$oddomain"
    echo "Adding AD.."
    #Adding all Domains first to improve reliability under 10.7
    if [ "$alldomains" != "enable" ]
    then
        cspadall="/Active Directory/$domainname/All Domains"
        dscl /Search/Contacts -append / CSPSearchPath "$cspadall"
        dscl /Search -append / CSPSearchPath "$cspadall"
    fi
    dscl /Search/Contacts -append / CSPSearchPath "$csp"
    dscl /Search -append / CSPSearchPath "$csp"
    echo "Finished Updating Search Paths."
    echo ""
    echo ""
    # Restart DirectoryService (necessary to reload AD plugin activation settings)
    killall opendirectoryd
    # Destroy the login hook (or change it)
    if [ "${newLoginHook}" == "" ]
    then
              defaults delete /var/root/Library/Preferences/com.apple.loginwindow LoginHook
    else
              defaults write /var/root/Library/Preferences/com.apple.loginwindow LoginHook $newLoginHook
    fi
    sleep 5
    # Customizing the login-Window
    #defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo DSStatus
    #defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool TRUE
    #defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool TRUE
    # This works in a pinch if the above code does not
    #defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Node Custom Path Array" -array "/Active Directory/All Domains"
    #defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Policy" -int 3
    #plutil -convert xml1 /Library/Preferences/DirectoryService/SearchNodeConfig.plist
    #killall opendirectoryd
    # Disable autologin
    defaults delete /Library/Preferences/com.apple.loginwindow autoLoginUser
    srm /etc/kcpassword
    echo ""
    echo ""
    echo ""
    echo "Now bound to OD Domain:"
    dscl localhost -list /LDAPv3
    echo "With Search Path entries:"
    dscl /Search -read / CSPSearchPath | grep /LDAP
    echo "Now bound to AD Domain:"
    dscl localhost -list "/Active Directory"
    echo "With Search Path entries:"
    dscl /Search -read / CSPSearchPath | grep /Active
    exit 0                    ## Success
    exit 1                    ## Failure
    Any inputs, questions and improvement suggestions are, of course, most welcome!
    Cheers
    See

  • While trying to open Open Directory, I get  a setState error

    I'm runing Server 2.2 on a new 2012 Mac Mini 2.6 running Mountain Lion 10.8.2
    My server was running fine for over a month then I updated to Server 2.2 from 2.1 and I lost my Open Directoy and it would not restart. I kept getting this message. Then all of a sudden it started working for no reason.
    Now another month later, I update the firmware on the mac mini, restart the mac and again, Open Directory won't launch and I get this message AGAIN.
    I've searched all over and tried every little advice I've gathered here and there but nothing has done the trick.
    Can anyone help ?
    Thanks.

    I am also getting this issue Paul.
    I have tried (with my limited knowledge) to get rid of all the OD preferences etc (as just playing with server) I have deleted the server app, and all files, but still when I set it up i get the same message, rather than (what I was expecting) an option to make a new OD.
    Very frustrated.
    Tom

Maybe you are looking for

  • Initial load from ECC/R3 to MDM

    Hi, Could any one tell me the process for one time intial load from  R3 to MDM. preferably without XI. how to extract data from R3 ? what format? how to map source to MDM repository? Farah

  • Icons not displaying in web pages

    navigation icons are displayed as blank containing a 4bit code. I have a screen save example.

  • Wscompile: compilation error

    Hi all, I am using wscompile to create a web service client from a wsdl file. I get an error during compilation caused by some strange symbols in the generated code. Has anyone an idea what may be wrong ? Or is it a bug in wscompile ? Kind regards Ad

  • I would like to write something for Firefox

    I would - in the light of recent visits - like to write an appreciation of Firefox Team - I have had so much help and I would like to write for anyone of "newbie" status - I do not intend to grovel but an article of appreciation for a New User -notab

  • Problem in audio driver and unable to install rescue and recovery ver 4.3 -

    Dear community collegues, I have installed original windows7 home premium in my lenovo N100 series 0768-54A model y'day. Though every thing went well, the AC97 audio driver could not be installed. Can any one provide me a solution to make the audio w