rwrap: Fix a possible NULL dereference.
[Samba.git] / lib / krb5_wrap / gss_samba.c
blobb444633e280ee84333ce2d95aec88fe07e77c156
1 /*
2 * Unix SMB/CIFS implementation.
4 * Simple GSSAPI wrappers
6 * Copyright (c) 2012 Andreas Schneider <asn@samba.org>
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.
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.
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/>.
22 #include "includes.h"
23 #include "gss_samba.h"
25 #ifdef HAVE_GSSAPI
27 #if !defined(HAVE_GSS_OID_EQUAL)
28 int smb_gss_oid_equal(const gss_OID first_oid, const gss_OID second_oid)
30 if (first_oid == GSS_C_NO_OID || second_oid == GSS_C_NO_OID) {
31 return 0;
34 if (first_oid == second_oid) {
35 return 1;
38 if ((first_oid)->length != (second_oid)->length) {
39 return 0;
42 if (memcmp((first_oid)->elements, (second_oid)->elements,
43 (first_oid)->length) == 0) {
44 return 1;
47 return 0;
49 #endif /* !HAVE_GSS_OID_EQUAL */
51 #endif /* HAVE_GSSAPI */