/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* canonusr.c - user canonicalization support
* Rob Siemborski
* $Id: canonusr.c,v 1.12 2003/02/13 19:55:53 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.
*/
#include <config.h>
#include <sasl.h>
#include <string.h>
#include <ctype.h>
#include <prop.h>
#include <stdio.h>
#include "saslint.h"
typedef struct canonuser_plug_list
{
#ifdef _SUN_SDK_
char *name;
#else
#endif /* _SUN_SDK_ */
#ifndef _SUN_SDK_
#endif /* !_SUN_SDK_ */
/* default behavior:
* eliminate leading & trailing whitespace,
* null-terminate, and get into the outparams
*
* (handled by INTERNAL plugin) */
/* Also does auxprop lookups once username is canonoicalized */
/* a zero ulen or alen indicates that it is strlen(value) */
unsigned flags,
{
void *context;
int result;
char *user_buf;
unsigned *lenp;
if(!conn) return SASL_BADPARAM;
if(flags & SASL_CU_AUTHID) {
} else if (flags & SASL_CU_AUTHZID) {
} else {
return SASL_BADPARAM;
}
else return SASL_FAIL;
/* check to see if we have a callback to make*/
NULL),
/* Point the input copy at the stored buffer */
}
/* which plugin are we supposed to use? */
}
if(!plugin_name) {
/* Use Defualt */
plugin_name = "INTERNAL";
}
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
/* A match is if we match the internal name of the plugin, or if
* we match the filename (old-style) */
}
/* We clearly don't have this one! */
if(!ptr) {
#ifdef _INTEGRATED_SOLARIS_
sasl_seterror(conn, 0,
gettext("desired canon_user plugin %s not found"),
else
"desired canon_user plugin %s not found",
#else
#endif /* _INTEGRATED_SOLARIS_ */
return SASL_NOMECH;
}
if(sconn) {
/* we're a server */
} else {
/* we're a client */
}
/* We did both, so we need to copy the result into
* the buffer for the authzid from the buffer for the authid */
}
/* Set the appropriate oparams (lengths have already been set by lenp) */
if(flags & SASL_CU_AUTHID) {
}
if (flags & SASL_CU_AUTHZID) {
}
#ifndef macintosh
/* do auxprop lookups (server only) */
if(sconn) {
if(flags & SASL_CU_AUTHID) {
}
if(flags & SASL_CU_AUTHZID) {
}
}
#endif
#ifdef _SUN_SDK_
return (SASL_OK);
#else
#endif /* _SUN_SDK_ */
}
#ifdef _SUN_SDK_
{
}
}
#else
void _sasl_canonuser_free()
{
}
}
#endif /* _SUN_SDK_ */
#ifdef _SUN_SDK_
{
}
const char *plugname,
#else
int sasl_canonuser_add_plugin(const char *plugname,
#endif /* _SUN_SDK_ */
{
#ifdef _SUN_SDK_
/* Check to see if this plugin has already been registered */
return SASL_OK;
}
}
#endif /* _SUN_SDK_ */
sasl_seterror(NULL, 0,
"bad plugname passed to sasl_canonuser_add_plugin\n");
return SASL_BADPARAM;
}
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
return result;
}
/* We need atleast one of these implemented */
#ifdef _SUN_SDK_
"canonuser plugin without either client or server side");
#else
"canonuser plugin without either client or server side");
#endif /* _SUN_SDK_ */
return SASL_BADPROT;
}
#ifdef _SUN_SDK_
/* Check plugin to make sure name is non-NULL */
return SASL_BADPROT;
}
#endif /* _SUN_SDK_ */
if(!new_item) return SASL_NOMEM;
#ifdef _SUN_SDK_
return SASL_NOMEM;
}
#else
#endif /* _SUN_SDK_ */
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
return SASL_OK;
}
#ifdef MIN
#endif
#define MIN(a,b) (((a) < (b))? (a):(b))
char *out_user,
{
unsigned i;
const char *begin_u;
unsigned u_apprealm = 0;
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
if(!in_buf) return SASL_NOMEM;
/* Strip User ID */
if(i>0) ulen -= i;
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
#ifdef _INTEGRATED_SOLARIS_
#else
#endif /* _INTEGRATED_SOLARIS_ */
return SASL_FAIL;
}
/* Need to append realm if necessary (see sasl.h) */
}
/* Now Copy */
if(sconn && u_apprealm) {
}
#ifdef _SUN_SDK_
#else
#endif /* _SUN_SDK_ */
return SASL_OK;
}
unsigned flags,
char *out_user,
{
}
unsigned flags,
char *out_user,
{
}
0, /* features */
0, /* spare */
NULL, /* glob_context */
"INTERNAL", /* name */
NULL, /* canon_user_free */
NULL,
NULL,
};
int max_version,
int *out_version,
{
return SASL_OK;
}