[CalendarServer-changes] [2322] PyOpenDirectory/trunk/src

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 16 13:02:07 PDT 2008


Revision: 2322
          http://trac.macosforge.org/projects/calendarserver/changeset/2322
Author:   wsanchez at apple.com
Date:     2008-04-16 13:02:06 -0700 (Wed, 16 Apr 2008)

Log Message:
-----------
Clean up tabs

Modified Paths:
--------------
    PyOpenDirectory/trunk/src/CDirectoryService.cpp
    PyOpenDirectory/trunk/src/CDirectoryService.h
    PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp
    PyOpenDirectory/trunk/src/CDirectoryServiceException.h
    PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp
    PyOpenDirectory/trunk/src/CDirectoryServiceManager.h
    PyOpenDirectory/trunk/src/CFStringUtil.cpp
    PyOpenDirectory/trunk/src/CFStringUtil.h
    PyOpenDirectory/trunk/src/PythonWrapper.cpp

Modified: PyOpenDirectory/trunk/src/CDirectoryService.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.cpp	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryService.cpp	2008-04-16 20:02:06 UTC (rev 2322)
@@ -34,48 +34,48 @@
 extern PyObject* ODException_class;
 
 // This is copied from WhitePages
-#define		kDSStdRecordTypeResources				"dsRecTypeStandard:Resources"
+#define        kDSStdRecordTypeResources                "dsRecTypeStandard:Resources"
 
 // Calendar attribute.
-#define		kDS1AttrCalendarPrincipalURI			"dsAttrTypeStandard:CalendarPrincipalURI"
+#define        kDS1AttrCalendarPrincipalURI            "dsAttrTypeStandard:CalendarPrincipalURI"
 
-const int cBufferSize = 32 * 1024;		// 32K buffer for Directory Services operations
+const int cBufferSize = 32 * 1024;        // 32K buffer for Directory Services operations
 
 #pragma mark -----Public API
 
 CDirectoryService::CDirectoryService(const char* nodename)
 {
-	mNodeName = CStringFromData(nodename, ::strlen(nodename));
-	mDir = 0L;
-	mNode = 0L;
-	mData = NULL;
-	mDataSize = 0;
+    mNodeName = CStringFromData(nodename, ::strlen(nodename));
+    mDir = 0L;
+    mNode = 0L;
+    mData = NULL;
+    mDataSize = 0;
 }
 
 CDirectoryService::~CDirectoryService()
 {
-	// Clean-up any allocated objects
-	if (mData != NULL)
-	{
-		assert(mDir != 0L);
-		::dsDataBufferDeAllocate(mDir, mData);
-		mData = 0L;
-	}
-	
-	if (mNode != 0L)
-	{
-		::dsCloseDirNode(mNode);
-		mNode = 0L;
-	}
-	
-	if (mDir != 0L)
-	{
+    // Clean-up any allocated objects
+    if (mData != NULL)
+    {
+        assert(mDir != 0L);
+        ::dsDataBufferDeAllocate(mDir, mData);
+        mData = 0L;
+    }
+    
+    if (mNode != 0L)
+    {
+        ::dsCloseDirNode(mNode);
+        mNode = 0L;
+    }
+    
+    if (mDir != 0L)
+    {
         ::dsCloseDirService(mDir);
-		mDir = 0L;
-	}
-	
-	delete mNodeName;
-	mNodeName = NULL;
+        mDir = 0L;
+    }
+    
+    delete mNodeName;
+    mNodeName = NULL;
 }
 
 // ListAllRecordsWithAttributes
@@ -86,29 +86,29 @@
 // @param attributes: CFArray of CFString listing the attributes to return for each record.
 // @return: CFMutableArrayRef composed of CFMutableArrayRef with a CFStringRef/CFMutableDictionaryRef tuple for
 //          each record, where the CFStringRef is the record name and CFMutableDictionaryRef of CFStringRef key
-//			and value entries for each attribute/value requested in the record indexed by uid,
-//		    or NULL if it fails.
+//            and value entries for each attribute/value requested in the record indexed by uid,
+//            or NULL if it fails.
 //
 CFMutableArrayRef CDirectoryService::ListAllRecordsWithAttributes(const char* recordType, CFArrayRef attributes)
 {
-	try
-	{
-		StPythonThreadState threading;
+    try
+    {
+        StPythonThreadState threading;
 
-		// Get attribute map
-		return _ListAllRecordsWithAttributes(recordType, NULL, attributes);
-	}
-	catch(CDirectoryServiceException& dserror)
-	{
-		dserror.SetPythonException();
-		return NULL;
-	}
-	catch(...)
-	{
-		CDirectoryServiceException dserror;
-		dserror.SetPythonException();
-		return NULL;
-	}
+        // Get attribute map
+        return _ListAllRecordsWithAttributes(recordType, NULL, attributes);
+    }
+    catch(CDirectoryServiceException& dserror)
+    {
+        dserror.SetPythonException();
+        return NULL;
+    }
+    catch(...)
+    {
+        CDirectoryServiceException dserror;
+        dserror.SetPythonException();
+        return NULL;
+    }
 }
 
 // QueryRecordsWithAttribute
@@ -123,29 +123,29 @@
 // @param attributes: CFArray of CFString listing the attributes to return for each record.
 // @return: CFMutableArrayRef composed of CFMutableArrayRef with a CFStringRef/CFMutableDictionaryRef tuple for
 //          each record, where the CFStringRef is the record name and CFMutableDictionaryRef of CFStringRef key
-//			and value entries for each attribute/value requested in the record indexed by uid,
-//		    or NULL if it fails.
+//          and value entries for each attribute/value requested in the record indexed by uid,
+//          or NULL if it fails.
 //
 CFMutableArrayRef CDirectoryService::QueryRecordsWithAttribute(const char* attr, const char* value, int matchType, bool casei, const char* recordType, CFArrayRef attributes)
 {
-	try
-	{
-		StPythonThreadState threading;
+    try
+    {
+        StPythonThreadState threading;
 
-		// Get attribute map
-		return _QueryRecordsWithAttributes(attr, value, matchType, NULL, casei, recordType, attributes);
-	}
-	catch(CDirectoryServiceException& dserror)
-	{
-		dserror.SetPythonException();		
-		return NULL;
-	}
-	catch(...)
-	{
-		CDirectoryServiceException dserror;
-		dserror.SetPythonException();
-		return NULL;
-	}
+        // Get attribute map
+        return _QueryRecordsWithAttributes(attr, value, matchType, NULL, casei, recordType, attributes);
+    }
+    catch(CDirectoryServiceException& dserror)
+    {
+        dserror.SetPythonException();        
+        return NULL;
+    }
+    catch(...)
+    {
+        CDirectoryServiceException dserror;
+        dserror.SetPythonException();
+        return NULL;
+    }
 }
 
 // QueryRecordsWithAttributes
@@ -158,29 +158,29 @@
 // @param attributes: CFArray of CFString listing the attributes to return for each record.
 // @return: CFMutableArrayRef composed of CFMutableArrayRef with a CFStringRef/CFMutableDictionaryRef tuple for
 //          each record, where the CFStringRef is the record name and CFMutableDictionaryRef of CFStringRef key
-//			and value entries for each attribute/value requested in the record indexed by uid,
-//		    or NULL if it fails.
+//          and value entries for each attribute/value requested in the record indexed by uid,
+//          or NULL if it fails.
 //
 CFMutableArrayRef CDirectoryService::QueryRecordsWithAttributes(const char* query, bool casei, const char* recordType, CFArrayRef attributes)
 {
-	try
-	{
-		StPythonThreadState threading;
+    try
+    {
+        StPythonThreadState threading;
 
-		// Get attribute map
-		return _QueryRecordsWithAttributes(NULL, NULL, 0, query, casei, recordType, attributes);
-	}
-	catch(CDirectoryServiceException& dserror)
-	{
-		dserror.SetPythonException();
-		return NULL;
-	}
-	catch(...)
-	{
-		CDirectoryServiceException dserror;
-		dserror.SetPythonException();
-		return NULL;
-	}
+        // Get attribute map
+        return _QueryRecordsWithAttributes(NULL, NULL, 0, query, casei, recordType, attributes);
+    }
+    catch(CDirectoryServiceException& dserror)
+    {
+        dserror.SetPythonException();
+        return NULL;
+    }
+    catch(...)
+    {
+        CDirectoryServiceException dserror;
+        dserror.SetPythonException();
+        return NULL;
+    }
 }
 
 // AuthenticateUserBasic
@@ -194,24 +194,24 @@
 //
 bool CDirectoryService::AuthenticateUserBasic(const char* nodename, const char* user, const char* pswd, bool& result)
 {
-	try
-	{
-		StPythonThreadState threading;
+    try
+    {
+        StPythonThreadState threading;
 
-		result = NativeAuthenticationBasicToNode(nodename, user, pswd);
-		return true;
-	}
-	catch(CDirectoryServiceException& dserror)
-	{
-		dserror.SetPythonException();
-		return false;
-	}
-	catch(...)
-	{
-		CDirectoryServiceException dserror;
-		dserror.SetPythonException();
-		return false;
-	}
+        result = NativeAuthenticationBasicToNode(nodename, user, pswd);
+        return true;
+    }
+    catch(CDirectoryServiceException& dserror)
+    {
+        dserror.SetPythonException();
+        return false;
+    }
+    catch(...)
+    {
+        CDirectoryServiceException dserror;
+        dserror.SetPythonException();
+        return false;
+    }
 }
 
 // AuthenticateUserDigest
@@ -225,24 +225,24 @@
 //
 bool CDirectoryService::AuthenticateUserDigest(const char* nodename, const char* user, const char* challenge, const char* response, const char* method, bool& result)
 {
-	try
-	{
-		StPythonThreadState threading;
+    try
+    {
+        StPythonThreadState threading;
 
-		result = NativeAuthenticationDigestToNode(nodename, user, challenge, response, method);
-		return true;
-	}
-	catch(CDirectoryServiceException& dserror)
-	{
-		dserror.SetPythonException();	
-		return false;
-	}
-	catch(...)
-	{
-		CDirectoryServiceException dserror;
-		dserror.SetPythonException();
-		return false;
-	}
+        result = NativeAuthenticationDigestToNode(nodename, user, challenge, response, method);
+        return true;
+    }
+    catch(CDirectoryServiceException& dserror)
+    {
+        dserror.SetPythonException();    
+        return false;
+    }
+    catch(...)
+    {
+        CDirectoryServiceException dserror;
+        dserror.SetPythonException();
+        return false;
+    }
 }
 
 #pragma mark -----Private API
@@ -256,222 +256,222 @@
 // @param attrs: a list of attributes to return.
 // @return: CFMutableArrayRef composed of CFMutableArrayRef with a CFStringRef/CFMutableDictionaryRef tuple for
 //          each record, where the CFStringRef is the record name and CFMutableDictionaryRef of CFStringRef key
-//			and value entries for each attribute/value requested in the record indexed by uid,
-//		    or NULL if it fails.
+//          and value entries for each attribute/value requested in the record indexed by uid,
+//          or NULL if it fails.
 //
 CFMutableArrayRef CDirectoryService::_ListAllRecordsWithAttributes(const char* type, CFArrayRef names, CFArrayRef attrs)
 {
-	CFMutableArrayRef result = NULL;
-	CFMutableArrayRef record_tuple = NULL;
-	CFMutableDictionaryRef record = NULL;
-	CFMutableArrayRef values = NULL;
-	tDataListPtr recNames = NULL;
-	tDataListPtr recTypes = NULL;
-	tDataListPtr attrTypes = NULL;
-	tContextData context = NULL;
-	tAttributeListRef attrListRef = 0L;
-	tRecordEntry* pRecEntry = NULL;
-	
-	// Must have attributes
-	if (::CFArrayGetCount(attrs) == 0)
-		return NULL;
+    CFMutableArrayRef result = NULL;
+    CFMutableArrayRef record_tuple = NULL;
+    CFMutableDictionaryRef record = NULL;
+    CFMutableArrayRef values = NULL;
+    tDataListPtr recNames = NULL;
+    tDataListPtr recTypes = NULL;
+    tDataListPtr attrTypes = NULL;
+    tContextData context = NULL;
+    tAttributeListRef attrListRef = 0L;
+    tRecordEntry* pRecEntry = NULL;
+    
+    // Must have attributes
+    if (::CFArrayGetCount(attrs) == 0)
+        return NULL;
 
-	try
-	{
-		// Make sure we have a valid directory service
-		OpenService();
-		
-		// Open the node we want to query
-		OpenNode();
-		
-		// We need a buffer for what comes next
-		CreateBuffer();
-		
-		// Build data list of names
-		recNames = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(recNames);
-		if (names != NULL)
-			BuildStringDataList(names, recNames);
-		else
-			ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recNames,  kDSRecordsAll, NULL));
+    try
+    {
+        // Make sure we have a valid directory service
+        OpenService();
+        
+        // Open the node we want to query
+        OpenNode();
+        
+        // We need a buffer for what comes next
+        CreateBuffer();
+        
+        // Build data list of names
+        recNames = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(recNames);
+        if (names != NULL)
+            BuildStringDataList(names, recNames);
+        else
+            ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recNames,  kDSRecordsAll, NULL));
 
