[CalendarServer-changes] [3107] PyOpenDirectory/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sat Oct 4 15:45:23 PDT 2008


Revision: 3107
          http://trac.macosforge.org/projects/calendarserver/changeset/3107
Author:   cdaboo at apple.com
Date:     2008-10-04 15:45:22 -0700 (Sat, 04 Oct 2008)
Log Message:
-----------
Copyright notice updates.

Modified Paths:
--------------
    PyOpenDirectory/trunk/pysrc/dsattributes.py
    PyOpenDirectory/trunk/pysrc/opendirectory.py
    PyOpenDirectory/trunk/setup.py
    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
    PyOpenDirectory/trunk/src/base64.cpp
    PyOpenDirectory/trunk/src/base64.h
    PyOpenDirectory/trunk/support/test.cpp
    PyOpenDirectory/trunk/test.py
    PyOpenDirectory/trunk/test_auth.py

Modified: PyOpenDirectory/trunk/pysrc/dsattributes.py
===================================================================
--- PyOpenDirectory/trunk/pysrc/dsattributes.py	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/pysrc/dsattributes.py	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
 """

Modified: PyOpenDirectory/trunk/pysrc/opendirectory.py
===================================================================
--- PyOpenDirectory/trunk/pysrc/opendirectory.py	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/pysrc/opendirectory.py	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
 """

Modified: PyOpenDirectory/trunk/setup.py
===================================================================
--- PyOpenDirectory/trunk/setup.py	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/setup.py	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
 from distutils.core import setup, Extension

Modified: PyOpenDirectory/trunk/src/CDirectoryService.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryService.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include "CDirectoryService.h"
@@ -62,25 +60,25 @@
         ::dsDataBufferDeAllocate(mDir, mData);
         mData = 0L;
     }
-    
+
     if (mNode != 0L)
     {
         ::dsCloseDirNode(mNode);
         mNode = 0L;
     }
-    
+
     if (mDir != 0L)
     {
         ::dsCloseDirService(mDir);
         mDir = 0L;
     }
-    
+
     delete mNodeName;
     mNodeName = NULL;
 }
 
 // ListAllRecordsWithAttributes
-// 
+//
 // Get specific attributes for one or more user records in the directory.
 //
 // @param recordType: the record type to list.
@@ -113,7 +111,7 @@
 }
 
 // QueryRecordsWithAttribute
-// 
+//
 // Get specific attributes for one or more user records with matching attribute/value in the directory.
 //
 // @param attr: the attribute to query.
@@ -138,7 +136,7 @@
     }
     catch(CDirectoryServiceException& dserror)
     {
-        dserror.SetPythonException();        
+        dserror.SetPythonException();
         return NULL;
     }
     catch(...)
@@ -150,7 +148,7 @@
 }
 
 // QueryRecordsWithAttributes
-// 
+//
 // Get specific attributes for one or more user records with matching attributes in the directory.
 //
 // @param query: the compund query string to use.
@@ -185,7 +183,7 @@
 }
 
 // AuthenticateUserBasic
-// 
+//
 // Authenticate a user to the directory using plain text credentials.
 //
 // @param nodename: the directory nodename for the user record.
@@ -216,7 +214,7 @@
 }
 
 // AuthenticateUserDigest
-// 
+//
 // Authenticate a user to the directory using HTTP DIGEST credentials.
 //
 // @param nodename: the directory nodename for the user record.
@@ -235,7 +233,7 @@
     }
     catch(CDirectoryServiceException& dserror)
     {
-        dserror.SetPythonException();    
+        dserror.SetPythonException();
         return false;
     }
     catch(...)
@@ -249,7 +247,7 @@
 #pragma mark -----Private API
 
 // _ListAllRecordsWithAttributes
-// 
+//
 // Get specific attributes for records of a specified type in the directory.
 //
 // @param type: the record type to check.
@@ -272,7 +270,7 @@
     tContextData context = NULL;
     tAttributeListRef attrListRef = 0L;
     tRecordEntry* pRecEntry = NULL;
