Mercurial > hg > xemacs-beta
comparison src/eldap.c @ 563:183866b06e0b
[xemacs-hg @ 2001-05-24 07:50:48 by ben]
Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c:
-- defsymbol -> DEFSYMBOL.
-- add an error type to all errors.
-- eliminate the error functions in eval.c that let you just
use Qerror as the type.
-- redo the error API to be more consistent, sensibly named,
and easier to use.
-- redo the error hierarchy somewhat. create new errors:
structure-formation-error, gui-error, invalid-constant,
stack-overflow, out-of-memory, process-error, network-error,
sound-error, printing-unreadable-object, base64-conversion-
error; coding-system-error renamed to text-conversion error;
some others.
-- fix Mule problems in error strings in emodules.c, tooltalk.c.
-- fix error handling in mswin open-network-stream.
-- Mule-ize all sound files and clean up the headers.
-- nativesound.h -> sound.h and used for all sound files.
-- move some shared stuff into glyphs-shared.c: first attempt
at eliminating some of the massive GTK code duplication.
xemacs.mak: add glyphs-shared.c.
xemacs-faq.texi: document how to debug X errors
subr.el: fix doc string to reflect reality
author | ben |
---|---|
date | Thu, 24 May 2001 07:51:33 +0000 |
parents | c33ae14dd6d0 |
children | 6db80f4ab17c |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
80 ldap_err = ldap_result2error (ld, res, 0); | 80 ldap_err = ldap_result2error (ld, res, 0); |
81 #else | 81 #else |
82 ldap_err = ld->ld_errno; | 82 ldap_err = ld->ld_errno; |
83 #endif | 83 #endif |
84 } | 84 } |
85 signal_simple_error ("LDAP error", | 85 invalid_operation ("LDAP error", |
86 build_string (ldap_err2string (ldap_err))); | 86 build_string (ldap_err2string (ldap_err))); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 /************************************************************************/ | 90 /************************************************************************/ |
111 char buf[32]; | 111 char buf[32]; |
112 | 112 |
113 Lisp_LDAP *ldap = XLDAP (obj); | 113 Lisp_LDAP *ldap = XLDAP (obj); |
114 | 114 |
115 if (print_readably) | 115 if (print_readably) |
116 error ("printing unreadable object #<ldap %s>", | 116 printing_unreadable_object ("#<ldap %s>", XSTRING_DATA (ldap->host)); |
117 XSTRING_DATA (ldap->host)); | |
118 | 117 |
119 write_c_string ("#<ldap ", printcharfun); | 118 write_c_string ("#<ldap ", printcharfun); |
120 print_internal (ldap->host, printcharfun, 1); | 119 print_internal (ldap->host, printcharfun, 1); |
121 if (!ldap->ld) | 120 if (!ldap->ld) |
122 write_c_string ("(dead) ",printcharfun); | 121 write_c_string ("(dead) ",printcharfun); |
138 finalize_ldap (void *header, int for_disksave) | 137 finalize_ldap (void *header, int for_disksave) |
139 { | 138 { |
140 Lisp_LDAP *ldap = (Lisp_LDAP *) header; | 139 Lisp_LDAP *ldap = (Lisp_LDAP *) header; |
141 | 140 |
142 if (for_disksave) | 141 if (for_disksave) |
143 signal_simple_error ("Can't dump an emacs containing LDAP objects", | 142 invalid_operation ("Can't dump an emacs containing LDAP objects", |
144 make_ldap (ldap)); | 143 make_ldap (ldap)); |
145 | 144 |
146 if (ldap->ld) | 145 if (ldap->ld) |
147 ldap_unbind (ldap->ld); | 146 ldap_unbind (ldap->ld); |
148 ldap->ld = NULL; | 147 ldap->ld = NULL; |
241 #ifdef LDAP_AUTH_KRBV42 | 240 #ifdef LDAP_AUTH_KRBV42 |
242 else if (EQ (value, Qkrbv42)) | 241 else if (EQ (value, Qkrbv42)) |
243 ldap_auth = LDAP_AUTH_KRBV42; | 242 ldap_auth = LDAP_AUTH_KRBV42; |
244 #endif | 243 #endif |
245 else | 244 else |
246 signal_simple_error ("Invalid authentication method", value); | 245 invalid_constant ("Invalid authentication method", value); |
247 } | 246 } |
248 /* Bind DN */ | 247 /* Bind DN */ |
249 else if (EQ (keyword, Qbinddn)) | 248 else if (EQ (keyword, Qbinddn)) |
250 { | 249 { |
251 CHECK_STRING (value); | 250 CHECK_STRING (value); |
267 else if (EQ (value, Qfind)) | 266 else if (EQ (value, Qfind)) |
268 ldap_deref = LDAP_DEREF_FINDING; | 267 ldap_deref = LDAP_DEREF_FINDING; |
269 else if (EQ (value, Qalways)) | 268 else if (EQ (value, Qalways)) |
270 ldap_deref = LDAP_DEREF_ALWAYS; | 269 ldap_deref = LDAP_DEREF_ALWAYS; |
271 else | 270 else |
272 signal_simple_error ("Invalid deref value", value); | 271 invalid_constant ("Invalid deref value", value); |
273 } | 272 } |
274 /* Timelimit */ | 273 /* Timelimit */ |
275 else if (EQ (keyword, Qtimelimit)) | 274 else if (EQ (keyword, Qtimelimit)) |
276 { | 275 { |
277 CHECK_INT (value); | 276 CHECK_INT (value); |
295 slow_down_interrupts (); | 294 slow_down_interrupts (); |
296 ld = ldap_open ((char *) XSTRING_DATA (host), ldap_port); | 295 ld = ldap_open ((char *) XSTRING_DATA (host), ldap_port); |
297 speed_up_interrupts (); | 296 speed_up_interrupts (); |
298 | 297 |
299 if (ld == NULL ) | 298 if (ld == NULL ) |
300 signal_simple_error_2 ("Failed connecting to host", | 299 report_process_error ("Failed connecting to host", host); |
301 host, | |
302 lisp_strerror (errno)); | |
303 | |
304 | 300 |
305 #ifdef HAVE_LDAP_SET_OPTION | 301 #ifdef HAVE_LDAP_SET_OPTION |
306 if ((err = ldap_set_option (ld, LDAP_OPT_DEREF, | 302 if ((err = ldap_set_option (ld, LDAP_OPT_DEREF, |
307 (void *)&ldap_deref)) != LDAP_SUCCESS) | 303 (void *)&ldap_deref)) != LDAP_SUCCESS) |
308 signal_ldap_error (ld, NULL, err); | 304 signal_ldap_error (ld, NULL, err); |
331 ld->ld_options |= LDAP_OPT_RESTART; | 327 ld->ld_options |= LDAP_OPT_RESTART; |
332 #endif /* not HAVE_LDAP_SET_OPTION */ | 328 #endif /* not HAVE_LDAP_SET_OPTION */ |
333 | 329 |
334 err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth); | 330 err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth); |
335 if (err != LDAP_SUCCESS) | 331 if (err != LDAP_SUCCESS) |
336 signal_simple_error ("Failed binding to the server", | 332 { |
337 build_string (ldap_err2string (err))); | 333 Bufbyte *interrmess; |
334 EXTERNAL_TO_C_STRING (ldap_err2string (err), interrmess, Qnative); | |
335 signal_error (Qprocess_error, "Failed binding to the server", | |
336 build_string (interrmess)); | |
337 } | |
338 | 338 |
339 ldap = allocate_ldap (); | 339 ldap = allocate_ldap (); |
340 ldap->ld = ld; | 340 ldap->ld = ld; |
341 ldap->host = host; | 341 ldap->host = host; |
342 | 342 |
457 else if (EQ (scope, Qonelevel)) | 457 else if (EQ (scope, Qonelevel)) |
458 ldap_scope = LDAP_SCOPE_ONELEVEL; | 458 ldap_scope = LDAP_SCOPE_ONELEVEL; |
459 else if (EQ (scope, Qsubtree)) | 459 else if (EQ (scope, Qsubtree)) |
460 ldap_scope = LDAP_SCOPE_SUBTREE; | 460 ldap_scope = LDAP_SCOPE_SUBTREE; |
461 else | 461 else |
462 signal_simple_error ("Invalid scope", scope); | 462 invalid_constant ("Invalid scope", scope); |
463 } | 463 } |
464 | 464 |
465 /* Attributes to search */ | 465 /* Attributes to search */ |
466 if (!NILP (attrs)) | 466 if (!NILP (attrs)) |
467 { | 467 { |
617 CHECK_STRING (dn); | 617 CHECK_STRING (dn); |
618 | 618 |
619 /* Check the entry */ | 619 /* Check the entry */ |
620 CHECK_CONS (entry); | 620 CHECK_CONS (entry); |
621 if (NILP (entry)) | 621 if (NILP (entry)) |
622 signal_simple_error ("Cannot add void entry", entry); | 622 invalid_operation ("Cannot add void entry", entry); |
623 | 623 |
624 /* Build the ldap_mods array */ | 624 /* Build the ldap_mods array */ |
625 len = XINT (Flength (entry)); | 625 len = XINT (Flength (entry)); |
626 ldap_mods = alloca_array (LDAPMod, len); | 626 ldap_mods = alloca_array (LDAPMod, len); |
627 ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); | 627 ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); |
733 else if (EQ (mod_op, Qdelete)) | 733 else if (EQ (mod_op, Qdelete)) |
734 ldap_mods[i].mod_op |= LDAP_MOD_DELETE; | 734 ldap_mods[i].mod_op |= LDAP_MOD_DELETE; |
735 else if (EQ (mod_op, Qreplace)) | 735 else if (EQ (mod_op, Qreplace)) |
736 ldap_mods[i].mod_op |= LDAP_MOD_REPLACE; | 736 ldap_mods[i].mod_op |= LDAP_MOD_REPLACE; |
737 else | 737 else |
738 signal_simple_error ("Invalid LDAP modification type", mod_op); | 738 invalid_constant ("Invalid LDAP modification type", mod_op); |
739 current = XCDR (current); | 739 current = XCDR (current); |
740 CHECK_STRING (XCAR (current)); | 740 CHECK_STRING (XCAR (current)); |
741 LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); | 741 LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); |
742 values = XCDR (current); | 742 values = XCDR (current); |
743 len = XINT (Flength (values)); | 743 len = XINT (Flength (values)); |
794 void | 794 void |
795 syms_of_eldap (void) | 795 syms_of_eldap (void) |
796 { | 796 { |
797 INIT_LRECORD_IMPLEMENTATION (ldap); | 797 INIT_LRECORD_IMPLEMENTATION (ldap); |
798 | 798 |
799 defsymbol (&Qldapp, "ldapp"); | 799 DEFSYMBOL (Qldapp); |
800 defsymbol (&Qport, "port"); | 800 DEFSYMBOL (Qport); |
801 defsymbol (&Qauth, "auth"); | 801 DEFSYMBOL (Qauth); |
802 defsymbol (&Qbinddn, "binddn"); | 802 DEFSYMBOL (Qbinddn); |
803 defsymbol (&Qpasswd, "passwd"); | 803 DEFSYMBOL (Qpasswd); |
804 defsymbol (&Qderef, "deref"); | 804 DEFSYMBOL (Qderef); |
805 defsymbol (&Qtimelimit, "timelimit"); | 805 DEFSYMBOL (Qtimelimit); |
806 defsymbol (&Qsizelimit, "sizelimit"); | 806 DEFSYMBOL (Qsizelimit); |
807 defsymbol (&Qbase, "base"); | 807 DEFSYMBOL (Qbase); |
808 defsymbol (&Qonelevel, "onelevel"); | 808 DEFSYMBOL (Qonelevel); |
809 defsymbol (&Qsubtree, "subtree"); | 809 DEFSYMBOL (Qsubtree); |
810 defsymbol (&Qkrbv41, "krbv41"); | 810 DEFSYMBOL (Qkrbv41); |
811 defsymbol (&Qkrbv42, "krbv42"); | 811 DEFSYMBOL (Qkrbv42); |
812 defsymbol (&Qnever, "never"); | 812 DEFSYMBOL (Qnever); |
813 defsymbol (&Qalways, "always"); | 813 DEFSYMBOL (Qalways); |
814 defsymbol (&Qfind, "find"); | 814 DEFSYMBOL (Qfind); |
815 defsymbol (&Qadd, "add"); | 815 DEFSYMBOL (Qadd); |
816 defsymbol (&Qreplace, "replace"); | 816 DEFSYMBOL (Qreplace); |
817 | 817 |
818 DEFSUBR (Fldapp); | 818 DEFSUBR (Fldapp); |
819 DEFSUBR (Fldap_host); | 819 DEFSUBR (Fldap_host); |
820 DEFSUBR (Fldap_status); | 820 DEFSUBR (Fldap_status); |
821 DEFSUBR (Fldap_open); | 821 DEFSUBR (Fldap_open); |