-		// Build data list of types
-		recTypes = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(recTypes);
-		ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recTypes,  type, NULL));
+        // Build data list of types
+        recTypes = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(recTypes);
+        ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recTypes,  type, NULL));
 
-		// Build data list of attributes
-		attrTypes = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(attrTypes);
-		BuildStringDataList(attrs, attrTypes);
-		
-		result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
-		
-		do
-		{
-			// List all the appropriate records
-			unsigned long recCount = 0;
-			tDirStatus err;
-			do
-			{
-				err = ::dsGetRecordList(mNode, mData, recNames, eDSExact, recTypes, attrTypes, false, &recCount, &context);
-				if (err == eDSBufferTooSmall)
-					ReallocBuffer();
-			} while(err == eDSBufferTooSmall);
-			ThrowIfDSErr(err);
-			for(unsigned long i = 1; i <= recCount; i++)
-			{
-				// Get the record entry
-				ThrowIfDSErr(::dsGetRecordEntry(mNode, mData, i, &attrListRef, &pRecEntry));
-				
-				// Get the entry's name
-				char* temp = NULL;
-				ThrowIfDSErr(::dsGetRecordNameFromEntry(pRecEntry, &temp));
-				std::auto_ptr<char> recname(temp);
-				
-				// Create a dictionary for the values
-				record = ::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-				
-				// Look at each requested attribute and get one value
-				for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
-				{
-					tAttributeValueListRef attributeValueListRef = NULL;
-					tAttributeEntryPtr attributeInfoPtr = NULL;
-					
-					ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
-					
-					if (attributeInfoPtr->fAttributeValueCount > 0)
-					{
-						// Determine what the attribute is and where in the result list it should be put
-						std::auto_ptr<char> attrname(CStringFromBuffer(&attributeInfoPtr->fAttributeSignature));
-						CFStringUtil cfattrname(attrname.get());
-						
-						if (attributeInfoPtr->fAttributeValueCount > 1)
-						{
-							values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+        // Build data list of attributes
+        attrTypes = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(attrTypes);
+        BuildStringDataList(attrs, attrTypes);
+        
+        result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+        
+        do
+        {
+            // List all the appropriate records
+            unsigned long recCount = 0;
+            tDirStatus err;
+            do
+            {
+                err = ::dsGetRecordList(mNode, mData, recNames, eDSExact, recTypes, attrTypes, false, &recCount, &context);
+                if (err == eDSBufferTooSmall)
+                    ReallocBuffer();
+            } while(err == eDSBufferTooSmall);
+            ThrowIfDSErr(err);
+            for(unsigned long i = 1; i <= recCount; i++)
+            {
+                // Get the record entry
+                ThrowIfDSErr(::dsGetRecordEntry(mNode, mData, i, &attrListRef, &pRecEntry));
+                
+                // Get the entry's name
+                char* temp = NULL;
+                ThrowIfDSErr(::dsGetRecordNameFromEntry(pRecEntry, &temp));
+                std::auto_ptr<char> recname(temp);
+                
+                // Create a dictionary for the values
+                record = ::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                
+                // Look at each requested attribute and get one value
+                for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
+                {
+                    tAttributeValueListRef attributeValueListRef = NULL;
+                    tAttributeEntryPtr attributeInfoPtr = NULL;
+                    
+                    ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
+                    
+                    if (attributeInfoPtr->fAttributeValueCount > 0)
+                    {
+                        // Determine what the attribute is and where in the result list it should be put
+                        std::auto_ptr<char> attrname(CStringFromBuffer(&attributeInfoPtr->fAttributeSignature));
+                        CFStringUtil cfattrname(attrname.get());
+                        
+                        if (attributeInfoPtr->fAttributeValueCount > 1)
+                        {
+                            values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
 
-							for(unsigned long k = 1; k <= attributeInfoPtr->fAttributeValueCount; k++)
-							{
-								// Get the attribute value and store in results
-								tAttributeValueEntryPtr attributeValue = NULL;
-								ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, k, attributeValueListRef, &attributeValue));
-								std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
-								CFStringUtil strvalue(data.get());
-								::CFArrayAppendValue(values, strvalue.get());
-								::dsDeallocAttributeValueEntry(mDir, attributeValue);
-								attributeValue = NULL;
-							}
-							::CFDictionarySetValue(record, cfattrname.get(), values);
-							::CFRelease(values);
-							values = NULL;
-						}
-						else
-						{
-							// Get the attribute value and store in results
-							tAttributeValueEntryPtr attributeValue = NULL;
-							ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, 1, attributeValueListRef, &attributeValue));
-							std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
-							CFStringUtil strvalue(data.get());
-							::CFDictionarySetValue(record, cfattrname.get(), strvalue.get());
-							::dsDeallocAttributeValueEntry(mDir, attributeValue);
-							attributeValue = NULL;
-						}
-					}
-					
-					::dsCloseAttributeValueList(attributeValueListRef);
-					attributeValueListRef = NULL;
-					::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
-					attributeInfoPtr = NULL;
-				}
-				
-				// Create tuple of record name and record values
-				CFStringUtil str(recname.get());
-				
-				record_tuple = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, &kCFTypeArrayCallBacks);
-				::CFArrayAppendValue(record_tuple, str.get());
-				::CFArrayAppendValue(record_tuple, record);
-				::CFRelease(record);
-				record = NULL;
+                            for(unsigned long k = 1; k <= attributeInfoPtr->fAttributeValueCount; k++)
+                            {
+                                // Get the attribute value and store in results
+                                tAttributeValueEntryPtr attributeValue = NULL;
+                                ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, k, attributeValueListRef, &attributeValue));
+                                std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
+                                CFStringUtil strvalue(data.get());
+                                ::CFArrayAppendValue(values, strvalue.get());
+                                ::dsDeallocAttributeValueEntry(mDir, attributeValue);
+                                attributeValue = NULL;
+                            }
+                            ::CFDictionarySetValue(record, cfattrname.get(), values);
+                            ::CFRelease(values);
+                            values = NULL;
+                        }
+                        else
+                        {
+                            // Get the attribute value and store in results
+                            tAttributeValueEntryPtr attributeValue = NULL;
+                            ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, 1, attributeValueListRef, &attributeValue));
+                            std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
+                            CFStringUtil strvalue(data.get());
+                            ::CFDictionarySetValue(record, cfattrname.get(), strvalue.get());
+                            ::dsDeallocAttributeValueEntry(mDir, attributeValue);
+                            attributeValue = NULL;
+                        }
+                    }
+                    
+                    ::dsCloseAttributeValueList(attributeValueListRef);
+                    attributeValueListRef = NULL;
+                    ::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
+                    attributeInfoPtr = NULL;
+                }
+                
+                // Create tuple of record name and record values
+                CFStringUtil str(recname.get());
+                
+                record_tuple = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, &kCFTypeArrayCallBacks);
+                ::CFArrayAppendValue(record_tuple, str.get());
+                ::CFArrayAppendValue(record_tuple, record);
+                ::CFRelease(record);
+                record = NULL;
 
-				// Append tuple to results array
-				::CFArrayAppendValue(result, record_tuple);
-				::CFRelease(record_tuple);
-				record_tuple = NULL;
-				
-				// Clean-up
-				::dsCloseAttributeList(attrListRef);
-				attrListRef = 0L;
-				::dsDeallocRecordEntry(mDir, pRecEntry);
-				pRecEntry = NULL;
-			}
-		} while (context != NULL); // Loop until all data has been obtained.
-		
-		// Cleanup
-		::dsDataListDeallocate(mDir, recNames);
-		::dsDataListDeallocate(mDir, recTypes);
-		::dsDataListDeallocate(mDir, attrTypes);
-		free(recNames);
-		free(recTypes);
-		free(attrTypes);
-		RemoveBuffer();
-		CloseNode();
-		CloseService();
-	}
-	catch(CDirectoryServiceException& dsStatus)
-	{
-		// Cleanup
-		if (context != NULL)
-			::dsReleaseContinueData(mDir, context);
-		if (attrListRef != 0L)
-			::dsCloseAttributeList(attrListRef);
-		if (pRecEntry != NULL)
-			dsDeallocRecordEntry(mDir, pRecEntry);
-		if (recNames != NULL)
-		{
-			::dsDataListDeallocate(mDir, recNames);
-			free(recNames);
-			recNames = NULL;
-		}
-		if (recTypes != NULL)
-		{
-			::dsDataListDeallocate(mDir, recTypes);
-			free(recTypes);
-			recTypes = NULL;
-		}
-		if (attrTypes != NULL)
-		{
-			::dsDataListDeallocate(mDir, attrTypes);
-			free(attrTypes);
-			attrTypes = NULL;
-		}
-		RemoveBuffer();
-		CloseNode();
-		CloseService();
-		
-		if (values != NULL)
-		{
-			::CFRelease(values);
-			values = NULL;
-		}
-		if (record != NULL)
-		{
-			::CFRelease(record);
-			record = NULL;
-		}
-		if (record_tuple != NULL)
-		{
-			::CFRelease(record_tuple);
-			record_tuple = NULL;
-		}
-		if (result != NULL)
-		{
-			::CFRelease(result);
-			result = NULL;
-		}
-		throw;
-	}
-	
-	return result;
+                // Append tuple to results array
+                ::CFArrayAppendValue(result, record_tuple);
+                ::CFRelease(record_tuple);
+                record_tuple = NULL;
+                
+                // Clean-up
+                ::dsCloseAttributeList(attrListRef);
+                attrListRef = 0L;
+                ::dsDeallocRecordEntry(mDir, pRecEntry);
+                pRecEntry = NULL;
+            }
+        } while (context != NULL); // Loop until all data has been obtained.
+        
+        // Cleanup
+        ::dsDataListDeallocate(mDir, recNames);
+        ::dsDataListDeallocate(mDir, recTypes);
+        ::dsDataListDeallocate(mDir, attrTypes);
+        free(recNames);
+        free(recTypes);
+        free(attrTypes);
+        RemoveBuffer();
+        CloseNode();
+        CloseService();
+    }
+    catch(CDirectoryServiceException& dsStatus)
+    {
+        // Cleanup
+        if (context != NULL)
+            ::dsReleaseContinueData(mDir, context);
+        if (attrListRef != 0L)
+            ::dsCloseAttributeList(attrListRef);
+        if (pRecEntry != NULL)
+            dsDeallocRecordEntry(mDir, pRecEntry);
+        if (recNames != NULL)
+        {
+            ::dsDataListDeallocate(mDir, recNames);
+            free(recNames);
+            recNames = NULL;
+        }
+        if (recTypes != NULL)
+        {
+            ::dsDataListDeallocate(mDir, recTypes);
+            free(recTypes);
+            recTypes = NULL;
+        }
+        if (attrTypes != NULL)
+        {
+            ::dsDataListDeallocate(mDir, attrTypes);
+            free(attrTypes);
+            attrTypes = NULL;
+        }
+        RemoveBuffer();
+        CloseNode();
+        CloseService();
+        
+        if (values != NULL)
+        {
+            ::CFRelease(values);
+            values = NULL;
+        }
+        if (record != NULL)
+        {
+            ::CFRelease(record);
+            record = NULL;
+        }
+        if (record_tuple != NULL)
+        {
+            ::CFRelease(record_tuple);
+            record_tuple = NULL;
+        }
+        if (result != NULL)
+        {
+            ::CFRelease(result);
+            result = NULL;
+        }
+        throw;
+    }
+    
+    return result;
 }
 
 // _QueryRecordsWithAttributes
