comparison src/eldap.c @ 327:03446687b7cc r21-0-61

Import from CVS: tag r21-0-61
author cvs
date Mon, 13 Aug 2007 10:48:16 +0200
parents c6de09ad3017
children 7347b34c275b
comparison
equal deleted inserted replaced
326:e2671bc7f66a 327:03446687b7cc
24 24
25 /* This file provides lisp primitives for access to an LDAP library 25 /* This file provides lisp primitives for access to an LDAP library
26 conforming to the API defined in RFC 1823. 26 conforming to the API defined in RFC 1823.
27 It has been tested with: 27 It has been tested with:
28 - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) 28 - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/)
29 - OpenLDAP 1.0.3 (http://www.openldap.org/)
29 - Netscape's LDAP SDK 1.0 (http://developer.netscape.com) */ 30 - Netscape's LDAP SDK 1.0 (http://developer.netscape.com) */
30 31
31 32
32 #include <config.h> 33 #include <config.h>
33 #include "lisp.h" 34 #include "lisp.h"
34 #include "opaque.h" 35 #include "opaque.h"
35 #include "sysdep.h" 36 #include "sysdep.h"
37 #include "buffer.h"
36 38
37 #include <errno.h> 39 #include <errno.h>
38 40
39 #include "eldap.h" 41 #include "eldap.h"
40 42
242 } 244 }
243 /* Bind DN */ 245 /* Bind DN */
244 else if (EQ (keyword, Qbinddn)) 246 else if (EQ (keyword, Qbinddn))
245 { 247 {
246 CHECK_STRING (value); 248 CHECK_STRING (value);
247 ldap_binddn = alloca (XSTRING_LENGTH (value) + 1); 249 GET_C_STRING_OS_DATA_ALLOCA (value, ldap_binddn);
248 strcpy (ldap_binddn, (char *)XSTRING_DATA (value));
249 } 250 }
250 /* Password */ 251 /* Password */
251 else if (EQ (keyword, Qpasswd)) 252 else if (EQ (keyword, Qpasswd))
252 { 253 {
253 CHECK_STRING (value); 254 CHECK_STRING (value);
254 ldap_passwd = alloca (XSTRING_LENGTH (value) + 1); 255 GET_C_STRING_OS_DATA_ALLOCA (value, ldap_passwd);
255 strcpy (ldap_passwd, (char *)XSTRING_DATA (value));
256 } 256 }
257 /* Deref */ 257 /* Deref */
258 else if (EQ (keyword, Qderef)) 258 else if (EQ (keyword, Qderef))
259 { 259 {
260 if (EQ (value, Qnever)) 260 if (EQ (value, Qnever))
452 i = 0; 452 i = 0;
453 EXTERNAL_LIST_LOOP (attrs, attrs) 453 EXTERNAL_LIST_LOOP (attrs, attrs)
454 { 454 {
455 Lisp_Object current = XCAR (attrs); 455 Lisp_Object current = XCAR (attrs);
456 CHECK_STRING (current); 456 CHECK_STRING (current);
457 ldap_attributes[i] = 457 GET_C_STRING_OS_DATA_ALLOCA (current, ldap_attributes[i]);
458 alloca_array (char, 1 + XSTRING_LENGTH (current));
459 /* XSTRING_LENGTH is increased by one in order to copy the final 0 */
460 memcpy (ldap_attributes[i],
461 XSTRING_DATA (current), 1 + XSTRING_LENGTH (current));
462 ++i; 458 ++i;
463 } 459 }
464 ldap_attributes[i] = NULL; 460 ldap_attributes[i] = NULL;
465 } 461 }
466 462