nfs-ganesha 1.4
|
00001 /* 00002 Copyright (c) 2004 The Regents of the University of Michigan. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions 00007 are met: 00008 00009 1. Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 2. Redistributions in binary form must reproduce the above copyright 00012 notice, this list of conditions and the following disclaimer in the 00013 documentation and/or other materials provided with the distribution. 00014 3. Neither the name of the University nor the names of its 00015 contributors may be used to endorse or promote products derived 00016 from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00019 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00022 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00023 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00024 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00025 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00026 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00031 #ifdef HAVE_CONFIG_H 00032 #include <config.h> 00033 #endif /* HAVE_CONFIG_H */ 00034 00035 #include <stdio.h> 00036 #include <syslog.h> 00037 #include <string.h> 00038 #include <gssapi/gssapi.h> 00039 #include <rpc/rpc.h> 00040 #include <rpc/auth_gss.h> 00041 #include "gss_util.h" 00042 #include "gss_oids.h" 00043 #include "err_util.h" 00044 #include "context.h" 00045 00046 int 00047 serialize_context_for_kernel(gss_ctx_id_t ctx, 00048 gss_buffer_desc *buf, 00049 gss_OID mech, 00050 int32_t *endtime) 00051 { 00052 if (g_OID_equal(&krb5oid, mech)) 00053 return serialize_krb5_ctx(ctx, buf, endtime); 00054 #ifdef HAVE_SPKM3_H 00055 else if (g_OID_equal(&spkm3oid, mech)) 00056 return serialize_spkm3_ctx(ctx, buf, endtime); 00057 #endif 00058 else { 00059 printerr(0, "ERROR: attempting to serialize context with " 00060 "unknown/unsupported mechanism oid\n"); 00061 return -1; 00062 } 00063 }