-    
+
     // Must have attributes
     if (::CFDictionaryGetCount(attributes) == 0)
         return NULL;
@@ -281,13 +279,13 @@
     {
         // 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);
@@ -305,9 +303,9 @@
         attrTypes = ::dsDataListAllocate(mDir);
         ThrowIfNULL(attrTypes);
         BuildStringDataListFromKeys(attributes, attrTypes);
-        
+
         result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
-        
+
         do
         {
             // List all the appropriate records
@@ -324,35 +322,35 @@
             {
                 // 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());
-                        
+
 						// Determine whether string/base64 encoding is needed
 						bool base64 = false;
 						CFStringRef encoding = (CFStringRef)::CFDictionaryGetValue(attributes, cfattrname.get());
 						if (encoding && (::CFStringCompare(encoding, CFSTR("base64"), 0) == kCFCompareEqualTo))
 							base64 = true;
-						
+
                         if (attributeInfoPtr->fAttributeValueCount > 1)
                         {
                             values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
@@ -395,16 +393,16 @@
                             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);
@@ -415,7 +413,7 @@
                 ::CFArrayAppendValue(result, record_tuple);
                 ::CFRelease(record_tuple);
                 record_tuple = NULL;
-                
+
                 // Clean-up
                 ::dsCloseAttributeList(attrListRef);
                 attrListRef = 0L;
@@ -423,7 +421,7 @@
                 pRecEntry = NULL;
             }
         } while (context != NULL); // Loop until all data has been obtained.
-        
+
         // Cleanup
         ::dsDataListDeallocate(mDir, recNames);
         ::dsDataListDeallocate(mDir, recTypes);
@@ -465,7 +463,7 @@
         RemoveBuffer();
         CloseNode();
         CloseService();
-        
+
         if (values != NULL)
         {
             ::CFRelease(values);
@@ -488,12 +486,12 @@
         }
         throw;
     }
-    
+
     return result;
 }
 
 // _QueryRecordsWithAttributes
-// 
+//
 // Get specific attributes for records of a specified type in the directory.
 //
 // @param attr: the attribute to query (NULL if compound is being used).
@@ -521,7 +519,7 @@
     tContextData context = NULL;
     tAttributeListRef attrListRef = 0L;
     tRecordEntry* pRecEntry = NULL;
-    
+
     // Must have attributes
     if (::CFDictionaryGetCount(attributes) == 0)
         return NULL;
@@ -530,13 +528,13 @@
     {
         // 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
@@ -561,7 +559,7 @@
 
             matchType = (casei) ? eDSiCompoundExpression : eDSCompoundExpression;
         }
-    
+
         // Build data list of types
         recTypes = ::dsDataListAllocate(mDir);
         ThrowIfNULL(recTypes);
@@ -571,9 +569,9 @@
         attrTypes = ::dsDataListAllocate(mDir);
         ThrowIfNULL(attrTypes);
         BuildStringDataListFromKeys(attributes, attrTypes);
-        
+
         result = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
-        
+
         do
         {
             // List all the appropriate records
@@ -590,35 +588,35 @@
             {
                 // 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());
-                        
+
 						// Determine whether string/base64 encoding is needed
 						bool base64 = false;
 						CFStringRef encoding = (CFStringRef)::CFDictionaryGetValue(attributes, cfattrname.get());
 						if (encoding && (::CFStringCompare(encoding, CFSTR("base64"), 0) == kCFCompareEqualTo))
 							base64 = true;
-						
+
                         if (attributeInfoPtr->fAttributeValueCount > 1)
                         {
                             values = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
@@ -660,16 +658,16 @@
                             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);
@@ -688,7 +686,7 @@
                 pRecEntry = NULL;
             }
         } while (context != NULL); // Loop until all data has been obtained.
-        
+
         // Cleanup
         ::dsDataListDeallocate(mDir, recTypes);
         ::dsDataListDeallocate(mDir, attrTypes);
@@ -734,7 +732,7 @@
         RemoveBuffer();
         CloseNode();
         CloseService();