@@ -487,244 +487,244 @@
 // @param attrs: a list of attributes to return.
 // @return: CFMutableArrayRef composed of CFMutableArrayRef with a CFStringRef/CFMutableDictionaryRef tuple for
 //          each record, where the CFStringRef is the record name and CFMutableDictionaryRef of CFStringRef key
-//			and value entries for each attribute/value requested in the record indexed by uid,
-//		    or NULL if it fails.
+//          and value entries for each attribute/value requested in the record indexed by uid,
+//          or NULL if it fails.
 //
 CFMutableArrayRef CDirectoryService::_QueryRecordsWithAttributes(const char* attr, const char* value, int matchType, const char* compound, bool casei, const char* type, CFArrayRef attrs)
 {
-	CFMutableArrayRef result = NULL;
-	CFMutableArrayRef record_tuple = NULL;
-	CFMutableDictionaryRef record = NULL;
-	CFMutableArrayRef values = NULL;
-	tDataNodePtr queryAttr = NULL;
-	tDataNodePtr queryValue = NULL;
-	tDataListPtr recTypes = NULL;
-	tDataListPtr attrTypes = NULL;
-	tContextData context = NULL;
-	tAttributeListRef attrListRef = 0L;
-	tRecordEntry* pRecEntry = NULL;
-	
-	// Must have attributes
-	if (::CFArrayGetCount(attrs) == 0)
-		return NULL;
+    CFMutableArrayRef result = NULL;
+    CFMutableArrayRef record_tuple = NULL;
+    CFMutableDictionaryRef record = NULL;
+    CFMutableArrayRef values = NULL;
+    tDataNodePtr queryAttr = NULL;
+    tDataNodePtr queryValue = NULL;
+    tDataListPtr recTypes = NULL;
+    tDataListPtr attrTypes = NULL;
+    tContextData context = NULL;
+    tAttributeListRef attrListRef = 0L;
+    tRecordEntry* pRecEntry = NULL;
+    
+    // Must have attributes
+    if (::CFArrayGetCount(attrs) == 0)
+        return NULL;
 
-	try
-	{
-		// Make sure we have a valid directory service
-		OpenService();
-		
-		// Open the node we want to query
-		OpenNode();
-		
-		// We need a buffer for what comes next
-		CreateBuffer();
-		
-		if (compound == NULL)
-		{
-			// Determine attribute to search
-			queryAttr = ::dsDataNodeAllocateString(mDir, attr);
-			ThrowIfNULL(queryAttr);
+    try
+    {
+        // Make sure we have a valid directory service
+        OpenService();
+        
+        // Open the node we want to query
+        OpenNode();
+        
+        // We need a buffer for what comes next
+        CreateBuffer();
+        
+        if (compound == NULL)
+        {
+            // Determine attribute to search
+            queryAttr = ::dsDataNodeAllocateString(mDir, attr);
+            ThrowIfNULL(queryAttr);
 
-			queryValue = ::dsDataNodeAllocateString(mDir, value);
-			ThrowIfNULL(queryValue);
+            queryValue = ::dsDataNodeAllocateString(mDir, value);
+            ThrowIfNULL(queryValue);
 
-			if (casei)
-				matchType |= 0x0100;
-			else
-				matchType &= 0xFEFF;
-		}
-		else
-		{
-			queryAttr = ::dsDataNodeAllocateString(mDir, kDS1AttrDistinguishedName);
-			ThrowIfNULL(queryAttr);
+            if (casei)
+                matchType |= 0x0100;
+            else
+                matchType &= 0xFEFF;
+        }
+        else
+        {
+            queryAttr = ::dsDataNodeAllocateString(mDir, kDS1AttrDistinguishedName);
+            ThrowIfNULL(queryAttr);
 
-			queryValue = ::dsDataNodeAllocateString(mDir, compound);
-			ThrowIfNULL(queryValue);
+            queryValue = ::dsDataNodeAllocateString(mDir, compound);
+            ThrowIfNULL(queryValue);
 
-			matchType = (casei) ? eDSiCompoundExpression : eDSCompoundExpression;
-		}
-	
-		// Build data list of types
-		recTypes = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(recTypes);
-		ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recTypes,  type, NULL));
+            matchType = (casei) ? eDSiCompoundExpression : eDSCompoundExpression;
+        }
+    
+        // Build data list of types
+        recTypes = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(recTypes);
+        ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, recTypes,  type, NULL));
 
-		// Build data list of attributes
-		attrTypes = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(attrTypes);
-		BuildStringDataList(attrs, attrTypes);
-		
-		result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
-		
-		do
-		{
-			// List all the appropriate records
-			unsigned long recCount = 0;
-			tDirStatus err;
-			do
-			{
-				err = ::dsDoAttributeValueSearchWithData(mNode, mData, recTypes, queryAttr, (tDirPatternMatch)matchType, queryValue, attrTypes, false, &recCount, &context);
-				if (err == eDSBufferTooSmall)
-					ReallocBuffer();
-			} while(err == eDSBufferTooSmall);
-			ThrowIfDSErr(err);
-			for(unsigned long i = 1; i <= recCount; i++)
-			{
-				// Get the record entry
-				ThrowIfDSErr(::dsGetRecordEntry(mNode, mData, i, &attrListRef, &pRecEntry));
-				
-				// Get the entry's name
-				char* temp = NULL;
-				ThrowIfDSErr(::dsGetRecordNameFromEntry(pRecEntry, &temp));
-				std::auto_ptr<char> recname(temp);
-				
-				// Create a dictionary for the values
-				record = ::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-				
-				// Look at each requested attribute and get one value
-				for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
-				{
-					tAttributeValueListRef attributeValueListRef = NULL;
-					tAttributeEntryPtr attributeInfoPtr = NULL;
-					
-					ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
-					
-					if (attributeInfoPtr->fAttributeValueCount > 0)
-					{
-						// Determine what the attribute is and where in the result list it should be put
-						std::auto_ptr<char> attrname(CStringFromBuffer(&attributeInfoPtr->fAttributeSignature));
-						CFStringUtil cfattrname(attrname.get());
-						
-						if (attributeInfoPtr->fAttributeValueCount > 1)
-						{
-							values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+        // Build data list of attributes
+        attrTypes = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(attrTypes);
+        BuildStringDataList(attrs, attrTypes);
+        
+        result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+        
+        do
+        {
+            // List all the appropriate records
+            unsigned long recCount = 0;
+            tDirStatus err;
+            do
+            {
+                err = ::dsDoAttributeValueSearchWithData(mNode, mData, recTypes, queryAttr, (tDirPatternMatch)matchType, queryValue, attrTypes, false, &recCount, &context);
+                if (err == eDSBufferTooSmall)
+                    ReallocBuffer();
+            } while(err == eDSBufferTooSmall);
+            ThrowIfDSErr(err);
+            for(unsigned long i = 1; i <= recCount; i++)
+            {
+                // Get the record entry
+                ThrowIfDSErr(::dsGetRecordEntry(mNode, mData, i, &attrListRef, &pRecEntry));
+                
+                // Get the entry's name
+                char* temp = NULL;
+                ThrowIfDSErr(::dsGetRecordNameFromEntry(pRecEntry, &temp));
+                std::auto_ptr<char> recname(temp);
+                
+                // Create a dictionary for the values
+                record = ::CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                
+                // Look at each requested attribute and get one value
+                for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
+                {
+                    tAttributeValueListRef attributeValueListRef = NULL;
+                    tAttributeEntryPtr attributeInfoPtr = NULL;
+                    
+                    ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
+                    
+                    if (attributeInfoPtr->fAttributeValueCount > 0)
+                    {
+                        // Determine what the attribute is and where in the result list it should be put
+                        std::auto_ptr<char> attrname(CStringFromBuffer(&attributeInfoPtr->fAttributeSignature));
+                        CFStringUtil cfattrname(attrname.get());
+                        
+                        if (attributeInfoPtr->fAttributeValueCount > 1)
+                        {
+                            values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
 
-							for(unsigned long k = 1; k <= attributeInfoPtr->fAttributeValueCount; k++)
-							{
-								// Get the attribute value and store in results
-								tAttributeValueEntryPtr attributeValue = NULL;
-								ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, k, attributeValueListRef, &attributeValue));
-								std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
-								CFStringUtil strvalue(data.get());
-								::CFArrayAppendValue(values, strvalue.get());
-								::dsDeallocAttributeValueEntry(mDir, attributeValue);
-								attributeValue = NULL;
-							}
-							::CFDictionarySetValue(record, cfattrname.get(), values);
-							::CFRelease(values);
-							values = NULL;
-						}
-						else
-						{
-							// Get the attribute value and store in results
-							tAttributeValueEntryPtr attributeValue = NULL;
-							ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, 1, attributeValueListRef, &attributeValue));
-							std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
-							CFStringUtil strvalue(data.get());
-							::CFDictionarySetValue(record, cfattrname.get(), strvalue.get());
-							::dsDeallocAttributeValueEntry(mDir, attributeValue);
-							attributeValue = NULL;
-						}
-					}
-					
-					::dsCloseAttributeValueList(attributeValueListRef);
-					attributeValueListRef = NULL;
-					::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
-					attributeInfoPtr = NULL;
-				}
-				
-				// Create tuple of record name and record values
-				CFStringUtil str(recname.get());
-				
-				record_tuple = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, &kCFTypeArrayCallBacks);
-				::CFArrayAppendValue(record_tuple, str.get());
-				::CFArrayAppendValue(record_tuple, record);
-				::CFRelease(record);
-				record = NULL;
+                            for(unsigned long k = 1; k <= attributeInfoPtr->fAttributeValueCount; k++)
+                            {
+                                // Get the attribute value and store in results
+                                tAttributeValueEntryPtr attributeValue = NULL;
+                                ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, k, attributeValueListRef, &attributeValue));
+                                std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
+                                CFStringUtil strvalue(data.get());
+                                ::CFArrayAppendValue(values, strvalue.get());
+                                ::dsDeallocAttributeValueEntry(mDir, attributeValue);
+                                attributeValue = NULL;
+                            }
+                            ::CFDictionarySetValue(record, cfattrname.get(), values);
+                            ::CFRelease(values);
+                            values = NULL;
+                        }
+                        else
+                        {
+                            // Get the attribute value and store in results
+                            tAttributeValueEntryPtr attributeValue = NULL;
+                            ThrowIfDSErr(::dsGetAttributeValue(mNode, mData, 1, attributeValueListRef, &attributeValue));
+                            std::auto_ptr<char> data(CStringFromBuffer(&attributeValue->fAttributeValueData));
+                            CFStringUtil strvalue(data.get());
+                            ::CFDictionarySetValue(record, cfattrname.get(), strvalue.get());
+                            ::dsDeallocAttributeValueEntry(mDir, attributeValue);
+                            attributeValue = NULL;
+                        }
+                    }
+                    
+                    ::dsCloseAttributeValueList(attributeValueListRef);
+                    attributeValueListRef = NULL;
+                    ::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
+                    attributeInfoPtr = NULL;
+                }
+                
+                // Create tuple of record name and record values
+                CFStringUtil str(recname.get());
+                
+                record_tuple = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, &kCFTypeArrayCallBacks);
+                ::CFArrayAppendValue(record_tuple, str.get());
+                ::CFArrayAppendValue(record_tuple, record);
+                ::CFRelease(record);
+                record = NULL;
 
-				// Append tuple to results array
-				::CFArrayAppendValue(result, record_tuple);
-				::CFRelease(record_tuple);
-				record_tuple = NULL;
+                // Append tuple to results array
+                ::CFArrayAppendValue(result, record_tuple);
+                ::CFRelease(record_tuple);
+                record_tuple = NULL;
 
-				// Clean-up
-				::dsCloseAttributeList(attrListRef);
-				attrListRef = 0L;
-				::dsDeallocRecordEntry(mDir, pRecEntry);
-				pRecEntry = NULL;
-			}
-		} while (context != NULL); // Loop until all data has been obtained.
-		
-		// Cleanup
-		::dsDataListDeallocate(mDir, recTypes);
-		::dsDataListDeallocate(mDir, attrTypes);
-		::dsDataNodeDeAllocate(mDir, queryValue);
-		::dsDataNodeDeAllocate(mDir, queryAttr);
-		free(recTypes);
-		free(attrTypes);
-		RemoveBuffer();
-		CloseNode();
-		CloseService();
-	}
-	catch(CDirectoryServiceException& dsStatus)
-	{
-		// Cleanup
-		if (context != NULL)
-			::dsReleaseContinueData(mDir, context);
-		if (attrListRef != 0L)
-			::dsCloseAttributeList(attrListRef);
-		if (pRecEntry != NULL)
-			dsDeallocRecordEntry(mDir, pRecEntry);
-		if (recTypes != NULL)
-		{
-			::dsDataListDeallocate(mDir, recTypes);
-			free(recTypes);
-			recTypes = NULL;
-		}
-		if (attrTypes != NULL)
-		{
-			::dsDataListDeallocate(mDir, attrTypes);
-			free(attrTypes);
-			attrTypes = NULL;
-		}
-		if (queryValue != NULL)
-		{
-			::dsDataNodeDeAllocate(mDir, queryValue);
-			queryValue = NULL;
-		}
-		if (queryAttr != NULL)
-		{
-			::dsDataNodeDeAllocate(mDir, queryAttr);
-			queryAttr = NULL;
-		}
-		RemoveBuffer();
-		CloseNode();
-		CloseService();
-		
-		if (values != NULL)
-		{
-			::CFRelease(values);
-			values = NULL;
-		}
-		if (record != NULL)
-		{
-			::CFRelease(record);
-			record = NULL;
-		}
-		if (record_tuple != NULL)
-		{
-			::CFRelease(record_tuple);
-			record_tuple = NULL;
-		}
-		if (result != NULL)
-		{
-			::CFRelease(result);
-			result = NULL;
-		}
-		throw;
-	}
-	
-	return result;
+                // Clean-up
+                ::dsCloseAttributeList(attrListRef);
+                attrListRef = 0L;
+                ::dsDeallocRecordEntry(mDir, pRecEntry);
+                pRecEntry = NULL;
+            }
+        } while (context != NULL); // Loop until all data has been obtained.
+        
+        // Cleanup
+        ::dsDataListDeallocate(mDir, recTypes);
+        ::dsDataListDeallocate(mDir, attrTypes);
+        ::dsDataNodeDeAllocate(mDir, queryValue);
+        ::dsDataNodeDeAllocate(mDir, queryAttr);
+        free(recTypes);
+        free(attrTypes);
+        RemoveBuffer();
+        CloseNode();
+        CloseService();
+    }
+    catch(CDirectoryServiceException& dsStatus)
+    {
+        // Cleanup
+        if (context != NULL)
+            ::dsReleaseContinueData(mDir, context);
+        if (attrListRef != 0L)
+            ::dsCloseAttributeList(attrListRef);
+        if (pRecEntry != NULL)
+            dsDeallocRecordEntry(mDir, pRecEntry);
+        if (recTypes != NULL)
+        {
+            ::dsDataListDeallocate(mDir, recTypes);
+            free(recTypes);
+            recTypes = NULL;
+        }
+        if (attrTypes != NULL)
+        {
+            ::dsDataListDeallocate(mDir, attrTypes);
+            free(attrTypes);
+            attrTypes = NULL;
+        }
+        if (queryValue != NULL)
+        {
+            ::dsDataNodeDeAllocate(mDir, queryValue);
+            queryValue = NULL;
+        }
+        if (queryAttr != NULL)
+        {
+            ::dsDataNodeDeAllocate(mDir, queryAttr);
+            queryAttr = NULL;
+        }
+        RemoveBuffer();
+        CloseNode();
+        CloseService();
+        
+        if (values != NULL)
+        {
+            ::CFRelease(values);
+            values = NULL;
+        }
+        if (record != NULL)
+        {
+            ::CFRelease(record);
+            record = NULL;
+        }
+        if (record_tuple != NULL)
+        {
+            ::CFRelease(record_tuple);
+            record_tuple = NULL;
+        }
+        if (result != NULL)
+        {
+            ::CFRelease(result);
+            result = NULL;
+        }
+        throw;
+    }
+    
+    return result;
 }
 
 // NativeAuthenticationBasicToNode
@@ -737,86 +737,86 @@
 // @return: true if authentication succeeds, false otherwise.
 //
 bool CDirectoryService::NativeAuthenticationBasicToNode(const char* nodename, const char* user, const char* pswd)
-{	
-	bool result = false;
-	tDirNodeReference node = 0L;
+{    
+    bool result = false;
+    tDirNodeReference node = 0L;
     tDataNodePtr authType = NULL;
     tDataBufferPtr authData = NULL;
     tContextData context = NULL;
-	
-	try
-	{
-		// Make sure we have a valid directory service
-		OpenService();
-		
-		// Open the node we want to query
-		node = OpenNamedNode(nodename);
-		
-		CreateBuffer();
+    
+    try
+    {
+        // Make sure we have a valid directory service
+        OpenService();
+        
+        // Open the node we want to query
+        node = OpenNamedNode(nodename);
+        
+        CreateBuffer();
 
-		// First, specify the type of authentication.
-		authType = ::dsDataNodeAllocateString(mDir, kDSStdAuthClearText);
+        // First, specify the type of authentication.
+        authType = ::dsDataNodeAllocateString(mDir, kDSStdAuthClearText);
 
-		// Build input data
-		//  Native authentication is a one step authentication scheme.
-		//  Step 1
-		//      Send: <length><recordname>
-		//            <length><cleartextpassword>
-		//   Receive: success or failure.
-		long aDataBufSize = sizeof(long) + ::strlen(user) + sizeof(long) + ::strlen(pswd);
-		authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
-		if (authData == NULL)
-			ThrowIfDSErr(eDSNullDataBuff);
-		long aCurLength = 0;
-		long aTempLength = ::strlen(user);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        // Build input data
+        //  Native authentication is a one step authentication scheme.
+        //  Step 1
+        //      Send: <length><recordname>
+        //            <length><cleartextpassword>
+        //   Receive: success or failure.
+        long aDataBufSize = sizeof(long) + ::strlen(user) + sizeof(long) + ::strlen(pswd);
+        authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
+        if (authData == NULL)
+            ThrowIfDSErr(eDSNullDataBuff);
+        long aCurLength = 0;
+        long aTempLength = ::strlen(user);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), user,  aTempLength);
-		aCurLength += aTempLength;
+        ::memcpy(&(authData->fBufferData[aCurLength]), user,  aTempLength);
+        aCurLength += aTempLength;
 
-		aTempLength = ::strlen(pswd);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        aTempLength = ::strlen(pswd);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), pswd,  aTempLength);
-		
-		authData->fBufferLength = aDataBufSize;
-		
-		// Do authentication
-		long dirStatus = ::dsDoDirNodeAuth(node, authType, true,  authData,  mData, &context);
-		result = (dirStatus == eDSNoErr);
-		
-		// Cleanup
-		::dsDataBufferDeAllocate(mDir, authData);
-		authData = NULL;
-		::dsDataNodeDeAllocate(mDir, authType);
-		authType = NULL;
-		RemoveBuffer();
-		if (node != 0L)
-		{
-			::dsCloseDirNode(node);
-			node = 0L;
-		}
-		CloseService();
-	}
-	catch(...)
-	{
-		// Cleanup
-		if (authData != NULL)
-			::dsDataBufferDeAllocate(mDir, authData);
-		if (authType != NULL)
-			::dsDataNodeDeAllocate(mDir, authType);
-		RemoveBuffer();
-		if (node != 0L)
-		{
-			::dsCloseDirNode(node);
-			node = 0L;
-		}
-		CloseService();
-		
-		throw;
-	}
+        ::memcpy(&(authData->fBufferData[aCurLength]), pswd,  aTempLength);
+        
+        authData->fBufferLength = aDataBufSize;
+        
+        // Do authentication
+        long dirStatus = ::dsDoDirNodeAuth(node, authType, true,  authData,  mData, &context);
+        result = (dirStatus == eDSNoErr);
+        
+        // Cleanup
+        ::dsDataBufferDeAllocate(mDir, authData);
+        authData = NULL;
+        ::dsDataNodeDeAllocate(mDir, authType);
+        authType = NULL;
+        RemoveBuffer();
+        if (node != 0L)
+        {
+            ::dsCloseDirNode(node);
+            node = 0L;
+        }
+        CloseService();
+    }
+    catch(...)
+    {
+        // Cleanup
+        if (authData != NULL)
+            ::dsDataBufferDeAllocate(mDir, authData);
+        if (authType != NULL)
+            ::dsDataNodeDeAllocate(mDir, authType);
+        RemoveBuffer();
+        if (node != 0L)
+        {
+            ::dsCloseDirNode(node);
+            node = 0L;
+        }
+        CloseService();
+        
+        throw;
+    }
 
     return result;
 }
@@ -833,106 +833,106 @@
 // @return: true if authentication succeeds, false otherwise.
 //
 bool CDirectoryService::NativeAuthenticationDigestToNode(const char* nodename, const char* user,
-														 const char* challenge, const char* response, const char* method)
-{	
-	bool result = false;
-	tDirNodeReference node = 0L;
+                                                         const char* challenge, const char* response, const char* method)
+{    
+    bool result = false;
+    tDirNodeReference node = 0L;
     tDataNodePtr authType = NULL;
     tDataBufferPtr authData = NULL;
     tContextData context = NULL;
-	
-	try
-	{
-		// Make sure we have a valid directory service
-		OpenService();
-		
-		// Open the node we want to query
-		node = OpenNamedNode(nodename);
-		
-		CreateBuffer();
+    
+    try
+    {
+        // Make sure we have a valid directory service
+        OpenService();
+        
+        // Open the node we want to query
+        node = OpenNamedNode(nodename);
+        
+        CreateBuffer();
 
-		// First, specify the type of authentication.
-		authType = ::dsDataNodeAllocateString(mDir, kDSStdAuthDIGEST_MD5);
+        // First, specify the type of authentication.
+        authType = ::dsDataNodeAllocateString(mDir, kDSStdAuthDIGEST_MD5);
 
-		// Build input data
-		//  Native authentication is a one step authentication scheme.
-		//  Step 1
-		//      Send: <length><user>
-		//			  <length><challenge>
-		//            <length><response>
-		//			  <length><method>
-		//   Receive: success or failure.
-		long aDataBufSize = sizeof(long) + ::strlen(user) +
-							sizeof(long) + ::strlen(challenge) +
-							sizeof(long) + ::strlen(response) +
-							sizeof(long) + ::strlen(method);
-		authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
-		if (authData == NULL)
-			ThrowIfDSErr(eDSNullDataBuff);
-		long aCurLength = 0;
-		long aTempLength = ::strlen(user);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        // Build input data
+        //  Native authentication is a one step authentication scheme.
+        //  Step 1
+        //      Send: <length><user>
+        //              <length><challenge>
+        //            <length><response>
+        //              <length><method>
+        //   Receive: success or failure.
+        long aDataBufSize = sizeof(long) + ::strlen(user) +
+                            sizeof(long) + ::strlen(challenge) +
+                            sizeof(long) + ::strlen(response) +
+                            sizeof(long) + ::strlen(method);
+        authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
+        if (authData == NULL)
+            ThrowIfDSErr(eDSNullDataBuff);
+        long aCurLength = 0;
+        long aTempLength = ::strlen(user);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), user,  aTempLength);
-		aCurLength += aTempLength;
+        ::memcpy(&(authData->fBufferData[aCurLength]), user,  aTempLength);
+        aCurLength += aTempLength;
 
-		aTempLength = ::strlen(challenge);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        aTempLength = ::strlen(challenge);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), challenge,  aTempLength);
-		aCurLength += aTempLength;
-		
-		aTempLength = ::strlen(response);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        ::memcpy(&(authData->fBufferData[aCurLength]), challenge,  aTempLength);
+        aCurLength += aTempLength;
+        
+        aTempLength = ::strlen(response);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), response,  aTempLength);
-		aCurLength += aTempLength;
-		
-		aTempLength = ::strlen(method);
-		::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
-		aCurLength += sizeof(long);
+        ::memcpy(&(authData->fBufferData[aCurLength]), response,  aTempLength);
+        aCurLength += aTempLength;
+        
+        aTempLength = ::strlen(method);
+        ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength,  sizeof(long));
+        aCurLength += sizeof(long);
 
