1 /* rxgk/rxgk_server.c - server-specific security object routines */
3 * Copyright (C) 2013, 2014 by the Massachusetts Institute of Technology.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Server-specific security object routines.
36 #include <afsconfig.h>
37 #include <afs/param.h>
42 #include <rx/rx_packet.h>
45 #include "rxgk_private.h"
47 /* Pre-declare the securityclass routines for the securityOps definition. */
48 struct rx_securityClass *rxgk_NewServerSecurityObject(void *getkey_rock,
49 rxgk_getkey_func getkey);
50 static int rxgk_ServerClose(struct rx_securityClass *aobj);
51 static int rxgk_NewServerConnection(struct rx_securityClass *aobj,
52 struct rx_connection *aconn);
53 static int rxgk_ServerPreparePacket(struct rx_securityClass *aobj,
54 struct rx_call *acall,
55 struct rx_packet *apacket);
56 static int rxgk_CheckAuthentication(struct rx_securityClass *aobj,
57 struct rx_connection *aconn);
58 static int rxgk_CreateChallenge(struct rx_securityClass *aobj,
59 struct rx_connection *aconn);
60 static int rxgk_GetChallenge(struct rx_securityClass *aobj,
61 struct rx_connection *aconn,
62 struct rx_packet *apacket);
63 static int rxgk_CheckResponse(struct rx_securityClass *aobj,
64 struct rx_connection *aconn,
65 struct rx_packet *apacket);
66 static int rxgk_ServerCheckPacket(struct rx_securityClass *aobj,
67 struct rx_call *acall, struct rx_packet *apacket);
68 static int rxgk_DestroyServerConnection(struct rx_securityClass *aobj,
69 struct rx_connection *aconn);
70 static int rxgk_ServerGetStats(struct rx_securityClass *aobj,
71 struct rx_connection *aconn,
72 struct rx_securityObjectStats *astats);
75 static struct rx_securityOps rxgk_server_ops = {
77 rxgk_NewServerConnection,
78 rxgk_ServerPreparePacket, /* once per packet creation */
79 0, /* send packet (once per retrans) */
80 rxgk_CheckAuthentication,
85 rxgk_ServerCheckPacket, /* check data packet */
86 rxgk_DestroyServerConnection,
93 static struct rx_securityClass dummySC = {
99 struct rx_securityClass *
100 rxgk_NewServerSecurityObject(void *getkey_rock, rxgk_getkey_func getkey)
106 rxgk_ServerClose(struct rx_securityClass *aobj)
108 return RXGK_INCONSISTENCY;
112 rxgk_NewServerConnection(struct rx_securityClass *aobj, struct rx_connection *aconn)
114 return RXGK_INCONSISTENCY;
118 rxgk_ServerPreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
119 struct rx_packet *apacket)
121 return RXGK_INCONSISTENCY;
125 rxgk_CheckAuthentication(struct rx_securityClass *aobj,
126 struct rx_connection *aconn)
128 return RXGK_INCONSISTENCY;
132 rxgk_CreateChallenge(struct rx_securityClass *aobj,
133 struct rx_connection *aconn)
135 return RXGK_INCONSISTENCY;
139 rxgk_GetChallenge(struct rx_securityClass *aobj, struct rx_connection *aconn,
140 struct rx_packet *apacket)
142 return RXGK_INCONSISTENCY;
146 rxgk_CheckResponse(struct rx_securityClass *aobj,
147 struct rx_connection *aconn, struct rx_packet *apacket)
149 return RXGK_INCONSISTENCY;
153 rxgk_ServerCheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
154 struct rx_packet *apacket)
156 return RXGK_INCONSISTENCY;
160 rxgk_DestroyServerConnection(struct rx_securityClass *aobj,
161 struct rx_connection *aconn)
163 return RXGK_INCONSISTENCY;
167 rxgk_ServerGetStats(struct rx_securityClass *aobj, struct rx_connection *aconn,
168 struct rx_securityObjectStats *astats)
170 return RXGK_INCONSISTENCY;