/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* saslint.h - internal SASL library definitions
* Rob Siemborski
* Tim Martin
* $Id: saslint.h,v 1.48 2003/04/16 19:36:01 rjs3 Exp $
*/
/*
* Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef SASLINT_H
#define SASLINT_H
#include <config.h>
#include "sasl.h"
#include "saslplug.h"
#include "saslutil.h"
#include "prop.h"
/* #define'd constants */
/* Error Handling Foo */
/* Helpful Hints:
* -Error strings are set as soon as possible (first function in stack trace
* with a pointer to the sasl_conn_t.
* -Error codes are set as late as possible (only in the sasl api functions),
* thoug "as often as possible" also comes to mind to ensure correctness
* -Errors from calls to _buf_alloc, _sasl_strdup, etc are assumed to be
* memory errors.
* -Only errors (error codes < SASL_OK) should be remembered
*/
return (val); }
__LINE__ ); \
#else
#endif
#ifndef PATH_MAX
# ifdef WIN32
# else
# ifdef _POSIX_PATH_MAX
# else
* probably only be 256+64 on
* pre-posix machines */
# endif /* _POSIX_PATH_MAX */
# endif /* WIN32 */
#endif
/* : Define directory delimiter in SASL_PATH variable */
#ifdef WIN32
#else
#endif
/* Datatype Definitions */
typedef struct {
const char *appname;
#ifdef _SUN_SDK_
#endif /* _SUN_SDK_ */
typedef struct _sasl_external_properties
{
char *auth_id;
typedef struct sasl_string_list
{
const char *d;
typedef struct buffer_info
{
char *data;
#ifdef _SUN_SDK_
const char *, void *);
#else
typedef int add_plugin_t(const char *, void *);
#endif /* _SUN_SDK_ */
typedef struct add_plugin_list
{
const char *entryname;
struct sasl_conn {
char *service;
/* IP information. A buffer of size 52 is adequate for this in its
longest format (see sasl.h) */
void *context;
#ifndef _SUN_SDK_
#endif /* !_SUN_SDK_ */
* connection */
char *serverFQDN;
/* Pointers to memory that we are responsible for */
int error_code;
char *mechlist_buf;
char *decode_buf;
#ifdef _SUN_SDK_
#ifdef _INTEGRATED_SOLARIS_
int sun_reg;
#endif /* _INTEGRATED_SOLARIS_ */
#endif /* _SUN_SDK_ */
};
#ifdef _SUN_SDK_
/* track changes in file system */
typedef struct _sasl_path_info {
char *path;
#endif /* _SUN_SDK_ */
/* Server Conn Type Information */
typedef struct mechanism
{
int version;
set to SASL_CONTINUE if delayed plugn loading */
#ifdef _SUN_SDK_
#ifdef _INTEGRATED_SOLARIS_
int sun_reg;
#endif /* _INTEGRATED_SOLARIS_ */
/*
* The global context needs to be stored with separately from the
* the plugin because it will be overwritten when the plugin is
* relloaded
*/
void *glob_context;
#else
char *f; /* where should i load the mechanism from? */
#endif /* _SUN_SDK_ */
} mechanism_t;
typedef struct mech_list {
} mech_list_t;
typedef struct context_list
{
* otherwise, use this context instead of a call
* to mech_new */
typedef struct sasl_server_conn {
int authenticated;
/* Client Conn Type Information */
typedef struct cmechanism
{
int version;
char *plugname;
#ifdef _SUN_SDK_
#ifdef _INTEGRATED_SOLARIS_
int sun_reg;
#endif /* _INTEGRATED_SOLARIS_ */
/*
* The global context needs to be stored with separately from the
* the plugin because it will be overwritten when the plugin is
* relloaded
*/
void *glob_context;
#else
#endif /* _SUN_SDK_ */
} cmechanism_t;
typedef struct cmech_list {
} cmech_list_t;
typedef struct sasl_client_conn {
char *clientFQDN;
typedef struct sasl_allocation_utils {
typedef struct sasl_mutex_utils {
typedef struct sasl_log_utils_s {
#ifdef _SUN_SDK_
/*
* The following structure contains the global state for libsasl */
typedef struct _sasl_global_context_s {
int sasl_server_active;
/* sasl server init'ed */
/* list of server mechs */
/* path info for server plugins */
/* callbacks for sasl_server_init */
int (*sasl_server_cleanup_hook)
(struct _sasl_global_context_s *gctx);
/* entry point to clean up sasl server */
/* entry point for sasl server idle */
/* list of client mechs */
/* path info for client plugins */
/* callbacks for sasl_client_init */
int sasl_client_active;
/* sasl client init'ed */
int (*sasl_client_cleanup_hook)
(struct _sasl_global_context_s *gctx);
/* entry point to clean up sasl client */
/* entry point for sasl client idle */
/* sasl server global utils */
/* sasl global utils for canonusr plugin */
void *configlist;
/* Configuration key value pair data list */
int nconfiglist;
/* number of items in configlist */
char *config_path;
/* last read config path */
/* last time config read */
void *auxprop_head;
/* Head of auxprop plugin list */
void *canonuser_head;
/* Head of canonusr plugin list */
char **global_mech_list;
/* Global list of mechanisms */
void *free_mutex;
/* sasl_done()/sasl_dispose() mutex */
/* malloc et al */
/* mutex_alloc et al */
void *lib_list_head;
/* list of dynamic libs opened */
#endif /* _SUN_SDK_ */
const char *userid,
const char *passwd,
const char *service,
const char *user_realm);
struct sasl_verify_password_s {
char *name;
};
/*
* globals & constants
*/
/*
* common.c
*/
#ifndef _SUN_SDK_
/* These return SASL_OK if we've actually finished cleanup,
* SASL_NOTINIT if that part of the library isn't inited, and
* SASL_CONTINUE if we need to call them again */
extern int (*_sasl_client_cleanup_hook)(void);
extern int (*_sasl_server_cleanup_hook)(void);
extern sasl_mutex_utils_t _sasl_mutex_utils;
#endif /* !_SUN_SDK_ */
/*
*/
extern struct sasl_verify_password_s _sasl_verify_password[];
/*
* server.c
*/
/* (this is a function call to ensure this is read-only to the outside) */
#ifdef _SUN_SDK_
#else
extern int _is_sasl_server_active(void);
#endif /* _SUN_SDK_ */
/*
* Allocation and Mutex utility macros
*/
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
/* function prototypes */
/*
* dlopen.c and staticopen.c
*/
/*
* The differences here are:
* _sasl_load_plugins loads all plugins from all files
* _sasl_get_plugin loads the LIBRARY for an individual file
* _sasl_done_with_plugins frees the LIBRARIES loaded by the above 2
* _sasl_locate_entry locates an entrypoint in a given library
*/
#ifdef _SUN_SDK_
int server,
const add_plugin_list_t *entrypoints,
const sasl_callback_t *getpath_callback,
const sasl_callback_t *verifyfile_callback);
const char *file,
const sasl_callback_t *verifyfile_cb,
void **libraryptr);
void **entry_point);
#else
const sasl_callback_t *getpath_callback,
const sasl_callback_t *verifyfile_callback);
extern int _sasl_get_plugin(const char *file,
const sasl_callback_t *verifyfile_cb,
void **libraryptr);
void **entry_point);
extern int _sasl_done_with_plugins();
#endif /* _SUN_SDK_ */
/*
* common.c
*/
extern const sasl_callback_t *
extern const sasl_callback_t *
#ifdef _SUN_SDK_
extern const sasl_callback_t *
int server);
#else
#endif /* _SUN_SDK_ */
const char *service,
unsigned int flags,
enum Sasl_conn_type type,
const char *serverFQDN,
const char *iplocalport,
const char *ipremoteport,
const sasl_callback_t *callbacks,
const sasl_global_callbacks_t *global_callbacks);
#ifdef _SUN_SDK_
extern sasl_utils_t *
#else
extern sasl_utils_t *
#endif /* _SUN_SDK_ */
extern int
unsigned long callbackid,
int (**pproc)(),
void **pcontext);
extern void
int level,
const char *fmt,
...);
#ifdef _SUN_SDK_
extern void
const sasl_callback_t *callbacks,
int level,
const char *fmt,
...);
#endif /* _SUN_SDK_ */
#ifdef _SUN_SDK_
/* More Generic Utilities in common.c */
/* Basically a conditional call to realloc(), if we need more */
#else
/* More Generic Utilities in common.c */
/* Basically a conditional call to realloc(), if we need more */
#endif /* _SUN_SDK_ */
/* convert an iovec to a single buffer */
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
/* Convert between string formats and sockaddr formats */
/*
* external plugin (external.c)
*/
int max_version,
int *out_version,
int *plugcount);
int max_version,
int *out_version,
int *plugcount);
/* Mech Listing Functions */
#ifdef _SUN_SDK_
#else
int _sasl_build_mechlist(void);
#endif /* _SUN_SDK_ */
const char *user,
const char *prefix,
const char *sep,
const char *suffix,
const char **result,
unsigned *plen,
int *pcount);
const char *prefix,
const char *sep,
const char *suffix,
const char **result,
unsigned *plen,
int *pcount);
/* Just create a straight list of them */
#ifdef _SUN_SDK_
#else
sasl_string_list_t *_sasl_client_mechs(void);
sasl_string_list_t *_sasl_server_mechs(void);
#endif /* _SUN_SDK_ */
/*
* config file declarations (config.c)
*/
#ifdef _SUN_SDK_
const char *filename);
#else
extern int sasl_config_init(const char *filename);
#endif /* _SUN_SDK_ */
/* checkpw.c */
#ifdef DO_SASL_CHECKAPOP
const char *userstr,
const char *challenge,
const char *response,
const char *user_realm);
#endif /* DO_SASL_CHECKAPOP */
/* Auxprop Plugin (checkpw.c) */
int max_version,
int *out_version,
const char *plugname);
/*
*/
#ifdef _SUN_SDK_
#else
extern int _sasl_auxprop_add_plugin(void *p, void *library);
extern void _sasl_auxprop_free(void);
#endif /* _SUN_SDK_ */
unsigned flags,
/*
*/
#ifdef _SUN_SDK_
#else
void _sasl_canonuser_free();
#endif /* _SUN_SDK_ */
int max_version,
int *out_version,
const char *plugname);
unsigned flags,
#ifdef _SUN_SDK_
/* Private functions to create, free, and use a private context */
void *sasl_create_context(void);
void sasl_free_context(void *context);
const char *appname);
const char *serverFQDN, const char *user_realm,
const char *iplocalport, const char *ipremoteport,
sasl_conn_t **pconn);
extern int _sasl_client_init(void *ctx,
const sasl_callback_t *callbacks);
extern int _sasl_client_new(void *ctx,
const char *service,
const char *serverFQDN,
const char *iplocalport,
const char *ipremoteport,
const sasl_callback_t *prompt_supp,
unsigned flags,
sasl_conn_t **pconn);
extern int _sasl_client_add_plugin(void *ctx,
const char *plugname,
extern int _sasl_server_add_plugin(void *ctx,
const char *plugname,
extern int _sasl_canonuser_add_plugin(void *ctx,
const char *plugname,
extern int _sasl_auxprop_add_plugin(void *ctx,
const char *plugname,
_sasl_global_context_t *_sasl_gbl_ctx(void);
#ifdef _INTEGRATED_SOLARIS_
int _is_sun_reg(void *mech);
#endif /* _INTEGRATED_SOLARIS_ */
/* unsupported functions that are used internally */
unsigned hostflag);
#endif /* _SUN_SDK_ */
#endif /* SASLINT_H */