-		::memcpy(&(authData->fBufferData[aCurLength]), method,  aTempLength);
-		
-		authData->fBufferLength = aDataBufSize;
-		
-		// Do authentication
-		long dirStatus = ::dsDoDirNodeAuth(node, authType, true,  authData,  mData, &context);
-		result = (dirStatus == eDSNoErr);
-		
-		// Cleanup
-		::dsDataBufferDeAllocate(mDir, authData);
-		authData = NULL;
-		::dsDataNodeDeAllocate(mDir, authType);
-		authType = NULL;
-		RemoveBuffer();
-		if (node != 0L)
-		{
-			::dsCloseDirNode(node);
-			node = 0L;
-		}
-		CloseService();
-	}
-	catch(...)
-	{
-		// Cleanup
-		if (authData != NULL)
-			::dsDataBufferDeAllocate(mDir, authData);
-		if (authType != NULL)
-			::dsDataNodeDeAllocate(mDir, authType);
-		RemoveBuffer();
-		if (node != 0L)
-		{
-			::dsCloseDirNode(node);
-			node = 0L;
-		}
-		CloseService();
-		
-		throw;
-	}
+        ::memcpy(&(authData->fBufferData[aCurLength]), method,  aTempLength);
+        
+        authData->fBufferLength = aDataBufSize;
+        
+        // Do authentication
+        long dirStatus = ::dsDoDirNodeAuth(node, authType, true,  authData,  mData, &context);
+        result = (dirStatus == eDSNoErr);
+        
+        // Cleanup
+        ::dsDataBufferDeAllocate(mDir, authData);
+        authData = NULL;
+        ::dsDataNodeDeAllocate(mDir, authType);
+        authType = NULL;
+        RemoveBuffer();
+        if (node != 0L)
+        {
+            ::dsCloseDirNode(node);
+            node = 0L;
+        }
+        CloseService();
+    }
+    catch(...)
+    {
+        // Cleanup
+        if (authData != NULL)
+            ::dsDataBufferDeAllocate(mDir, authData);
+        if (authType != NULL)
+            ::dsDataNodeDeAllocate(mDir, authType);
+        RemoveBuffer();
+        if (node != 0L)
+        {
+            ::dsCloseDirNode(node);
+            node = 0L;
+        }
+        CloseService();
+        
+        throw;
+    }
 
     return result;
 }
@@ -945,15 +945,15 @@
 //
 void CDirectoryService::OpenService()
 {
-	if (mDir == 0L)
-	{
-		long dirStatus = ::dsOpenDirService(&mDir);
-		if (dirStatus != eDSNoErr)
-		{
-			mDir = 0L;
-			ThrowIfDSErr(dirStatus);
-		}
-	}
+    if (mDir == 0L)
+    {
+        long dirStatus = ::dsOpenDirService(&mDir);
+        if (dirStatus != eDSNoErr)
+        {
+            mDir = 0L;
+            ThrowIfDSErr(dirStatus);
+        }
+    }
 }
 
 // CloseService
@@ -962,11 +962,11 @@
 //
 void CDirectoryService::CloseService()
 {
-	if (mDir != 0L)
-	{
+    if (mDir != 0L)
+    {
         ::dsCloseDirService(mDir);
-		mDir = 0L;
-	}
+        mDir = 0L;
+    }
 }
 
 // OpenNode
@@ -977,7 +977,7 @@
 //
 void CDirectoryService::OpenNode()
 {
-	mNode = OpenNamedNode(mNodeName);
+    mNode = OpenNamedNode(mNodeName);
 }
 
 // OpenNode
@@ -990,40 +990,40 @@
 //
 tDirNodeReference CDirectoryService::OpenNamedNode(const char* nodename)
 {
-	long dirStatus = eDSNoErr;
+    long dirStatus = eDSNoErr;
     tDataListPtr nodePath = NULL;
-	tDirNodeReference result = NULL;
-	
-	try
-	{
-		nodePath = ::dsDataListAllocate(mDir);
-		ThrowIfNULL(nodePath);
-		ThrowIfDSErr(::dsBuildListFromPathAlloc(mDir, nodePath, nodename, "/"));
-		dirStatus = ::dsOpenDirNode(mDir, nodePath, &result);
-		if (dirStatus == eDSNoErr)
-		{
-			// OK
-		}
-		else
-		{
-			result = NULL;
-			ThrowIfDSErr(dirStatus);
-		}
-		dirStatus = ::dsDataListDeallocate(mDir, nodePath);
-		free(nodePath);
-	}
-	catch(...)
-	{
-		if (nodePath != NULL)
-		{
-			dirStatus = ::dsDataListDeallocate(mDir, nodePath);
-			free(nodePath);
-			nodePath = NULL;
-		}
-		throw;
-	}
-	
-	return result;
+    tDirNodeReference result = NULL;
+    
+    try
+    {
+        nodePath = ::dsDataListAllocate(mDir);
+        ThrowIfNULL(nodePath);
+        ThrowIfDSErr(::dsBuildListFromPathAlloc(mDir, nodePath, nodename, "/"));
+        dirStatus = ::dsOpenDirNode(mDir, nodePath, &result);
+        if (dirStatus == eDSNoErr)
+        {
+            // OK
+        }
+        else
+        {
+            result = NULL;
+            ThrowIfDSErr(dirStatus);
+        }
+        dirStatus = ::dsDataListDeallocate(mDir, nodePath);
+        free(nodePath);
+    }
+    catch(...)
+    {
+        if (nodePath != NULL)
+        {
+            dirStatus = ::dsDataListDeallocate(mDir, nodePath);
+            free(nodePath);
+            nodePath = NULL;
+        }
+        throw;
+    }
+    
+    return result;
 }
 
 // CloseNode
@@ -1032,11 +1032,11 @@
 //
 void CDirectoryService::CloseNode()
 {
-	if (mNode != 0L)
-	{
-		::dsCloseDirNode(mNode);
-		mNode = 0L;
-	}
+    if (mNode != 0L)
+    {
+        ::dsCloseDirNode(mNode);
+        mNode = 0L;
+    }
 }
 
 // CreateBuffer
@@ -1047,15 +1047,15 @@
 //
 void CDirectoryService::CreateBuffer()
 {
-	if (mData == NULL)
-	{
-		mData = ::dsDataBufferAllocate(mDir, cBufferSize);
-		if (mData == NULL)
-		{
-			ThrowIfDSErr(eDSNullDataBuff);
-		}
-		mDataSize = cBufferSize;
-	}
+    if (mData == NULL)
+    {
+        mData = ::dsDataBufferAllocate(mDir, cBufferSize);
+        if (mData == NULL)
+        {
+            ThrowIfDSErr(eDSNullDataBuff);
+        }
+        mDataSize = cBufferSize;
+    }
 }
 
 // RemoveBuffer
@@ -1064,11 +1064,11 @@
 //
 void CDirectoryService::RemoveBuffer()
 {
-	if (mData != NULL)
-	{
-		::dsDataBufferDeAllocate(mDir, mData);
-		mData = NULL;
-	}
+    if (mData != NULL)
+    {
+        ::dsDataBufferDeAllocate(mDir, mData);
+        mData = NULL;
+    }
 }
 
 // ReallocBuffer
@@ -1077,26 +1077,26 @@
 //
 void CDirectoryService::ReallocBuffer()
 {
-	RemoveBuffer();
-	mData = ::dsDataBufferAllocate(mDir, 2 * mDataSize);
-	if (mData == NULL)
-	{
-		ThrowIfDSErr(eDSNullDataBuff);
-	}
-	mDataSize *= 2;
+    RemoveBuffer();
+    mData = ::dsDataBufferAllocate(mDir, 2 * mDataSize);
+    if (mData == NULL)
+    {
+        ThrowIfDSErr(eDSNullDataBuff);
+    }
+    mDataSize *= 2;
 }
 
 void CDirectoryService::BuildStringDataList(CFArrayRef strs, tDataListPtr data)
 {
-	CFStringUtil add_cfname((CFStringRef)::CFArrayGetValueAtIndex(strs, 0));
-	std::auto_ptr<char> add_name(add_cfname.c_str());
-	ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, data,  add_name.get(), NULL));
-	for(CFIndex i = 1; i < ::CFArrayGetCount(strs); i++)
-	{
-		add_cfname.reset((CFStringRef)::CFArrayGetValueAtIndex(strs, i));
-		add_name.reset(add_cfname.c_str());
-		ThrowIfDSErr(::dsAppendStringToListAlloc(mDir, data,  add_name.get()));
-	}
+    CFStringUtil add_cfname((CFStringRef)::CFArrayGetValueAtIndex(strs, 0));
+    std::auto_ptr<char> add_name(add_cfname.c_str());
+    ThrowIfDSErr(::dsBuildListFromStringsAlloc(mDir, data,  add_name.get(), NULL));
+    for(CFIndex i = 1; i < ::CFArrayGetCount(strs); i++)
+    {
+        add_cfname.reset((CFStringRef)::CFArrayGetValueAtIndex(strs, i));
+        add_name.reset(add_cfname.c_str());
+        ThrowIfDSErr(::dsAppendStringToListAlloc(mDir, data,  add_name.get()));
+    }
 }
 
 // CStringFromBuffer
@@ -1107,10 +1107,10 @@
 //
 char* CDirectoryService::CStringFromBuffer(tDataBufferPtr data)
 {
-	char* result = new char[data->fBufferLength + 1];
-	::strncpy(result, data->fBufferData, data->fBufferLength);
-	result[data->fBufferLength] = 0;
-	return result;
+    char* result = new char[data->fBufferLength + 1];
+    ::strncpy(result, data->fBufferData, data->fBufferLength);
+    result[data->fBufferLength] = 0;
+    return result;
 }
 
 // CStringFromData
@@ -1121,9 +1121,9 @@
 //
 char* CDirectoryService::CStringFromData(const char* data, size_t len)
 {
-	char* result = new char[len + 1];
-	::strncpy(result, data, len);
-	result[len] = 0;
-	return result;
+    char* result = new char[len + 1];
+    ::strncpy(result, data, len);
+    result[len] = 0;
+    return result;
 }
 

