Print this page
10116 mech_dh needs smatch fixes
*** 24,34 ****
*
* Copyright (c) 1997, by Sun Microsystems, Inc.
* All rights reserved.
*/
! #pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <dh_gssapi.h>
--- 24,36 ----
*
* Copyright (c) 1997, by Sun Microsystems, Inc.
* All rights reserved.
*/
! /*
! * Copyright (c) 2018, Joyent, Inc.
! */
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <dh_gssapi.h>
*** 102,112 ****
static int init_nis_pubkey = 0;
static int (*nis_call)();
static const char NIS_SYMBOL[] = "__rpcsec_gss_is_server";
if (!init_nis_pubkey) {
! mutex_lock(&init_nis_pubkey_lock);
if (!init_nis_pubkey) {
void *dlhandle = dlopen(0, RTLD_NOLOAD);
if (dlhandle == 0) {
syslog(LOG_ERR, "dh: Could not dlopen "
"in dh_getpublickey for %s. "
--- 104,114 ----
static int init_nis_pubkey = 0;
static int (*nis_call)();
static const char NIS_SYMBOL[] = "__rpcsec_gss_is_server";
if (!init_nis_pubkey) {
! (void) mutex_lock(&init_nis_pubkey_lock);
if (!init_nis_pubkey) {
void *dlhandle = dlopen(0, RTLD_NOLOAD);
if (dlhandle == 0) {
syslog(LOG_ERR, "dh: Could not dlopen "
"in dh_getpublickey for %s. "
*** 115,125 ****
nis_call = (int (*)())
dlsym(dlhandle, NIS_SYMBOL);
}
init_nis_pubkey = 1;
}
! mutex_unlock(&init_nis_pubkey_lock);
}
if (nis_call && (*nis_call)()) {
int key_cached;
return (__getpublickey_cached_g(remote, keylen, algtype,
pk, pklen, &key_cached));
--- 117,127 ----
nis_call = (int (*)())
dlsym(dlhandle, NIS_SYMBOL);
}
init_nis_pubkey = 1;
}
! (void) mutex_unlock(&init_nis_pubkey_lock);
}
if (nis_call && (*nis_call)()) {
int key_cached;
return (__getpublickey_cached_g(remote, keylen, algtype,
pk, pklen, &key_cached));