-        
+
         if (values != NULL)
         {
             ::CFRelease(values);
@@ -757,12 +755,12 @@
         }
         throw;
     }
-    
+
     return result;
 }
 
 // NativeAuthenticationBasicToNode
-// 
+//
 // Authenticate a user to the directory.
 //
 // @param nodename: the node to authenticate to.
@@ -771,21 +769,21 @@
 // @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;
     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();
 
         // First, specify the type of authentication.
@@ -814,13 +812,13 @@
         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;
@@ -848,7 +846,7 @@
             node = 0L;
         }
         CloseService();
-        
+
         throw;
     }
 
@@ -856,7 +854,7 @@
 }
 
 // NativeAuthenticationDigestToNode
-// 
+//
 // Authenticate a user to the directory.
 //
 // @param nodename: the node to authenticate to.
@@ -868,21 +866,21 @@
 //
 bool CDirectoryService::NativeAuthenticationDigestToNode(const char* nodename, const char* user,
                                                          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();
 
         // First, specify the type of authentication.
@@ -917,26 +915,26 @@
 
         ::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]), 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;
@@ -964,7 +962,7 @@
             node = 0L;
         }
         CloseService();
-        
+
         throw;
     }
 
@@ -972,7 +970,7 @@
 }
 
 // OpenService
-// 
+//
 // Open the directory service.
 //
 // @throw: yes
@@ -991,7 +989,7 @@
 }
 
 // CloseService
-// 
+//
 // Close the directory service if previously open.
 //
 void CDirectoryService::CloseService()
@@ -1004,7 +1002,7 @@
 }
 
 // OpenNode
-// 
+//
 // Open a node in the directory.
 //
 // @throw: yes
@@ -1015,7 +1013,7 @@
 }
 
 // OpenNode
-// 
+//
 // Open a node in the directory.
 //
 // @param nodename: the name of the node to open.
@@ -1027,7 +1025,7 @@
     long dirStatus = eDSNoErr;
     tDataListPtr nodePath = NULL;
     tDirNodeReference result = NULL;
-    
+
     try
     {
         nodePath = ::dsDataListAllocate(mDir);
@@ -1056,12 +1054,12 @@
         }
         throw;
     }
-    
+
     return result;
 }
 
 // CloseNode
-// 
+//
 // Close the node if previously open.
 //
 void CDirectoryService::CloseNode()
@@ -1074,7 +1072,7 @@
 }
 
 // CreateBuffer
-// 
+//
 // Create a data buffer for use with directory service calls.
 //
 // @throw: yes
@@ -1093,7 +1091,7 @@
 }
 
 // RemoveBuffer
-// 
+//
 // Destroy the data buffer.
 //
 void CDirectoryService::RemoveBuffer()
@@ -1106,7 +1104,7 @@
 }
 
 // ReallocBuffer
-// 
+//
 // Destroy the data buffer, then re-create with double previous size.
 //
 void CDirectoryService::ReallocBuffer()
@@ -1149,7 +1147,7 @@
 }
 
 // CStringFromBuffer
-// 
+//
 // Convert data in a buffer into a c-string.
 //
 // @return: the converted string.
@@ -1163,7 +1161,7 @@
 }
 
 // CStringBase64FromBuffer
-// 
+//
 // Convert data in a buffer into a base64 encoded c-string.
 //
 // @return: the converted string.
@@ -1174,7 +1172,7 @@
 }
 
 // CStringFromData
-// 
+//
 // Convert data to a c-string.
 //
 // @return: the converted string.

Modified: PyOpenDirectory/trunk/src/CDirectoryService.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.h	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryService.h	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #pragma once
@@ -32,14 +30,14 @@
 public:
     CDirectoryService(const char* nodename);
     ~CDirectoryService();