Modified: PyOpenDirectory/trunk/src/CDirectoryService.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.h	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryService.h	2008-04-16 20:02:06 UTC (rev 2322)
@@ -30,60 +30,60 @@
 class CDirectoryService
 {
 public:
-	CDirectoryService(const char* nodename);
-	~CDirectoryService();
-	
-	CFMutableArrayRef ListAllRecordsWithAttributes(const char* recordType, CFArrayRef attributes);
-	CFMutableArrayRef QueryRecordsWithAttribute(const char* attr, const char* value, int matchType, bool casei, const char* recordType, CFArrayRef attributes);
-	CFMutableArrayRef QueryRecordsWithAttributes(const char* query, bool casei, const char* recordType, CFArrayRef attributes);
+    CDirectoryService(const char* nodename);
+    ~CDirectoryService();
+    
+    CFMutableArrayRef ListAllRecordsWithAttributes(const char* recordType, CFArrayRef attributes);
+    CFMutableArrayRef QueryRecordsWithAttribute(const char* attr, const char* value, int matchType, bool casei, const char* recordType, CFArrayRef attributes);
+    CFMutableArrayRef QueryRecordsWithAttributes(const char* query, bool casei, const char* recordType, CFArrayRef attributes);
 
-	bool AuthenticateUserBasic(const char* nodename, const char* user, const char* pswd, bool& result);
-	bool AuthenticateUserDigest(const char* nodename, const char* user, const char* challenge, const char* response, const char* method, bool& result);
-	
+    bool AuthenticateUserBasic(const char* nodename, const char* user, const char* pswd, bool& result);
+    bool AuthenticateUserDigest(const char* nodename, const char* user, const char* challenge, const char* response, const char* method, bool& result);
+    
 private:
 
-	class StPythonThreadState
-	{
-	public:
-		StPythonThreadState()
-		{
-			mSavedState = PyEval_SaveThread();
- 		}
-		
-		~StPythonThreadState()
-		{
-			PyEval_RestoreThread(mSavedState);
-		}
-	
-	private:
-		PyThreadState* mSavedState;
-	};
+    class StPythonThreadState
+    {
+    public:
+        StPythonThreadState()
+        {
+            mSavedState = PyEval_SaveThread();
+         }
+        
+        ~StPythonThreadState()
+        {
+            PyEval_RestoreThread(mSavedState);
+        }
+    
+    private:
+        PyThreadState* mSavedState;
+    };
 
-	const char*			mNodeName;
-	tDirReference		mDir;
-	tDirNodeReference	mNode;
-	tDataBufferPtr		mData;
-	UInt32				mDataSize;
-	
-	CFMutableArrayRef _ListAllRecordsWithAttributes(const char* type, CFArrayRef names, CFArrayRef attrs);
-	CFMutableArrayRef _QueryRecordsWithAttributes(const char* attr, const char* value, int matchType, const char* compound, bool casei, const char* recordType, CFArrayRef attributes);
+    const char*           mNodeName;
+    tDirReference         mDir;
+    tDirNodeReference     mNode;
+    tDataBufferPtr        mData;
+    UInt32                mDataSize;
+    
+    CFMutableArrayRef _ListAllRecordsWithAttributes(const char* type, CFArrayRef names, CFArrayRef attrs);
+    CFMutableArrayRef _QueryRecordsWithAttributes(const char* attr, const char* value, int matchType, const char* compound, bool casei, const char* recordType, CFArrayRef attributes);
 
-	bool NativeAuthenticationBasicToNode(const char* nodename, const char* user, const char* pswd);
-	bool NativeAuthenticationDigestToNode(const char* nodename, const char* user, const char* challenge, const char* response, const char* method);
-	
-	void OpenService();
-	void CloseService();
-	
-	void OpenNode();
-	tDirNodeReference OpenNamedNode(const char* nodename);
-	void CloseNode();
-	
-	void CreateBuffer();
-	void RemoveBuffer();
-	void ReallocBuffer();
+    bool NativeAuthenticationBasicToNode(const char* nodename, const char* user, const char* pswd);
+    bool NativeAuthenticationDigestToNode(const char* nodename, const char* user, const char* challenge, const char* response, const char* method);
+    
+    void OpenService();
+    void CloseService();
+    
+    void OpenNode();
+    tDirNodeReference OpenNamedNode(const char* nodename);
+    void CloseNode();
+    
+    void CreateBuffer();
+    void RemoveBuffer();
+    void ReallocBuffer();
 
-	void BuildStringDataList(CFArrayRef strs, tDataListPtr data);
+    void BuildStringDataList(CFArrayRef strs, tDataListPtr data);
 
-	char* CStringFromBuffer(tDataBufferPtr data);
-	char* CStringFromData(const char* data, size_t len);
+    char* CStringFromBuffer(tDataBufferPtr data);
+    char* CStringFromData(const char* data, size_t len);
 };

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp	2008-04-16 20:02:06 UTC (rev 2322)
@@ -32,14 +32,14 @@
 
 CDirectoryServiceException::CDirectoryServiceException()
 {
-	mDSError = -1;
-	::snprintf(mDescription, 1024, "Unknown Error");
+    mDSError = -1;
+    ::snprintf(mDescription, 1024, "Unknown Error");
 }
 
 CDirectoryServiceException::CDirectoryServiceException(long error, const char* file, long line)
 {
-	mDSError = error;
-	::snprintf(mDescription, 1024, "Exception raised in file %s at line %ld", file, line);
+    mDSError = error;
+    ::snprintf(mDescription, 1024, "Exception raised in file %s at line %ld", file, line);
 }
 
 CDirectoryServiceException::~CDirectoryServiceException()
@@ -48,14 +48,14 @@
 
 void CDirectoryServiceException::ThrowDSError(long error, const char* file, long line)
 {
-	CDirectoryServiceException dirStatus(error, file, line);
-	throw dirStatus;
+    CDirectoryServiceException dirStatus(error, file, line);
+    throw dirStatus;
 }
 
 void CDirectoryServiceException::SetPythonException()
 {
-	char error[1024];
-	::snprintf(error, 1024, "%s %s", "DirectoryServices Error:", mDescription);
-	PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", error, mDSError));		
+    char error[1024];
+    ::snprintf(error, 1024, "%s %s", "DirectoryServices Error:", mDescription);
+    PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", error, mDSError));
 }
 

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.h	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.h	2008-04-16 20:02:06 UTC (rev 2322)
@@ -24,17 +24,17 @@
 class CDirectoryServiceException
 {
 public:
-	CDirectoryServiceException();
-	CDirectoryServiceException(long error, const char* file, long line);
-	~CDirectoryServiceException();
-	
-	static void ThrowDSError(long error, const char* file, long line);
+    CDirectoryServiceException();
+    CDirectoryServiceException(long error, const char* file, long line);
+    ~CDirectoryServiceException();
+    
+    static void ThrowDSError(long error, const char* file, long line);
 
-	void SetPythonException();
-	
+    void SetPythonException();
+    
 private:
-	long		mDSError;
-	char		mDescription[1024];
+    long        mDSError;
+    char        mDescription[1024];
 };
 
 # define ThrowIfDSErr(x) { if (x != eDSNoErr) CDirectoryServiceException::ThrowDSError(x, __FILE__, __LINE__); }

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp	2008-04-16 20:02:06 UTC (rev 2322)
@@ -28,15 +28,15 @@
 
 CDirectoryServiceManager::CDirectoryServiceManager(const char* nodename)
 {
-	mNodeName = ::strdup(nodename);
+    mNodeName = ::strdup(nodename);
 }
 
 CDirectoryServiceManager::~CDirectoryServiceManager()
 {
-	::free(mNodeName);
+    ::free(mNodeName);
 }
 
 CDirectoryService* CDirectoryServiceManager::GetService()
 {
-	return new CDirectoryService(mNodeName);
+    return new CDirectoryService(mNodeName);
 }

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceManager.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceManager.h	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceManager.h	2008-04-16 20:02:06 UTC (rev 2322)
@@ -26,14 +26,14 @@
 class CDirectoryServiceManager
 {
 public:
-	CDirectoryServiceManager(const char* nodename);
-	~CDirectoryServiceManager();
+    CDirectoryServiceManager(const char* nodename);
+    ~CDirectoryServiceManager();
 
-	void OpenService();
-	void CloseService();
+    void OpenService();
+    void CloseService();
 
-	CDirectoryService* GetService();
+    CDirectoryService* GetService();
 
 private:
-	char*			mNodeName;
+    char*            mNodeName;
 };

Modified: PyOpenDirectory/trunk/src/CFStringUtil.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CFStringUtil.cpp	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CFStringUtil.cpp	2008-04-16 20:02:06 UTC (rev 2322)
@@ -26,8 +26,8 @@
 //
 CFStringUtil::CFStringUtil(const char* cstr)
 {
-	mRef = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingUTF8);
-	mTemp = NULL;
+    mRef = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingUTF8);
+    mTemp = NULL;
 }
 
 // Construct with existing CFStringRef.
@@ -36,34 +36,34 @@
 //
 CFStringUtil::CFStringUtil(CFStringRef ref)
 {
-	mRef = ref;
-	if (mRef != NULL)
-		::CFRetain(mRef);
-	mTemp = NULL;
+    mRef = ref;
+    if (mRef != NULL)
+        ::CFRetain(mRef);
+    mTemp = NULL;
 }
 
 CFStringUtil::~CFStringUtil()
 {
-	if (mRef != NULL)
-	{
-		::CFRelease(mRef);
-		mRef = NULL;
-	}
-	if (mTemp != NULL)
-	{
-		::free((void*)mTemp);
-		mTemp = NULL;
-	}
+    if (mRef != NULL)
+    {
+        ::CFRelease(mRef);
+        mRef = NULL;
+    }
+    if (mTemp != NULL)
+    {
+        ::free((void*)mTemp);
+        mTemp = NULL;
+    }
 }
 
 CFStringUtil& CFStringUtil::operator=(const CFStringUtil& copy)
 {
-	mRef = copy.get();
-	if (mRef != NULL)
-		::CFRetain(mRef);
-	mTemp = NULL;
-	
-	return *this;
+    mRef = copy.get();
+    if (mRef != NULL)
+        ::CFRetain(mRef);
+    mTemp = NULL;
+    
+    return *this;
 }
 
 
@@ -73,48 +73,48 @@
 //
 char* CFStringUtil::c_str() const
 {
-	const char* bytes = (mRef != NULL) ? CFStringGetCStringPtr(mRef, kCFStringEncodingUTF8) : "";
-	
-	if (bytes == NULL)
-	{
-		// Need to convert the CFString to UTF-8. Since we don't know the exact length of the UTF-8 data
-		// we have to iterate over the conversion process until we succeed or the length we are allocating
-		// is greater than the value it could maximally be. We start with half the UTF-16 encoded value,
-		// which will give an accurate count for an ascii only string (plus add one for \0).
-		CFIndex len = ::CFStringGetLength(mRef)/2 + 1;
-		CFIndex maxSize = ::CFStringGetMaximumSizeForEncoding(::CFStringGetLength(mRef), kCFStringEncodingUTF8) + 1;
-		char* buffer = NULL;
-		while(true)
-		{
-			buffer = (char*)::malloc(len);
-			if (buffer == NULL)
-				break;
-			buffer[0] = 0;
-			Boolean success = ::CFStringGetCString(mRef, buffer, len, kCFStringEncodingUTF8);
-			if (!success)
-			{
-				::free(buffer);
-				buffer = NULL;
-				if (len == maxSize)
-				{
-					buffer = (char*)::malloc(1);
-					buffer[0] = 0;
-					break;
-				}
-				len *= 2;
-				if (len > maxSize)
-					len = maxSize;
-			}
-			else
-				break;
-		}
-		
-		return buffer;
-	}
-	else
-	{
-		return ::strdup(bytes);
-	}
+    const char* bytes = (mRef != NULL) ? CFStringGetCStringPtr(mRef, kCFStringEncodingUTF8) : "";
+    
+    if (bytes == NULL)
+    {
+        // Need to convert the CFString to UTF-8. Since we don't know the exact length of the UTF-8 data
+        // we have to iterate over the conversion process until we succeed or the length we are allocating
+        // is greater than the value it could maximally be. We start with half the UTF-16 encoded value,
+        // which will give an accurate count for an ascii only string (plus add one for \0).
+        CFIndex len = ::CFStringGetLength(mRef)/2 + 1;
+        CFIndex maxSize = ::CFStringGetMaximumSizeForEncoding(::CFStringGetLength(mRef), kCFStringEncodingUTF8) + 1;
+        char* buffer = NULL;
+        while(true)
+        {
+            buffer = (char*)::malloc(len);
+            if (buffer == NULL)
+                break;
+            buffer[0] = 0;
+            Boolean success = ::CFStringGetCString(mRef, buffer, len, kCFStringEncodingUTF8);
+            if (!success)
+            {
+                ::free(buffer);
+                buffer = NULL;
+                if (len == maxSize)
+                {
+                    buffer = (char*)::malloc(1);
+                    buffer[0] = 0;
+                    break;
+                }
+                len *= 2;
+                if (len > maxSize)
+                    len = maxSize;
+            }
+            else
+                break;
+        }
+        
+        return buffer;
+    }
+    else
+    {
+        return ::strdup(bytes);
+    }
 }
 
 // Return a temporary c-string from the CFString data.
@@ -123,13 +123,13 @@
 //
 const char* CFStringUtil::temp_str() const
 {
-	if (mTemp != NULL)
-	{
-		::free((void*)mTemp);
-		mTemp = NULL;
-	}
-	mTemp = c_str();
-	return mTemp;
+    if (mTemp != NULL)
+    {
+        ::free((void*)mTemp);
+        mTemp = NULL;
+    }
+    mTemp = c_str();
+    return mTemp;
 }
 
 // Reset with existing CFStringRef. Any existing CFStringRef is released before the new one is used.
@@ -138,12 +138,12 @@
 //
 void CFStringUtil::reset(CFStringRef ref)
 {
-	if (mRef != NULL)
-	{
-		::CFRelease(mRef);
-		mRef = NULL;
-	}
-	mRef = ref;
-	if (mRef != NULL)
-		::CFRetain(mRef);
-}	
+    if (mRef != NULL)
+    {
+        ::CFRelease(mRef);
+        mRef = NULL;
+    }
+    mRef = ref;
+    if (mRef != NULL)
+        ::CFRetain(mRef);
+}

