]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/subversion/subversion/libsvn_ra_svn/wrapped_sasl.c
Update Apache Serf to 1.3.9 to support OpenSSL 1.1.1.
[FreeBSD/FreeBSD.git] / contrib / subversion / subversion / libsvn_ra_svn / wrapped_sasl.c
1 /*
2  * wrapped_sasl.c :  wrapped SASL API
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24 #include "svn_private_config.h"
25 #ifdef SVN_HAVE_SASL
26
27 #include "private/ra_svn_wrapped_sasl.h"
28
29 /* See the comment at the top of svn_wrapped_sasl.h */
30 #ifdef __APPLE__
31 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
32 #    pragma GCC diagnostic ignored "-Wdeprecated-declarations"
33 #  endif
34 #endif /* __APPLE__ */
35
36 void
37 svn_sasl__set_mutex(sasl_mutex_alloc_t *alloc,
38                     sasl_mutex_lock_t *lock,
39                     sasl_mutex_unlock_t *unlock,
40                     sasl_mutex_free_t *free)
41 {
42   sasl_set_mutex(alloc, lock, unlock, free);
43 }
44
45 void
46 svn_sasl__done(void)
47 {
48   sasl_done();
49 }
50
51 void
52 svn_sasl__dispose(sasl_conn_t **pconn)
53 {
54   sasl_dispose(pconn);
55 }
56
57 const char *
58 svn_sasl__errstring(int saslerr, const char *langlist, const char **outlang)
59 {
60   return sasl_errstring(saslerr, langlist, outlang);
61 }
62
63 const char *
64 svn_sasl__errdetail(sasl_conn_t *conn)
65 {
66   return sasl_errdetail(conn);
67 }
68
69 int
70 svn_sasl__getprop(sasl_conn_t *conn, int propnum, const void **pvalue)
71 {
72   return sasl_getprop(conn, propnum, pvalue);
73 }
74
75 int
76 svn_sasl__setprop(sasl_conn_t *conn, int propnum, const void *value)
77 {
78   return sasl_setprop(conn, propnum, value);
79 }
80
81 int
82 svn_sasl__client_init(const sasl_callback_t *callbacks)
83 {
84   return sasl_client_init(callbacks);
85 }
86
87 int
88 svn_sasl__client_new(const char *service,
89                      const char *serverFQDN,
90                      const char *iplocalport,
91                      const char *ipremoteport,
92                      const sasl_callback_t *prompt_supp,
93                      unsigned flags,
94                      sasl_conn_t **pconn)
95 {
96   return sasl_client_new(service, serverFQDN, iplocalport, ipremoteport,
97                          prompt_supp, flags, pconn);
98 }
99
100 int
101 svn_sasl__client_start(sasl_conn_t *conn,
102                        const char *mechlist,
103                        sasl_interact_t **prompt_need,
104                        const char **clientout,
105                        unsigned *clientoutlen,
106                        const char **mech)
107 {
108   return sasl_client_start(conn, mechlist, prompt_need,
109                            clientout, clientoutlen, mech);
110 }
111
112 int
113 svn_sasl__client_step(sasl_conn_t *conn,
114                       const char *serverin,
115                       unsigned serverinlen,
116                       sasl_interact_t **prompt_need,
117                       const char **clientout,
118                       unsigned *clientoutlen)
119 {
120   return sasl_client_step(conn, serverin, serverinlen, prompt_need,
121                           clientout, clientoutlen);
122 }
123
124 int
125 svn_sasl__server_init(const sasl_callback_t *callbacks,
126                       const char *appname)
127 {
128   return sasl_server_init(callbacks, appname);
129 }
130
131 int
132 svn_sasl__server_new(const char *service,
133                      const char *serverFQDN,
134                      const char *user_realm,
135                      const char *iplocalport,
136                      const char *ipremoteport,
137                      const sasl_callback_t *callbacks,
138                      unsigned flags,
139                      sasl_conn_t **pconn)
140 {
141   return sasl_server_new(service, serverFQDN, user_realm,
142                          iplocalport, ipremoteport, callbacks, flags, pconn);
143 }
144
145 int
146 svn_sasl__listmech(sasl_conn_t *conn,
147                    const char *user,
148                    const char *prefix,
149                    const char *sep,
150                    const char *suffix,
151                    const char **result,
152                    unsigned *plen,
153                    int *pcount)
154 {
155   return sasl_listmech(conn, user, prefix, sep, suffix, result, plen, pcount);
156 }
157
158 int
159 svn_sasl__server_start(sasl_conn_t *conn,
160                        const char *mech,
161                        const char *clientin,
162                        unsigned clientinlen,
163                        const char **serverout,
164                        unsigned *serveroutlen)
165 {
166   return sasl_server_start(conn, mech, clientin, clientinlen,
167                            serverout, serveroutlen);
168 }
169
170 int
171 svn_sasl__server_step(sasl_conn_t *conn,
172                       const char *clientin,
173                       unsigned clientinlen,
174                       const char **serverout,
175                       unsigned *serveroutlen)
176 {
177   return sasl_server_step(conn, clientin, clientinlen,
178                           serverout, serveroutlen);
179 }
180
181 int
182 svn_sasl__encode(sasl_conn_t *conn,
183                  const char *input, unsigned inputlen,
184                  const char **output, unsigned *outputlen)
185 {
186   return sasl_encode(conn, input, inputlen, output, outputlen);
187 }
188
189 int
190 svn_sasl__decode(sasl_conn_t *conn,
191                  const char *input, unsigned inputlen,
192                  const char **output, unsigned *outputlen)
193 {
194   return sasl_decode(conn, input, inputlen, output, outputlen);
195 }
196
197 #endif /* SVN_HAVE_SASL */