-    
+
     CFMutableArrayRef ListAllRecordsWithAttributes(const char* recordType, CFDictionaryRef attributes, bool using_python=true);
     CFMutableArrayRef QueryRecordsWithAttribute(const char* attr, const char* value, int matchType, bool casei, const char* recordType, CFDictionaryRef attributes, bool using_python=true);
     CFMutableArrayRef QueryRecordsWithAttributes(const char* query, bool casei, const char* recordType, CFDictionaryRef attributes, bool using_python=true);
 
     bool AuthenticateUserBasic(const char* nodename, const char* user, const char* pswd, bool& result, bool using_python=true);
     bool AuthenticateUserDigest(const char* nodename, const char* user, const char* challenge, const char* response, const char* method, bool& result, bool using_python=true);
-    
+
 private:
 
     class StPythonThreadState
@@ -52,13 +50,13 @@
 			else
 				mSavedState = NULL;
 		}
-        
+
         ~StPythonThreadState()
         {
 			if (mSavedState != NULL)
 				PyEval_RestoreThread(mSavedState);
         }
-    
+
     private:
         PyThreadState* mSavedState;
     };
@@ -68,20 +66,20 @@
     tDirNodeReference     mNode;
     tDataBufferPtr        mData;
     UInt32                mDataSize;
-    
+
     CFMutableArrayRef _ListAllRecordsWithAttributes(const char* type, CFArrayRef names, CFDictionaryRef attrs);
     CFMutableArrayRef _QueryRecordsWithAttributes(const char* attr, const char* value, int matchType, const char* compound, bool casei, const char* recordType, CFDictionaryRef attrs);
 
     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();

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include "CDirectoryServiceException.h"

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.h	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.h	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #pragma once
@@ -27,11 +25,11 @@
     CDirectoryServiceException();
     CDirectoryServiceException(long error, const char* file, long line);
     ~CDirectoryServiceException();
-    
+
     static void ThrowDSError(long error, const char* file, long line);
 
     void SetPythonException();
-    
+
 private:
     long        mDSError;
     char        mDescription[1024];

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceManager.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include "CDirectoryServiceManager.h"

Modified: PyOpenDirectory/trunk/src/CDirectoryServiceManager.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceManager.h	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceManager.h	2008-10-04 22:45:22 UTC (rev 3107)
@@ -2,7 +2,7 @@
  * A class that wraps high-level Directory Service calls needed by the
  * CalDAV server.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #pragma once

Modified: PyOpenDirectory/trunk/src/CFStringUtil.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CFStringUtil.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CFStringUtil.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,7 +1,7 @@
 /**
  * A class that wraps CFString.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include "CFStringUtil.h"
@@ -62,7 +60,7 @@
     if (mRef != NULL)
         ::CFRetain(mRef);
     mTemp = NULL;
-    
+
     return *this;
 }
 
@@ -74,7 +72,7 @@
 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
@@ -108,7 +106,7 @@
             else
                 break;
         }
-        
+
         return buffer;
     }
     else

Modified: PyOpenDirectory/trunk/src/CFStringUtil.h
===================================================================
--- PyOpenDirectory/trunk/src/CFStringUtil.h	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/CFStringUtil.h	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,7 +1,7 @@
 /**
  * A class that wraps CFString.
  **
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #pragma once
@@ -28,7 +26,7 @@
     CFStringUtil(const char* cstr);
     CFStringUtil(CFStringRef ref);
     ~CFStringUtil();
-    
+
     CFStringUtil& operator=(const CFStringUtil& copy);
 
     CFStringRef get() const

Modified: PyOpenDirectory/trunk/src/PythonWrapper.cpp
===================================================================
--- PyOpenDirectory/trunk/src/PythonWrapper.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/PythonWrapper.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include <CoreFoundation/CoreFoundation.h>

Modified: PyOpenDirectory/trunk/src/base64.cpp
===================================================================
--- PyOpenDirectory/trunk/src/base64.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/base64.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include "base64.h"
@@ -65,7 +63,7 @@
         *out++ = '=';
     }
     *out = '\0';
-    
+
     return result;
 }
 
@@ -78,11 +76,11 @@
 {
     *rlen = 0;
     int c1, c2, c3, c4;
-    
+
     int vlen = strlen(value);
     unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1);
     unsigned char *out = result;
-    
+
     while (1)
     {
         if (value[0]==0)
@@ -99,7 +97,7 @@
         c4 = value[3];
         if ((c4 != '=') && (CHAR64(c4) == -1))
             goto base64_decode_error;;
-                        
+
         value += 4;
         *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4);
         *rlen += 1;
@@ -114,7 +112,7 @@
             }
         }
     }
-    
+
 base64_decode_error:
     *result = 0;
     *rlen = 0;

Modified: PyOpenDirectory/trunk/src/base64.h
===================================================================
--- PyOpenDirectory/trunk/src/base64.h	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/src/base64.h	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 char *base64_encode(const unsigned char *value, int vlen);

Modified: PyOpenDirectory/trunk/support/test.cpp
===================================================================
--- PyOpenDirectory/trunk/support/test.cpp	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/support/test.cpp	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2008 Apple Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
- * DRI: Cyrus Daboo, cdaboo at apple.com
  **/
 
 #include <stdio.h>
