WHATSNEW: add SmartCard/PKINIT improvements
[vlendec/samba-autobuild/.git] / lib / krb5_wrap / gss_samba.c
1 /*
2  *  Unix SMB/CIFS implementation.
3  *
4  *  Simple GSSAPI wrappers
5  *
6  *  Copyright (c) 2012      Andreas Schneider <asn@samba.org>
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #include "includes.h"
23 #include "gss_samba.h"
24
25 #ifdef HAVE_GSSAPI
26
27 #if !defined(HAVE_GSS_OID_EQUAL)
28 int smb_gss_oid_equal(const gss_OID first_oid, const gss_OID second_oid)
29 {
30         if (first_oid == GSS_C_NO_OID || second_oid == GSS_C_NO_OID) {
31                 return 0;
32         }
33
34         if (first_oid == second_oid) {
35                 return 1;
36         }
37
38         if ((first_oid)->length != (second_oid)->length) {
39                 return 0;
40         }
41
42         if (memcmp((first_oid)->elements, (second_oid)->elements,
43                    (first_oid)->length) == 0) {
44                 return 1;
45         }
46
47         return 0;
48 }
49 #endif /* !HAVE_GSS_OID_EQUAL */
50
51 #endif /* HAVE_GSSAPI */