Modified: PyOpenDirectory/trunk/src/CFStringUtil.h
===================================================================
--- PyOpenDirectory/trunk/src/CFStringUtil.h	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/CFStringUtil.h	2008-04-16 20:02:06 UTC (rev 2322)
@@ -25,23 +25,23 @@
 class CFStringUtil
 {
 public:
-	CFStringUtil(const char* cstr);
-	CFStringUtil(CFStringRef ref);
-	~CFStringUtil();
-	
-	CFStringUtil& operator=(const CFStringUtil& copy);
+    CFStringUtil(const char* cstr);
+    CFStringUtil(CFStringRef ref);
+    ~CFStringUtil();
+    
+    CFStringUtil& operator=(const CFStringUtil& copy);
 
-	CFStringRef get() const
-	{
-		return mRef;
-	}
+    CFStringRef get() const
+    {
+        return mRef;
+    }
 
-	char* c_str() const;
-	const char* temp_str() const;
+    char* c_str() const;
+    const char* temp_str() const;
 
-	void reset(CFStringRef ref);
+    void reset(CFStringRef ref);
 
 private:
-	CFStringRef mRef;
-	mutable const char* mTemp;
+    CFStringRef mRef;
+    mutable const char* mTemp;
 };

Modified: PyOpenDirectory/trunk/src/PythonWrapper.cpp
===================================================================
--- PyOpenDirectory/trunk/src/PythonWrapper.cpp	2008-04-16 19:53:28 UTC (rev 2321)
+++ PyOpenDirectory/trunk/src/PythonWrapper.cpp	2008-04-16 20:02:06 UTC (rev 2322)
@@ -38,185 +38,185 @@
 // Utility function - not exposed to Python
 static PyObject* CFStringToPyStr(CFStringRef str)
 {
-	CFStringUtil s(str);
-	return PyString_FromString(s.temp_str());
+    CFStringUtil s(str);
+    return PyString_FromString(s.temp_str());
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFArrayToPyList(CFArrayRef list, bool sorted = false)
 {
-	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
-	if (sorted and (list != NULL))
-		CFArraySortValues((CFMutableArrayRef)list, CFRangeMake(0, lsize), (CFComparatorFunction)CFStringCompare, NULL);
-	
-	PyObject* result = PyList_New(lsize);
-	for(CFIndex i = 0; i < lsize; i++)
-	{
-		CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, i);
-		PyObject* pystr = CFStringToPyStr(str);
-		
-		PyList_SetItem(result, i, pystr);
-	}
-	
-	return result;
+    CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+    if (sorted and (list != NULL))
+        CFArraySortValues((CFMutableArrayRef)list, CFRangeMake(0, lsize), (CFComparatorFunction)CFStringCompare, NULL);
+    
+    PyObject* result = PyList_New(lsize);
+    for(CFIndex i = 0; i < lsize; i++)
+    {
+        CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, i);
+        PyObject* pystr = CFStringToPyStr(str);
+        
+        PyList_SetItem(result, i, pystr);
+    }
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static CFArrayRef PyListToCFArray(PyObject* list)
 {
-	CFMutableArrayRef result = CFArrayCreateMutable(kCFAllocatorDefault, PyList_Size(list), &kCFTypeArrayCallBacks);
-	for(int i = 0; i < PyList_Size(list); i++)
-	{
-		PyObject* str = PyList_GetItem(list, i);
-		if ((str == NULL) || !PyString_Check(str))
-		{
-			CFRelease(result);
-			return NULL;
-		}
-		const char* cstr = PyString_AsString(str);
-		if (cstr == NULL)
-		{
-			CFRelease(result);
-			return NULL;
-		}
-		CFStringUtil cfstr(cstr);
-		CFArrayAppendValue(result, cfstr.get());
-	}
-	
-	return result;
+    CFMutableArrayRef result = CFArrayCreateMutable(kCFAllocatorDefault, PyList_Size(list), &kCFTypeArrayCallBacks);
+    for(int i = 0; i < PyList_Size(list); i++)
+    {
+        PyObject* str = PyList_GetItem(list, i);
+        if ((str == NULL) || !PyString_Check(str))
+        {
+            CFRelease(result);
+            return NULL;
+        }
+        const char* cstr = PyString_AsString(str);
+        if (cstr == NULL)
+        {
+            CFRelease(result);
+            return NULL;
+        }
+        CFStringUtil cfstr(cstr);
+        CFArrayAppendValue(result, cfstr.get());
+    }
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static void CFDictionaryIterator(const void* key, const void* value, void* ref)
 {
-	CFStringRef strkey = (CFStringRef)key;
-	PyObject* dict = (PyObject*)ref;
-	
-	PyObject* pystrkey = CFStringToPyStr(strkey);
+    CFStringRef strkey = (CFStringRef)key;
+    PyObject* dict = (PyObject*)ref;
+    
+    PyObject* pystrkey = CFStringToPyStr(strkey);
 
-	// The dictionary value may be a string or a list
-	if (CFGetTypeID((CFTypeRef)value) == CFStringGetTypeID())
-	{
-		CFStringRef strvalue = (CFStringRef)value;
-		PyObject* pystrvalue = CFStringToPyStr(strvalue);
-		PyDict_SetItem(dict, pystrkey, pystrvalue);
-		Py_DECREF(pystrvalue);
-	}
-	else if(CFGetTypeID((CFTypeRef)value) == CFArrayGetTypeID())
-	{
-		CFArrayRef arrayvalue = (CFArrayRef)value;
-		PyObject* pylistvalue = CFArrayToPyList(arrayvalue);
-		PyDict_SetItem(dict, pystrkey, pylistvalue);
-		Py_DECREF(pylistvalue);
-	}
-	Py_DECREF(pystrkey);
+    // The dictionary value may be a string or a list
+    if (CFGetTypeID((CFTypeRef)value) == CFStringGetTypeID())
+    {
+        CFStringRef strvalue = (CFStringRef)value;
+        PyObject* pystrvalue = CFStringToPyStr(strvalue);
+        PyDict_SetItem(dict, pystrkey, pystrvalue);
+        Py_DECREF(pystrvalue);
+    }
+    else if(CFGetTypeID((CFTypeRef)value) == CFArrayGetTypeID())
+    {
+        CFArrayRef arrayvalue = (CFArrayRef)value;
+        PyObject* pylistvalue = CFArrayToPyList(arrayvalue);
+        PyDict_SetItem(dict, pystrkey, pylistvalue);
+        Py_DECREF(pylistvalue);
+    }
+    Py_DECREF(pystrkey);
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFDictionaryToPyDict(CFDictionaryRef dict)
 {
-	PyObject* result = PyDict_New();
-	if (dict != NULL)
-		CFDictionaryApplyFunction(dict, CFDictionaryIterator, result);
-	
-	return result;
+    PyObject* result = PyDict_New();
+    if (dict != NULL)
+        CFDictionaryApplyFunction(dict, CFDictionaryIterator, result);
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static void CFDictionaryDictionaryIterator(const void* key, const void* value, void* ref)
 {
-	CFStringRef strkey = (CFStringRef)key;
-	CFDictionaryRef dictvalue = (CFDictionaryRef)value;
-	PyObject* dict = (PyObject*)ref;
-	
-	PyObject* pystrkey = CFStringToPyStr(strkey);
-	PyObject* pydictvalue = CFDictionaryToPyDict(dictvalue);
-	
-	PyDict_SetItem(dict, pystrkey, pydictvalue);
-	Py_DECREF(pystrkey);
-	Py_DECREF(pydictvalue);
+    CFStringRef strkey = (CFStringRef)key;
+    CFDictionaryRef dictvalue = (CFDictionaryRef)value;
+    PyObject* dict = (PyObject*)ref;
+    
+    PyObject* pystrkey = CFStringToPyStr(strkey);
+    PyObject* pydictvalue = CFDictionaryToPyDict(dictvalue);
+    
+    PyDict_SetItem(dict, pystrkey, pydictvalue);
+    Py_DECREF(pystrkey);
+    Py_DECREF(pydictvalue);
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFDictionaryDictionaryToPyDict(CFDictionaryRef dict)
 {
-	PyObject* result = PyDict_New();
-	if (dict != NULL)
-		CFDictionaryApplyFunction(dict, CFDictionaryDictionaryIterator, result);
-	
-	return result;
+    PyObject* result = PyDict_New();
+    if (dict != NULL)
+        CFDictionaryApplyFunction(dict, CFDictionaryDictionaryIterator, result);
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFArrayStringDictionaryToPyList(CFArrayRef list)
 {
-	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
-	if (lsize != 2)
-		return NULL;
-	
-	PyObject* result = PyList_New(lsize);
+    CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+    if (lsize != 2)
+        return NULL;
+    
+    PyObject* result = PyList_New(lsize);
 
-	CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, 0);
-	PyObject* pystr = CFStringToPyStr(str);
-	PyList_SetItem(result, 0, pystr);
-	
-	CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(list, 1);
-	PyObject* pydict = CFDictionaryToPyDict(dict);
-	PyList_SetItem(result, 1, pydict);
-	
-	return result;
+    CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, 0);
+    PyObject* pystr = CFStringToPyStr(str);
+    PyList_SetItem(result, 0, pystr);
+    
+    CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(list, 1);
+    PyObject* pydict = CFDictionaryToPyDict(dict);
+    PyList_SetItem(result, 1, pydict);
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFArrayArrayDictionaryToPyList(CFArrayRef list)
 {
-	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
-	
-	PyObject* result = PyList_New(lsize);
-	for(CFIndex i = 0, j = 0; i < lsize; i++)
-	{
-		CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
-		PyObject* pylist = CFArrayStringDictionaryToPyList(nested);
-		if (pylist != NULL)
-		{
-			PyList_SetItem(result, j++, pylist);
-		}
-	}
-	
-	return result;
+    CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+    
+    PyObject* result = PyList_New(lsize);
+    for(CFIndex i = 0, j = 0; i < lsize; i++)
+    {
+        CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
+        PyObject* pylist = CFArrayStringDictionaryToPyList(nested);
+        if (pylist != NULL)
+        {
+            PyList_SetItem(result, j++, pylist);
+        }
+    }
+    
+    return result;
 }
 
 // Utility function - not exposed to Python
 static void CFArrayStringDictionaryToPyDict(CFArrayRef list, PyObject* result)
 {
-	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
-	if (lsize != 2)
-		return;
-	
-	CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, 0);
-	PyObject* pystrkey = CFStringToPyStr(str);
-	
-	CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(list, 1);
-	PyObject* pydictvalue = CFDictionaryToPyDict(dict);
-	
-	PyDict_SetItem(result, pystrkey, pydictvalue);
-	Py_DECREF(pystrkey);
-	Py_DECREF(pydictvalue);
+    CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+    if (lsize != 2)
+        return;
+    
+    CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, 0);
+    PyObject* pystrkey = CFStringToPyStr(str);
+    
+    CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(list, 1);
+    PyObject* pydictvalue = CFDictionaryToPyDict(dict);
+    
+    PyDict_SetItem(result, pystrkey, pydictvalue);
+    Py_DECREF(pystrkey);
+    Py_DECREF(pydictvalue);
 }
 
 // Utility function - not exposed to Python
 static PyObject* CFArrayArrayDictionaryToPyDict(CFArrayRef list)
 {
-	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
-	
-	PyObject* result = PyDict_New();
-	for(CFIndex i = 0; i < lsize; i++)
-	{
-		CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
-		CFArrayStringDictionaryToPyDict(nested, result);
-	}
-	
-	return result;
+    CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+    
+    PyObject* result = PyDict_New();
+    for(CFIndex i = 0; i < lsize; i++)
+    {
+        CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
+        CFArrayStringDictionaryToPyDict(nested, result);
+    }
+    
+    return result;
 }
 
 PyObject* ODException_class = NULL;
@@ -227,37 +227,37 @@
  */
 extern "C" void odDestroy(void* obj)
 {
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(obj);
-	delete dsmgr;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(obj);
+    delete dsmgr;
 }
 
 /*
  def odInit(nodename):
-	"""
-	Create an Open Directory object to operate on the specified directory service node name.
+    """
+    Create an Open Directory object to operate on the specified directory service node name.
  
-	@param nodename: C{str} containing the node name.
-	@return: C{object} an object to be passed to all subsequent functions on success,
-		C{None} on failure.
-	"""
+    @param nodename: C{str} containing the node name.
+    @return: C{object} an object to be passed to all subsequent functions on success,
+        C{None} on failure.
+    """
  */
 extern "C" PyObject* odInit(PyObject* self, PyObject* args)
 {
     const char* nodename;
     if (!PyArg_ParseTuple(args, "s", &nodename))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices odInit: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices odInit: could not parse arguments", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = new CDirectoryServiceManager(nodename);
-	if (dsmgr != NULL)
-	{
-		return PyCObject_FromVoidPtr(dsmgr, odDestroy);
-	}
-	
-	PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices odInit: could not initialize directory service", 0));		
-	return NULL;
+    CDirectoryServiceManager* dsmgr = new CDirectoryServiceManager(nodename);
+    if (dsmgr != NULL)
+    {
+        return PyCObject_FromVoidPtr(dsmgr, odDestroy);
+    }
+    
+    PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices odInit: could not initialize directory service", 0));        
+    return NULL;
 }
 
 /*
@@ -268,48 +268,48 @@
     @param obj: C{object} the object obtained from an odInit call.
     @param recordType: C{str} containing the OD record type to lookup.
     @param attributes: C{list} containing the attributes to return for each record.
-	@return: C{dict} containing a C{dict} of attributes for each record found,  
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
         or C{None} otherwise.
  */
 extern "C" PyObject *listAllRecordsWithAttributes(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OsO", &pyds, &recordType, &attributes) || !PyCObject_Check(pyds) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
-	
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->ListAllRecordsWithAttributes(recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->ListAllRecordsWithAttributes(recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
@@ -324,57 +324,57 @@
     @param casei: C{True} to do case-insenstive match, C{False} otherwise.
     @param recordType: C{str} containing the OD record type to lookup.
     @param attributes: C{list} containing the attributes to return for each record.
-	@return: C{dict} containing a C{dict} of attributes for each record found,  
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
         or C{None} otherwise.
     """
  */
 extern "C" PyObject *queryRecordsWithAttribute(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* attr;
-	const char* value;
-	int matchType;
-	PyObject* caseio;
-	bool casei;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* attr;
+    const char* value;
+    int matchType;
+    PyObject* caseio;
+    bool casei;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OssiOsO", &pyds, &attr, &value, &matchType, &caseio, &recordType, &attributes) ||
-    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+        !PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
 
-	casei = (caseio == Py_True);
+    casei = (caseio == Py_True);
 
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->QueryRecordsWithAttribute(attr, value, matchType, casei, recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->QueryRecordsWithAttribute(attr, value, matchType, casei, recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
@@ -387,55 +387,55 @@
     @param casei: C{True} to do case-insenstive match, C{False} otherwise.
     @param recordType: C{str} containing the OD record type to lookup.
     @param attributes: C{list} containing the attributes to return for each record.
-	@return: C{dict} containing a C{dict} of attributes for each record found,  
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
         or C{None} otherwise.
     """
  */
 extern "C" PyObject *queryRecordsWithAttributes(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* query;
-	PyObject* caseio;
-	bool casei;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* query;
+    PyObject* caseio;
+    bool casei;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OsOsO", &pyds, &query, &caseio, &recordType, &attributes) ||
-    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+        !PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
 
-	casei = (caseio == Py_True);
+    casei = (caseio == Py_True);
 
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->QueryRecordsWithAttributes(query, casei, recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->QueryRecordsWithAttributes(query, casei, recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
@@ -452,43 +452,43 @@
  */
 extern "C" PyObject *listAllRecordsWithAttributes_list(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OsO", &pyds, &recordType, &attributes) || !PyCObject_Check(pyds) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
-	
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->ListAllRecordsWithAttributes(recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyList(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->ListAllRecordsWithAttributes(recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyList(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
@@ -509,51 +509,51 @@
  */
 extern "C" PyObject *queryRecordsWithAttribute_list(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* attr;
-	const char* value;
-	int matchType;
-	PyObject* caseio;
-	bool casei;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* attr;
+    const char* value;
+    int matchType;
+    PyObject* caseio;
+    bool casei;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OssiOsO", &pyds, &attr, &value, &matchType, &caseio, &recordType, &attributes) ||
-    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+        !PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
 
-	casei = (caseio == Py_True);
+    casei = (caseio == Py_True);
 
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->QueryRecordsWithAttribute(attr, value, matchType, casei, recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyList(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->QueryRecordsWithAttribute(attr, value, matchType, casei, recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyList(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
@@ -572,94 +572,94 @@
  */
 extern "C" PyObject *queryRecordsWithAttributes_list(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* query;
-	PyObject* caseio;
-	bool casei;
-	const char* recordType;
-	PyObject* attributes;
+    PyObject* pyds;
+    const char* query;
+    PyObject* caseio;
+    bool casei;
+    const char* recordType;
+    PyObject* attributes;
     if (!PyArg_ParseTuple(args, "OsOsO", &pyds, &query, &caseio, &recordType, &attributes) ||
-    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+        !PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));        
         return NULL;
     }
 
-	casei = (caseio == Py_True);
+    casei = (caseio == Py_True);
 
-	// Convert list to CFArray of CFString
-	CFArrayRef cfattributes = PyListToCFArray(attributes);
-	if (cfattributes == NULL)
+    // Convert list to CFArray of CFString
+    CFArrayRef cfattributes = PyListToCFArray(attributes);
+    if (cfattributes == NULL)
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));        
         return NULL;
     }
 
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		CFMutableArrayRef list = NULL;
-		list = ds->QueryRecordsWithAttributes(query, casei, recordType, cfattributes);
-		if (list != NULL)
-		{
-			PyObject* result = CFArrayArrayDictionaryToPyList(list);
-			CFRelease(list);
-			CFRelease(cfattributes);
-			
-			return result;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
-	
-	CFRelease(cfattributes);
-	return NULL;
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        CFMutableArrayRef list = NULL;
+        list = ds->QueryRecordsWithAttributes(query, casei, recordType, cfattributes);
+        if (list != NULL)
+        {
+            PyObject* result = CFArrayArrayDictionaryToPyList(list);
+            CFRelease(list);
+            CFRelease(cfattributes);
+            
+            return result;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));        
+    
+    CFRelease(cfattributes);
+    return NULL;
 }
 
 /*
 def authenticateUserBasic(obj, nodename, user, pswd):
-	"""
-	Authenticate a user with a password to Open Directory.
-	
-	@param obj: C{object} the object obtained from an odInit call.
+    """
+    Authenticate a user with a password to Open Directory.
+    
+    @param obj: C{object} the object obtained from an odInit call.
     @param nodename: C{str} the directory nodename for the record to check.
     @param user: C{str} the user identifier/directory record name to check.
-	@param pswd: C{str} containing the password to check.
-	@return: C{True} if the user was found, C{False} otherwise.
-	"""
+    @param pswd: C{str} containing the password to check.
+    @return: C{True} if the user was found, C{False} otherwise.
+    """
  */
 extern "C" PyObject *authenticateUserBasic(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* nodename;
-	const char* user;
-	const char* pswd;
+    PyObject* pyds;
+    const char* nodename;
+    const char* user;
+    const char* pswd;
     if (!PyArg_ParseTuple(args, "Osss", &pyds, &nodename, &user, &pswd) || !PyCObject_Check(pyds))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserBasic: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserBasic: could not parse arguments", 0));        
         return NULL;
     }
-	
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		bool result = false;
-		bool authresult = false;
-		result = ds->AuthenticateUserBasic(nodename, user, pswd, authresult);
-		if (result)
-		{
-			if (authresult)
-				Py_RETURN_TRUE;
-			else
-				Py_RETURN_FALSE;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserBasic: invalid directory service argument", 0));		
-	
-	return NULL;
+    
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        bool result = false;
+        bool authresult = false;
+        result = ds->AuthenticateUserBasic(nodename, user, pswd, authresult);
+        if (result)
+        {
+            if (authresult)
+                Py_RETURN_TRUE;
+            else
+                Py_RETURN_FALSE;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserBasic: invalid directory service argument", 0));        
+    
+    return NULL;
 }
 
 /*
@@ -669,7 +669,7 @@
     
     @param obj: C{object} the object obtained from an odInit call.
     @param nodename: C{str} the directory nodename for the record to check.
-	@param user: C{str} the user identifier/directory record name to check.
+    @param user: C{str} the user identifier/directory record name to check.
     @param challenge: C{str} the HTTP challenge sent to the client.
     @param response: C{str} the HTTP response sent from the client.
     @param method: C{str} the HTTP method being used.
@@ -678,58 +678,58 @@
  */
 extern "C" PyObject *authenticateUserDigest(PyObject *self, PyObject *args)
 {
-	PyObject* pyds;
-	const char* nodename;
-	const char* user;
-	const char* challenge;
-	const char* response;
-	const char* method;
+    PyObject* pyds;
+    const char* nodename;
+    const char* user;
+    const char* challenge;
+    const char* response;
+    const char* method;
     if (!PyArg_ParseTuple(args, "Osssss", &pyds, &nodename, &user, &challenge, &response, &method) || !PyCObject_Check(pyds))
     {
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserDigest: could not parse arguments", 0));		
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserDigest: could not parse arguments", 0));        
         return NULL;
     }
-	
-	CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
-	if (dsmgr != NULL)
-	{
-		std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
-		bool result = false;
-		bool authresult = false;
-		result = ds->AuthenticateUserDigest(nodename, user, challenge, response, method, authresult);
-		if (result)
-		{
-			if (authresult)
-				Py_RETURN_TRUE;
-			else
-				Py_RETURN_FALSE;
-		}
-	}
-	else
-		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserDigest: invalid directory service argument", 0));		
-	
-	return NULL;
+    
+    CDirectoryServiceManager* dsmgr = static_cast<CDirectoryServiceManager*>(PyCObject_AsVoidPtr(pyds));
+    if (dsmgr != NULL)
+    {
+        std::auto_ptr<CDirectoryService> ds(dsmgr->GetService());
+        bool result = false;
+        bool authresult = false;
+        result = ds->AuthenticateUserDigest(nodename, user, challenge, response, method, authresult);
+        if (result)
+        {
+            if (authresult)
+                Py_RETURN_TRUE;
+            else
+                Py_RETURN_FALSE;
+        }
+    }
+    else
+        PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices authenticateUserDigest: invalid directory service argument", 0));        
+    
+    return NULL;
 }
 
 static PyMethodDef ODMethods[] = {
     {"odInit",  odInit, METH_VARARGS,
-		"Initialize the Open Directory system."},
+        "Initialize the Open Directory system."},
     {"listAllRecordsWithAttributes",  listAllRecordsWithAttributes, METH_VARARGS,
-		"List all records of the specified type in Open Directory, returning requested attributes."},
+        "List all records of the specified type in Open Directory, returning requested attributes."},
     {"queryRecordsWithAttribute",  queryRecordsWithAttribute, METH_VARARGS,
-		"List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
+        "List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
     {"queryRecordsWithAttributes",  queryRecordsWithAttributes, METH_VARARGS,
-		"List records in Open Directory matching specified criteria, and return key attributes for each one."},
+        "List records in Open Directory matching specified criteria, and return key attributes for each one."},
     {"listAllRecordsWithAttributes_list",  listAllRecordsWithAttributes_list, METH_VARARGS,
-		"List all records of the specified type in Open Directory, returning requested attributes."},
+        "List all records of the specified type in Open Directory, returning requested attributes."},
     {"queryRecordsWithAttribute_list",  queryRecordsWithAttribute_list, METH_VARARGS,
-		"List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
+        "List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
     {"queryRecordsWithAttributes_list",  queryRecordsWithAttributes_list, METH_VARARGS,
-		"List records in Open Directory matching specified criteria, and return key attributes for each one."},
+        "List records in Open Directory matching specified criteria, and return key attributes for each one."},
     {"authenticateUserBasic",  authenticateUserBasic, METH_VARARGS,
-		"Authenticate a user with a password to Open Directory using plain text authentication."},
+        "Authenticate a user with a password to Open Directory using plain text authentication."},
     {"authenticateUserDigest",  authenticateUserDigest, METH_VARARGS,
-		"Authenticate a user with a password to Open Directory using HTTP DIGEST authentication."},
+        "Authenticate a user with a password to Open Directory using HTTP DIGEST authentication."},
     {NULL, NULL, 0, NULL}        /* Sentinel */
 };
 
@@ -747,5 +747,5 @@
 
 error:
     if (PyErr_Occurred())
-		PyErr_SetString(PyExc_ImportError, "opendirectory: init failed");
+        PyErr_SetString(PyExc_ImportError, "opendirectory: init failed");
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080416/2eb09322/attachment-0001.html


More information about the calendarserver-changes mailing list