@@ -41,7 +39,7 @@
 #define		kDSNAttrJPEGPhoto						    "dsAttrTypeStandard:JPEGPhoto"
 
 int main (int argc, const char * argv[]) {
-    
+
 	CDirectoryService* dir = new CDirectoryService("/Search");
 
 #if 1
@@ -50,13 +48,13 @@
 	attrs[0] = CFSTR(kDS1AttrDistinguishedName);
 	attrs[1] = CFSTR(kDS1AttrGeneratedUID);
 	attrs[2] = CFSTR(kDSNAttrJPEGPhoto);
-                        
+
 	CFStringRef types[3];
 	types[0] = CFSTR("str");
 	types[1] = CFSTR("str");
 	types[2] = CFSTR("base64");
 	CFDictionaryRef attrsdict = CFDictionaryCreate(kCFAllocatorDefault, (const void **)attrs, (const void **)types, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-                        
+
 	CFMutableArrayRef data = dir->ListAllRecordsWithAttributes(kDSStdRecordTypeUsers, attrsdict, false);
 	if (data != NULL)
 	{
@@ -66,7 +64,7 @@
 			CFArrayRef tuple = (CFArrayRef)CFArrayGetValueAtIndex(data, i);
 			CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(tuple, 0);
 			const char* bytes = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
-			
+
 			if (bytes == NULL)
 			{
 				char localBuffer[256];
@@ -90,7 +88,7 @@
 	strings[0] = CFSTR(kDSNAttrGroupMembers);
 	strings[1] = CFSTR(kDS1AttrGeneratedUID);
 	array = CFArrayCreate(kCFAllocatorDefault, (const void **)strings, 2, &kCFTypeArrayCallBacks);
-                        
+
 	data = NULL;//dir->ListAllRecordsWithAttributes(kDSStdRecordTypeGroups, array);
 	if (data != NULL)
 	{
@@ -100,7 +98,7 @@
 			CFArrayRef tuple = (CFArrayRef)CFArrayGetValueAtIndex(data, i);
 			CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(tuple, 0);
 			const char* bytes = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
-			
+
 			if (bytes == NULL)
 			{
 				char localBuffer[256];
@@ -133,12 +131,12 @@
 	values[0] = CFSTR("cyrus");
 	values[1] = CFSTR("daboo");
 	CFDictionaryRef kvdict = CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, (const void**)values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-                        
+
 	CFStringRef strings[2];
 	strings[0] = CFSTR(kDS1AttrDistinguishedName);
 	strings[1] = CFSTR(kDS1AttrGeneratedUID);
 	CFArrayRef array = CFArrayCreate(kCFAllocatorDefault, (const void **)strings, 2, &kCFTypeArrayCallBacks);
-                        
+
 	CFMutableDictionaryRef dict = dir->QueryRecordsWithAttributes(kvdict, eDSContains, false, false, kDSStdRecordTypeUsers, array);
 	if (dict != NULL)
 	{
@@ -151,13 +149,13 @@
 		printf("\nNo Users returned\n");
 	}
 	CFRelease(array);
-	
+
 #elif 0
 	CFStringRef strings[2];
 	strings[0] = CFSTR(kDS1AttrDistinguishedName);
 	strings[1] = CFSTR(kDS1AttrXMLPlist);
 	CFArrayRef array = CFArrayCreate(kCFAllocatorDefault, (const void **)strings, 2, &kCFTypeArrayCallBacks);
-                        
+
 	CFMutableDictionaryRef dict = dir->QueryRecordsWithAttribute(kDSNAttrServicesLocator, "D9A8E41B", eDSStartsWith, false, kDSStdRecordTypeResources, array);
 	if (dict != NULL)
 	{
@@ -170,15 +168,15 @@
 		printf("\nNo Users returned\n");
 	}
 	CFRelease(array);
-	
+
 #elif 1
 	const char* compoundtest = "(&(|(dsAttrTypeStandard:RealName=U2*)(dsAttrTypeStandard:RealName=X S*))(dsAttrTypeStandard:ServicesLocator=D9A8E41B-C591-4D6B-A1CA-B57FFB8EF2F5:F967C034-54B8-4E65-9B38-7A6CD2600268:calendar))";
-                        
+
 	CFStringRef strings[2];
 	strings[0] = CFSTR(kDS1AttrDistinguishedName);
 	strings[1] = CFSTR(kDS1AttrXMLPlist);
 	CFArrayRef array = CFArrayCreate(kCFAllocatorDefault, (const void **)strings, 2, &kCFTypeArrayCallBacks);
-                        
+
 	CFMutableDictionaryRef dict = dir->QueryRecordsWithAttributes(compoundtest, true, kDSStdRecordTypeResources, array);
 	if (dict != NULL)
 	{
@@ -191,7 +189,7 @@
 		printf("\nNo Users returned\n");
 	}
 	CFRelease(array);
-	
+
 #else
 	const char* u = "test";
 	//const char* c = "nonce=\"1\", qop=\"auth\", realm=\"Test\", algorithm=\"md5\", opaque=\"1\"";
@@ -235,13 +233,13 @@
 {
 	CFStringRef strkey = (CFStringRef)key;
 	CFStringRef strvalue = (CFStringRef)value;
-	
+
 	char* pystrkey = CStringFromCFString(strkey);
 	char* pystrvalue = CStringFromCFString(strvalue);
-	
-	
+
+
 	printf("%s: %s\n", pystrkey, pystrvalue);
-	
+
 	free(pystrkey);
 	free(pystrvalue);
 }
@@ -249,7 +247,7 @@
 char* CStringFromCFString(CFStringRef str)
 {
 	const char* bytes = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
-	
+
 	if (bytes == NULL)
 	{
 		char localBuffer[256];
@@ -269,7 +267,7 @@
 {
 	CFStringUtil strkey((CFStringRef)key);
 	CFDictionaryRef dictvalue = (CFDictionaryRef)value;
-	
+
 	printf("Dictionary Entry: \"%s\"\n", strkey.temp_str());
 	CFDictionaryApplyFunction(dictvalue, PrintDictionary, NULL);
 	printf("\n");
@@ -330,7 +328,7 @@
 	{
 		CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, i);
 		const char* bytes = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
-		
+
 		if (bytes == NULL)
 		{
 			char localBuffer[256];

Modified: PyOpenDirectory/trunk/test.py
===================================================================
--- PyOpenDirectory/trunk/test.py	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/test.py	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
 import opendirectory

Modified: PyOpenDirectory/trunk/test_auth.py
===================================================================
--- PyOpenDirectory/trunk/test_auth.py	2008-10-04 22:40:16 UTC (rev 3106)
+++ PyOpenDirectory/trunk/test_auth.py	2008-10-04 22:45:22 UTC (rev 3107)
@@ -1,4 +1,19 @@
 #!/usr/bin/env python
+##
+# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
 
 from getpass import getpass
 import opendirectory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081004/e2ab309d/attachment-0001.html 


More information about the calendarserver-changes mailing list