Print this page
3882 remove xmod & friends
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libsasl/lib/saslint.h
+++ new/usr/src/lib/libsasl/lib/saslint.h
1 1 /*
2 2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 */
5 5 #pragma ident "%Z%%M% %I% %E% SMI"
6 6
7 7 /* saslint.h - internal SASL library definitions
8 8 * Rob Siemborski
9 9 * Tim Martin
10 10 * $Id: saslint.h,v 1.48 2003/04/16 19:36:01 rjs3 Exp $
11 11 */
12 12 /*
13 13 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
14 14 *
15 15 * Redistribution and use in source and binary forms, with or without
16 16 * modification, are permitted provided that the following conditions
17 17 * are met:
18 18 *
19 19 * 1. Redistributions of source code must retain the above copyright
20 20 * notice, this list of conditions and the following disclaimer.
21 21 *
22 22 * 2. Redistributions in binary form must reproduce the above copyright
23 23 * notice, this list of conditions and the following disclaimer in
24 24 * the documentation and/or other materials provided with the
25 25 * distribution.
26 26 *
27 27 * 3. The name "Carnegie Mellon University" must not be used to
28 28 * endorse or promote products derived from this software without
29 29 * prior written permission. For permission or any other legal
30 30 * details, please contact
31 31 * Office of Technology Transfer
32 32 * Carnegie Mellon University
33 33 * 5000 Forbes Avenue
34 34 * Pittsburgh, PA 15213-3890
35 35 * (412) 268-4387, fax: (412) 268-7395
36 36 * tech-transfer@andrew.cmu.edu
37 37 *
38 38 * 4. Redistributions of any form whatsoever must retain the following
39 39 * acknowledgment:
40 40 * "This product includes software developed by Computing Services
41 41 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
42 42 *
43 43 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
44 44 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45 45 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
46 46 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
47 47 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
48 48 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
49 49 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
50 50 */
51 51
52 52 #ifndef SASLINT_H
53 53 #define SASLINT_H
54 54
55 55 #include <config.h>
56 56 #include "sasl.h"
57 57 #include "saslplug.h"
58 58 #include "saslutil.h"
59 59 #include "prop.h"
60 60
61 61 /* #define'd constants */
62 62 #define CANON_BUF_SIZE 256
63 63
64 64 /* Error Handling Foo */
65 65 /* Helpful Hints:
66 66 * -Error strings are set as soon as possible (first function in stack trace
67 67 * with a pointer to the sasl_conn_t.
68 68 * -Error codes are set as late as possible (only in the sasl api functions),
69 69 * thoug "as often as possible" also comes to mind to ensure correctness
70 70 * -Errors from calls to _buf_alloc, _sasl_strdup, etc are assumed to be
71 71 * memory errors.
72 72 * -Only errors (error codes < SASL_OK) should be remembered
73 73 */
74 74 #define RETURN(conn, val) { if(conn && (val) < SASL_OK) \
75 75 (conn)->error_code = (val); \
76 76 return (val); }
77 77 #if !defined _SUN_SDK || defined DEBUG
78 78 #define MEMERROR(conn) {\
79 79 if(conn) sasl_seterror( (conn), 0, \
80 80 "Out of Memory in " __FILE__ " near line %d", __LINE__ ); \
81 81 RETURN(conn, SASL_NOMEM) }
82 82 #define PARAMERROR(conn) {\
83 83 if(conn) sasl_seterror( (conn), SASL_NOLOG, \
84 84 "Parameter error in " __FILE__ " near line %d", __LINE__ ); \
85 85 RETURN(conn, SASL_BADPARAM) }
86 86 #define INTERROR(conn, val) {\
87 87 if(conn) sasl_seterror( (conn), 0, \
88 88 "Internal Error %d in " __FILE__ " near line %d", (val),\
89 89 __LINE__ ); \
90 90 RETURN(conn, (val)) }
91 91 #else
92 92 #define MEMERROR(conn) {\
93 93 if(conn) _sasl_log((conn), SASL_LOG_WARN, "Out of Memory"); \
94 94 RETURN(conn, SASL_NOMEM) }
95 95 #define PARAMERROR(conn) {\
96 96 if(conn) _sasl_log((conn), SASL_LOG_WARN, "Parameter error"); \
97 97 RETURN(conn, SASL_BADPARAM) }
98 98 #define INTERROR(conn, val) {\
99 99 if(conn) _sasl_log((conn), SASL_LOG_ERR, "Internal Error: %d", (val)); \
100 100 RETURN(conn, (val)) }
101 101 #endif
102 102
103 103 #ifndef PATH_MAX
104 104 # ifdef WIN32
105 105 # define PATH_MAX MAX_PATH
106 106 # else
107 107 # ifdef _POSIX_PATH_MAX
108 108 # define PATH_MAX _POSIX_PATH_MAX
109 109 # else
110 110 # define PATH_MAX 1024 /* arbitrary; probably big enough will
111 111 * probably only be 256+64 on
112 112 * pre-posix machines */
113 113 # endif /* _POSIX_PATH_MAX */
114 114 # endif /* WIN32 */
115 115 #endif
116 116
117 117 /* : Define directory delimiter in SASL_PATH variable */
118 118 #ifdef WIN32
119 119 #define PATHS_DELIMITER ';'
120 120 #else
121 121 #define PATHS_DELIMITER ':'
122 122 #endif
123 123
124 124 /* Datatype Definitions */
125 125 typedef struct {
126 126 const sasl_callback_t *callbacks;
127 127 const char *appname;
128 128 #ifdef _SUN_SDK_
129 129 struct _sasl_global_context_s *gctx;
130 130 #endif /* _SUN_SDK_ */
131 131 } sasl_global_callbacks_t;
132 132
133 133 typedef struct _sasl_external_properties
134 134 {
135 135 sasl_ssf_t ssf;
136 136 char *auth_id;
137 137 } _sasl_external_properties_t;
138 138
139 139 typedef struct sasl_string_list
140 140 {
141 141 const char *d;
142 142 struct sasl_string_list *next;
143 143 } sasl_string_list_t;
144 144
145 145 typedef struct buffer_info
146 146 {
147 147 char *data;
148 148 size_t curlen;
149 149 size_t reallen;
150 150 } buffer_info_t;
151 151
152 152 #ifdef _SUN_SDK_
153 153 typedef int add_plugin_t(struct _sasl_global_context_s *gctx,
154 154 const char *, void *);
155 155 #else
156 156 typedef int add_plugin_t(const char *, void *);
157 157 #endif /* _SUN_SDK_ */
158 158
159 159 typedef struct add_plugin_list
160 160 {
161 161 const char *entryname;
162 162 add_plugin_t *add_plugin;
163 163 } add_plugin_list_t;
164 164
165 165 enum Sasl_conn_type { SASL_CONN_UNKNOWN = 0,
166 166 SASL_CONN_SERVER = 1,
167 167 SASL_CONN_CLIENT = 2 };
168 168
169 169 struct sasl_conn {
170 170 enum Sasl_conn_type type;
171 171
172 172 void (*destroy_conn)(sasl_conn_t *); /* destroy function */
173 173
174 174 char *service;
175 175
176 176 unsigned int flags; /* flags passed to sasl_*_new */
177 177
178 178 /* IP information. A buffer of size 52 is adequate for this in its
179 179 longest format (see sasl.h) */
180 180 int got_ip_local, got_ip_remote;
181 181 char iplocalport[NI_MAXHOST + NI_MAXSERV];
182 182 char ipremoteport[NI_MAXHOST + NI_MAXSERV];
183 183
184 184 void *context;
185 185 sasl_out_params_t oparams;
186 186
187 187 sasl_security_properties_t props;
188 188 _sasl_external_properties_t external;
189 189
190 190 #ifndef _SUN_SDK_
191 191 sasl_secret_t *secret;
192 192 #endif /* !_SUN_SDK_ */
193 193
194 194 int (*idle_hook)(sasl_conn_t *conn);
195 195 const sasl_callback_t *callbacks;
196 196 const sasl_global_callbacks_t *global_callbacks; /* global callbacks
197 197 * connection */
198 198 char *serverFQDN;
199 199
200 200 /* Pointers to memory that we are responsible for */
201 201 buffer_info_t *encode_buf;
202 202
203 203 int error_code;
204 204 char *error_buf, *errdetail_buf;
↓ open down ↓ |
204 lines elided |
↑ open up ↑ |
205 205 size_t error_buf_len, errdetail_buf_len;
206 206 char *mechlist_buf;
207 207 size_t mechlist_buf_len;
208 208
209 209 char *decode_buf;
210 210
211 211 char user_buf[CANON_BUF_SIZE+1], authid_buf[CANON_BUF_SIZE+1];
212 212
213 213 #ifdef _SUN_SDK_
214 214 struct _sasl_global_context_s *gctx;
215 - /* EXPORT DELETE START */
216 - /* CRYPT DELETE START */
217 215 #ifdef _INTEGRATED_SOLARIS_
218 216 int sun_reg;
219 217 #endif /* _INTEGRATED_SOLARIS_ */
220 - /* CRYPT DELETE END */
221 - /* EXPORT DELETE END */
222 218 #endif /* _SUN_SDK_ */
223 219 };
224 220
225 221 #ifdef _SUN_SDK_
226 222 /* track changes in file system */
227 223 typedef struct _sasl_path_info {
228 224 char *path;
229 225 time_t last_changed;
230 226 struct _sasl_path_info *next;
231 227 } _sasl_path_info_t;
232 228 #endif /* _SUN_SDK_ */
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
233 229
234 230 /* Server Conn Type Information */
235 231
236 232 typedef struct mechanism
237 233 {
238 234 int version;
239 235 int condition; /* set to SASL_NOUSER if no available users;
240 236 set to SASL_CONTINUE if delayed plugn loading */
241 237 char *plugname; /* for AUTHSOURCE tracking */
242 238 #ifdef _SUN_SDK_
243 - /* EXPORT DELETE START */
244 - /* CRYPT DELETE START */
245 239 #ifdef _INTEGRATED_SOLARIS_
246 240 int sun_reg;
247 241 #endif /* _INTEGRATED_SOLARIS_ */
248 - /* CRYPT DELETE END */
249 - /* EXPORT DELETE END */
250 242 sasl_server_plug_t *plug;
251 243 /*
252 244 * The global context needs to be stored with separately from the
253 245 * the plugin because it will be overwritten when the plugin is
254 246 * relloaded
255 247 */
256 248 void *glob_context;
257 249 struct mechanism *next;
258 250 #else
259 251 const sasl_server_plug_t *plug;
260 252 struct mechanism *next;
261 253 char *f; /* where should i load the mechanism from? */
262 254 #endif /* _SUN_SDK_ */
263 255 } mechanism_t;
264 256
265 257 typedef struct mech_list {
266 258 const sasl_utils_t *utils; /* gotten from plug_init */
267 259
268 260 void *mutex; /* mutex for this data */
269 261 mechanism_t *mech_list; /* list of mechanisms */
270 262 int mech_length; /* number of mechanisms */
271 263 } mech_list_t;
272 264
273 265 typedef struct context_list
274 266 {
275 267 mechanism_t *mech;
276 268 void *context; /* if NULL, this mech is disabled for this connection
277 269 * otherwise, use this context instead of a call
278 270 * to mech_new */
279 271 struct context_list *next;
280 272 } context_list_t;
281 273
282 274 typedef struct sasl_server_conn {
283 275 sasl_conn_t base; /* parts common to server + client */
284 276
285 277 char *user_realm; /* domain the user authenticating is in */
286 278 int sent_last; /* Have we already done the last send? */
287 279 int authenticated;
288 280 mechanism_t *mech; /* mechanism trying to use */
289 281 sasl_server_params_t *sparams;
290 282 context_list_t *mech_contexts;
↓ open down ↓ |
31 lines elided |
↑ open up ↑ |
291 283 } sasl_server_conn_t;
292 284
293 285 /* Client Conn Type Information */
294 286
295 287 typedef struct cmechanism
296 288 {
297 289 int version;
298 290
299 291 char *plugname;
300 292 #ifdef _SUN_SDK_
301 - /* EXPORT DELETE START */
302 - /* CRYPT DELETE START */
303 293 #ifdef _INTEGRATED_SOLARIS_
304 294 int sun_reg;
305 295 #endif /* _INTEGRATED_SOLARIS_ */
306 - /* CRYPT DELETE END */
307 - /* EXPORT DELETE END */
308 296 /*
309 297 * The global context needs to be stored with separately from the
310 298 * the plugin because it will be overwritten when the plugin is
311 299 * relloaded
312 300 */
313 301 void *glob_context;
314 302 sasl_client_plug_t *plug;
315 303 #else
316 304 const sasl_client_plug_t *plug;
317 305 #endif /* _SUN_SDK_ */
318 306
319 307 struct cmechanism *next;
320 308 } cmechanism_t;
321 309
322 310 typedef struct cmech_list {
323 311 const sasl_utils_t *utils;
324 312
325 313 void *mutex; /* mutex for this data */
326 314 cmechanism_t *mech_list; /* list of mechanisms */
327 315 int mech_length; /* number of mechanisms */
328 316
329 317 } cmech_list_t;
330 318
331 319 typedef struct sasl_client_conn {
332 320 sasl_conn_t base; /* parts common to server + client */
333 321
334 322 cmechanism_t *mech;
335 323 sasl_client_params_t *cparams;
336 324
337 325 char *clientFQDN;
338 326
339 327 } sasl_client_conn_t;
340 328
341 329 typedef struct sasl_allocation_utils {
342 330 sasl_malloc_t *malloc;
343 331 sasl_calloc_t *calloc;
344 332 sasl_realloc_t *realloc;
345 333 sasl_free_t *free;
346 334 } sasl_allocation_utils_t;
347 335
348 336 typedef struct sasl_mutex_utils {
349 337 sasl_mutex_alloc_t *alloc;
350 338 sasl_mutex_lock_t *lock;
351 339 sasl_mutex_unlock_t *unlock;
352 340 sasl_mutex_free_t *free;
353 341 } sasl_mutex_utils_t;
354 342
355 343 typedef struct sasl_log_utils_s {
356 344 sasl_log_t *log;
357 345 } sasl_log_utils_t;
358 346
359 347 #ifdef _SUN_SDK_
360 348 /*
361 349 * The following structure contains the global state for libsasl */
362 350 typedef struct _sasl_global_context_s {
363 351 int sasl_server_active;
364 352 /* sasl server init'ed */
365 353 mech_list_t *mechlist;
366 354 /* list of server mechs */
367 355 _sasl_path_info_t *splug_path_info;
368 356 /* path info for server plugins */
369 357 sasl_global_callbacks_t server_global_callbacks;
370 358 /* callbacks for sasl_server_init */
371 359 int (*sasl_server_cleanup_hook)
372 360 (struct _sasl_global_context_s *gctx);
373 361 /* entry point to clean up sasl server */
374 362 int (*sasl_server_idle_hook)(sasl_conn_t *conn);
375 363 /* entry point for sasl server idle */
376 364
377 365 cmech_list_t *cmechlist;
378 366 /* list of client mechs */
379 367 _sasl_path_info_t *cplug_path_info;
380 368 /* path info for client plugins */
381 369 sasl_global_callbacks_t client_global_callbacks;
382 370 /* callbacks for sasl_client_init */
383 371 int sasl_client_active;
384 372 /* sasl client init'ed */
385 373 int (*sasl_client_cleanup_hook)
386 374 (struct _sasl_global_context_s *gctx);
387 375 /* entry point to clean up sasl client */
388 376 int (*sasl_client_idle_hook)(sasl_conn_t *conn);
389 377 /* entry point for sasl client idle */
390 378
391 379 const sasl_utils_t *sasl_server_global_utils;
392 380 /* sasl server global utils */
393 381 const sasl_utils_t *sasl_canonusr_global_utils;
394 382 /* sasl global utils for canonusr plugin */
395 383
396 384 void *configlist;
397 385 /* Configuration key value pair data list */
398 386 int nconfiglist;
399 387 /* number of items in configlist */
400 388 char *config_path;
401 389 /* last read config path */
402 390 time_t config_last_read;
403 391 /* last time config read */
404 392
405 393 void *auxprop_head;
406 394 /* Head of auxprop plugin list */
407 395 void *canonuser_head;
408 396 /* Head of canonusr plugin list */
409 397 char **global_mech_list;
410 398 /* Global list of mechanisms */
411 399 void *free_mutex;
412 400 /* sasl_done()/sasl_dispose() mutex */
413 401 sasl_allocation_utils_t sasl_allocation_utils;
414 402 /* malloc et al */
415 403 sasl_mutex_utils_t sasl_mutex_utils;
416 404 /* mutex_alloc et al */
417 405 void *lib_list_head;
418 406 /* list of dynamic libs opened */
419 407 }_sasl_global_context_t;
420 408 #endif /* _SUN_SDK_ */
421 409
422 410 typedef int sasl_plaintext_verifier(sasl_conn_t *conn,
423 411 const char *userid,
424 412 const char *passwd,
425 413 const char *service,
426 414 const char *user_realm);
427 415
428 416 struct sasl_verify_password_s {
429 417 char *name;
430 418 sasl_plaintext_verifier *verify;
431 419 };
432 420
433 421 /*
434 422 * globals & constants
435 423 */
436 424 /*
437 425 * common.c
438 426 */
439 427 #ifndef _SUN_SDK_
440 428 LIBSASL_API const sasl_utils_t *sasl_global_utils;
441 429
442 430 extern int (*_sasl_client_idle_hook)(sasl_conn_t *conn);
443 431 extern int (*_sasl_server_idle_hook)(sasl_conn_t *conn);
444 432
445 433 /* These return SASL_OK if we've actually finished cleanup,
446 434 * SASL_NOTINIT if that part of the library isn't inited, and
447 435 * SASL_CONTINUE if we need to call them again */
448 436 extern int (*_sasl_client_cleanup_hook)(void);
449 437 extern int (*_sasl_server_cleanup_hook)(void);
450 438
451 439 extern sasl_allocation_utils_t _sasl_allocation_utils;
452 440 extern sasl_mutex_utils_t _sasl_mutex_utils;
453 441 #endif /* !_SUN_SDK_ */
454 442
455 443 /*
456 444 * checkpw.c
457 445 */
458 446 extern struct sasl_verify_password_s _sasl_verify_password[];
459 447
460 448 /*
461 449 * server.c
462 450 */
463 451 /* (this is a function call to ensure this is read-only to the outside) */
464 452 #ifdef _SUN_SDK_
465 453 extern int _is_sasl_server_active(_sasl_global_context_t *gctx);
466 454 #else
467 455 extern int _is_sasl_server_active(void);
468 456 #endif /* _SUN_SDK_ */
469 457
470 458 /*
471 459 * Allocation and Mutex utility macros
472 460 */
473 461 #ifdef _SUN_SDK_
474 462 #define sasl_ALLOC(__size__) (gctx->sasl_allocation_utils.malloc((__size__)))
475 463 #define sasl_CALLOC(__nelem__, __size__) \
476 464 (gctx->sasl_allocation_utils.calloc((__nelem__), (__size__)))
477 465 #define sasl_REALLOC(__ptr__, __size__) \
478 466 (gctx->sasl_allocation_utils.realloc((__ptr__), (__size__)))
479 467 #define sasl_FREE(__ptr__) (gctx->sasl_allocation_utils.free((__ptr__)))
480 468 #define sasl_sun_ALLOC(__size__) (malloc((__size__)))
481 469 #define sasl_sun_CALLOC(__nelem__, __size__) (calloc((__nelem__), (__size__)))
482 470 #define sasl_sun_REALLOC(__ptr__, __size__) (realloc((__ptr__), (__size__)))
483 471 #define sasl_sun_FREE(__ptr__) (free((__ptr__)))
484 472
485 473 #define sasl_MUTEX_ALLOC() (gctx->sasl_mutex_utils.alloc())
486 474 #define sasl_MUTEX_LOCK(__mutex__) (gctx->sasl_mutex_utils.lock((__mutex__)))
487 475 #define sasl_MUTEX_UNLOCK(__mutex__) \
488 476 (gctx->sasl_mutex_utils.unlock((__mutex__)))
489 477 #define sasl_MUTEX_FREE(__mutex__) (gctx->sasl_mutex_utils.free((__mutex__)))
490 478 #else
491 479 #define sasl_ALLOC(__size__) (_sasl_allocation_utils.malloc((__size__)))
492 480 #define sasl_CALLOC(__nelem__, __size__) \
493 481 (_sasl_allocation_utils.calloc((__nelem__), (__size__)))
494 482 #define sasl_REALLOC(__ptr__, __size__) \
495 483 (_sasl_allocation_utils.realloc((__ptr__), (__size__)))
496 484 #define sasl_FREE(__ptr__) (_sasl_allocation_utils.free((__ptr__)))
497 485
498 486 #define sasl_MUTEX_ALLOC() (_sasl_mutex_utils.alloc())
499 487 #define sasl_MUTEX_LOCK(__mutex__) (_sasl_mutex_utils.lock((__mutex__)))
500 488 #define sasl_MUTEX_UNLOCK(__mutex__) (_sasl_mutex_utils.unlock((__mutex__)))
501 489 #define sasl_MUTEX_FREE(__mutex__) \
502 490 (_sasl_mutex_utils.free((__mutex__)))
503 491 #endif /* _SUN_SDK_ */
504 492
505 493 /* function prototypes */
506 494 /*
507 495 * dlopen.c and staticopen.c
508 496 */
509 497 /*
510 498 * The differences here are:
511 499 * _sasl_load_plugins loads all plugins from all files
512 500 * _sasl_get_plugin loads the LIBRARY for an individual file
513 501 * _sasl_done_with_plugins frees the LIBRARIES loaded by the above 2
514 502 * _sasl_locate_entry locates an entrypoint in a given library
515 503 */
516 504 #ifdef _SUN_SDK_
517 505 extern int _sasl_load_plugins(_sasl_global_context_t *gctx,
518 506 int server,
519 507 const add_plugin_list_t *entrypoints,
520 508 const sasl_callback_t *getpath_callback,
521 509 const sasl_callback_t *verifyfile_callback);
522 510
523 511 extern int _sasl_get_plugin(_sasl_global_context_t *gctx,
524 512 const char *file,
525 513 const sasl_callback_t *verifyfile_cb,
526 514 void **libraryptr);
527 515 extern int _sasl_locate_entry(void *library, const char *entryname,
528 516 void **entry_point);
529 517 extern int _sasl_done_with_plugins(_sasl_global_context_t *gctx);
530 518 #else
531 519 extern int _sasl_load_plugins(const add_plugin_list_t *entrypoints,
532 520 const sasl_callback_t *getpath_callback,
533 521 const sasl_callback_t *verifyfile_callback);
534 522 extern int _sasl_get_plugin(const char *file,
535 523 const sasl_callback_t *verifyfile_cb,
536 524 void **libraryptr);
537 525 extern int _sasl_locate_entry(void *library, const char *entryname,
538 526 void **entry_point);
539 527 extern int _sasl_done_with_plugins();
540 528 #endif /* _SUN_SDK_ */
541 529
542 530
543 531 /*
544 532 * common.c
545 533 */
546 534 extern const sasl_callback_t *
547 535 _sasl_find_getpath_callback(const sasl_callback_t *callbacks);
548 536
549 537 extern const sasl_callback_t *
550 538 _sasl_find_verifyfile_callback(const sasl_callback_t *callbacks);
551 539
552 540 #ifdef _SUN_SDK_
553 541 extern const sasl_callback_t *
554 542 _sasl_find_getconf_callback(const sasl_callback_t *callbacks);
555 543
556 544 extern int _sasl_common_init(_sasl_global_context_t *gctx,
557 545 sasl_global_callbacks_t *global_callbacks,
558 546 int server);
559 547 #else
560 548 extern int _sasl_common_init(sasl_global_callbacks_t *global_callbacks);
561 549 #endif /* _SUN_SDK_ */
562 550
563 551 extern int _sasl_conn_init(sasl_conn_t *conn,
564 552 const char *service,
565 553 unsigned int flags,
566 554 enum Sasl_conn_type type,
567 555 int (*idle_hook)(sasl_conn_t *conn),
568 556 const char *serverFQDN,
569 557 const char *iplocalport,
570 558 const char *ipremoteport,
571 559 const sasl_callback_t *callbacks,
572 560 const sasl_global_callbacks_t *global_callbacks);
573 561 extern void _sasl_conn_dispose(sasl_conn_t *conn);
574 562
575 563 #ifdef _SUN_SDK_
576 564 extern sasl_utils_t *
577 565 _sasl_alloc_utils(_sasl_global_context_t *gctx, sasl_conn_t *conn,
578 566 sasl_global_callbacks_t *global_callbacks);
579 567 #else
580 568 extern sasl_utils_t *
581 569 _sasl_alloc_utils(sasl_conn_t *conn,
582 570 sasl_global_callbacks_t *global_callbacks);
583 571 #endif /* _SUN_SDK_ */
584 572 extern int _sasl_free_utils(const sasl_utils_t ** utils);
585 573
586 574 extern int
587 575 _sasl_getcallback(sasl_conn_t * conn,
588 576 unsigned long callbackid,
589 577 int (**pproc)(),
590 578 void **pcontext);
591 579
592 580 extern void
593 581 _sasl_log(sasl_conn_t *conn,
594 582 int level,
595 583 const char *fmt,
596 584 ...);
597 585
598 586 #ifdef _SUN_SDK_
599 587 extern void
600 588 __sasl_log(const _sasl_global_context_t *gctx,
601 589 const sasl_callback_t *callbacks,
602 590 int level,
603 591 const char *fmt,
604 592 ...);
605 593 #endif /* _SUN_SDK_ */
606 594 void _sasl_get_errorbuf(sasl_conn_t *conn, char ***bufhdl, size_t **lenhdl);
607 595 #ifdef _SUN_SDK_
608 596 int __sasl_add_string(const _sasl_global_context_t *gctx, char **out,
609 597 size_t *alloclen,
610 598 size_t *outlen, const char *add);
611 599
612 600 #define _sasl_add_string(out, alloclen, outlen, add) \
613 601 __sasl_add_string(gctx, out, alloclen, outlen, add)
614 602
615 603 /* More Generic Utilities in common.c */
616 604 #define _sasl_strdup(in, out, outlen) \
617 605 __sasl_strdup(gctx, in, out, outlen)
618 606 extern int __sasl_strdup(const _sasl_global_context_t *gctx, const char *in,
619 607 char **out, size_t *outlen);
620 608
621 609 /* Basically a conditional call to realloc(), if we need more */
622 610 int __buf_alloc(const _sasl_global_context_t *gctx, char **rwbuf,
623 611 size_t *curlen, size_t newlen);
624 612 #define _buf_alloc(rwbuf, curlen, newlen) \
625 613 __buf_alloc(gctx, rwbuf, curlen, newlen)
626 614 #else
627 615 int _sasl_add_string(char **out, size_t *alloclen,
628 616 size_t *outlen, const char *add);
629 617
630 618 /* More Generic Utilities in common.c */
631 619 extern int _sasl_strdup(const char *in, char **out, size_t *outlen);
632 620
633 621 /* Basically a conditional call to realloc(), if we need more */
634 622 int _buf_alloc(char **rwbuf, size_t *curlen, size_t newlen);
635 623 #endif /* _SUN_SDK_ */
636 624
637 625 /* convert an iovec to a single buffer */
638 626 #ifdef _SUN_SDK_
639 627 int _iovec_to_buf(const _sasl_global_context_t *gctx, const struct iovec *vec,
640 628 unsigned numiov, buffer_info_t **output);
641 629 #else
642 630 int _iovec_to_buf(const struct iovec *vec,
643 631 unsigned numiov, buffer_info_t **output);
644 632 #endif /* _SUN_SDK_ */
645 633
646 634 /* Convert between string formats and sockaddr formats */
647 635 int _sasl_iptostring(const struct sockaddr *addr, socklen_t addrlen,
648 636 char *out, unsigned outlen);
649 637 int _sasl_ipfromstring(const char *addr, struct sockaddr *out,
650 638 socklen_t outlen);
651 639
652 640 /*
653 641 * external plugin (external.c)
654 642 */
655 643 int external_client_plug_init(const sasl_utils_t *utils,
656 644 int max_version,
657 645 int *out_version,
658 646 sasl_client_plug_t **pluglist,
659 647 int *plugcount);
660 648 int external_server_plug_init(const sasl_utils_t *utils,
661 649 int max_version,
662 650 int *out_version,
663 651 sasl_server_plug_t **pluglist,
664 652 int *plugcount);
665 653
666 654 /* Mech Listing Functions */
667 655 #ifdef _SUN_SDK_
668 656 int _sasl_build_mechlist(_sasl_global_context_t *gctx);
669 657 #else
670 658 int _sasl_build_mechlist(void);
671 659 #endif /* _SUN_SDK_ */
672 660
673 661 int _sasl_server_listmech(sasl_conn_t *conn,
674 662 const char *user,
675 663 const char *prefix,
676 664 const char *sep,
677 665 const char *suffix,
678 666 const char **result,
679 667 unsigned *plen,
680 668 int *pcount);
681 669 int _sasl_client_listmech(sasl_conn_t *conn,
682 670 const char *prefix,
683 671 const char *sep,
684 672 const char *suffix,
685 673 const char **result,
686 674 unsigned *plen,
687 675 int *pcount);
688 676 /* Just create a straight list of them */
689 677 #ifdef _SUN_SDK_
690 678 sasl_string_list_t *_sasl_client_mechs(_sasl_global_context_t *gctx);
691 679 sasl_string_list_t *_sasl_server_mechs(_sasl_global_context_t *gctx);
692 680 #else
693 681 sasl_string_list_t *_sasl_client_mechs(void);
694 682 sasl_string_list_t *_sasl_server_mechs(void);
695 683 #endif /* _SUN_SDK_ */
696 684
697 685 /*
698 686 * config file declarations (config.c)
699 687 */
700 688 #ifdef _SUN_SDK_
701 689 extern int sasl_config_init(_sasl_global_context_t *gctx,
702 690 const char *filename);
703 691 extern void sasl_config_free(_sasl_global_context_t *gctx);
704 692 extern const char *sasl_config_getstring(_sasl_global_context_t *gctx,
705 693 const char *key,const char *def);
706 694 extern int sasl_config_getint(_sasl_global_context_t *gctx,
707 695 const char *key,int def);
708 696 extern int sasl_config_getswitch(_sasl_global_context_t *gctx,
709 697 const char *key,int def);
710 698 #else
711 699 extern int sasl_config_init(const char *filename);
712 700 extern const char *sasl_config_getstring(const char *key,const char *def);
713 701 extern int sasl_config_getint(const char *key,int def);
714 702 extern int sasl_config_getswitch(const char *key,int def);
715 703 #endif /* _SUN_SDK_ */
716 704
717 705 /* checkpw.c */
718 706 #ifdef DO_SASL_CHECKAPOP
719 707 extern int _sasl_auxprop_verify_apop(sasl_conn_t *conn,
720 708 const char *userstr,
721 709 const char *challenge,
722 710 const char *response,
723 711 const char *user_realm);
724 712 #endif /* DO_SASL_CHECKAPOP */
725 713
726 714 /* Auxprop Plugin (checkpw.c) */
727 715 extern int sasldb_auxprop_plug_init(const sasl_utils_t *utils,
728 716 int max_version,
729 717 int *out_version,
730 718 sasl_auxprop_plug_t **plug,
731 719 const char *plugname);
732 720
733 721 /*
734 722 * auxprop.c
735 723 */
736 724 #ifdef _SUN_SDK_
737 725 extern void _sasl_auxprop_free(_sasl_global_context_t *gctx);
738 726 #else
739 727 extern int _sasl_auxprop_add_plugin(void *p, void *library);
740 728 extern void _sasl_auxprop_free(void);
741 729 #endif /* _SUN_SDK_ */
742 730 extern void _sasl_auxprop_lookup(sasl_server_params_t *sparams,
743 731 unsigned flags,
744 732 const char *user, unsigned ulen);
745 733
746 734 /*
747 735 * canonusr.c
748 736 */
749 737 #ifdef _SUN_SDK_
750 738 void _sasl_canonuser_free(_sasl_global_context_t *gctx);
751 739 #else
752 740 void _sasl_canonuser_free();
753 741 #endif /* _SUN_SDK_ */
754 742 extern int internal_canonuser_init(const sasl_utils_t *utils,
755 743 int max_version,
756 744 int *out_version,
757 745 sasl_canonuser_plug_t **plug,
758 746 const char *plugname);
759 747 extern int _sasl_canon_user(sasl_conn_t *conn,
760 748 const char *user, unsigned ulen,
761 749 unsigned flags,
762 750 sasl_out_params_t *oparams);
763 751
764 752 #ifdef _SUN_SDK_
765 753 /* Private functions to create, free, and use a private context */
766 754 void *sasl_create_context(void);
767 755
768 756 void sasl_free_context(void *context);
769 757
770 758 extern int _sasl_server_init(void *ctx, const sasl_callback_t *callbacks,
771 759 const char *appname);
772 760
773 761 extern int _sasl_server_new(void *ctx, const char *service,
774 762 const char *serverFQDN, const char *user_realm,
775 763 const char *iplocalport, const char *ipremoteport,
776 764 const sasl_callback_t *callbacks, unsigned flags,
777 765 sasl_conn_t **pconn);
778 766
779 767 extern int _sasl_client_init(void *ctx,
780 768 const sasl_callback_t *callbacks);
781 769
782 770 extern int _sasl_client_new(void *ctx,
783 771 const char *service,
784 772 const char *serverFQDN,
785 773 const char *iplocalport,
786 774 const char *ipremoteport,
787 775 const sasl_callback_t *prompt_supp,
788 776 unsigned flags,
789 777 sasl_conn_t **pconn);
790 778
791 779 extern int _sasl_client_add_plugin(void *ctx,
792 780 const char *plugname,
793 781 sasl_client_plug_init_t *cplugfunc);
794 782 extern int _sasl_server_add_plugin(void *ctx,
795 783 const char *plugname,
↓ open down ↓ |
478 lines elided |
↑ open up ↑ |
796 784 sasl_server_plug_init_t *splugfunc);
797 785 extern int _sasl_canonuser_add_plugin(void *ctx,
798 786 const char *plugname,
799 787 sasl_canonuser_init_t *canonuserfunc);
800 788 extern int _sasl_auxprop_add_plugin(void *ctx,
801 789 const char *plugname,
802 790 sasl_auxprop_init_t *auxpropfunc);
803 791
804 792 _sasl_global_context_t *_sasl_gbl_ctx(void);
805 793
806 -/* EXPORT DELETE START */
807 -/* CRYPT DELETE START */
808 794 #ifdef _INTEGRATED_SOLARIS_
809 795 int _is_sun_reg(void *mech);
810 796 #endif /* _INTEGRATED_SOLARIS_ */
811 -/* CRYPT DELETE END */
812 -/* EXPORT DELETE END */
813 797
814 798 /* unsupported functions that are used internally */
815 799 int sasl_randcreate(sasl_rand_t **rpool);
816 800
817 801 void sasl_randfree(sasl_rand_t **rpool);
818 802
819 803 void sasl_rand(sasl_rand_t *rpool, char *buf, unsigned len);
820 804
821 805 void sasl_churn(sasl_rand_t *rpool, const char *data, unsigned len);
822 806
823 807 int sasl_mkchal(sasl_conn_t *conn, char *buf, unsigned maxlen,
824 808 unsigned hostflag);
825 809 #endif /* _SUN_SDK_ */
826 810
827 811 #endif /* SASLINT_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX