diff options
Diffstat (limited to 'usr/src/lib/libnisdb')
38 files changed, 321 insertions, 135 deletions
diff --git a/usr/src/lib/libnisdb/Makefile b/usr/src/lib/libnisdb/Makefile index 08d1cf8ad8..7af72f8452 100644 --- a/usr/src/lib/libnisdb/Makefile +++ b/usr/src/lib/libnisdb/Makefile @@ -19,6 +19,7 @@ # CDDL HEADER END # # +# Copyright 2015 Gary Mills # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -134,18 +135,44 @@ LARGEPICS= $(LARGESYMS:%=pics/%) $(LARGEPICS) := sparc_C_PICFLAGS = $(C_BIGPICFLAGS) $(LARGEPICS) := i386_C_PICFLAGS = $(C_BIGPICFLAGS) +# More and stricter semantic checks and lint-like checks +CFLAGS += $(CCVERBOSE) + CPPFLAGS += -D_REENTRANT -CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-unused-value +# Have an unused variable that can't be removed +UVAR_PICS = \ +pics/db_dictionary_c_xdr.o \ +pics/db_dictlog_c_xdr.o \ +pics/db_entry_c_xdr.o \ +pics/db_index_c_xdr.o \ +pics/db_item_c_xdr.o \ +pics/db_log_entry_c_xdr.o \ +pics/db_mindex_c_xdr.o \ +pics/db_query_c_xdr.o \ +pics/db_scheme_c_xdr.o \ +pics/db_table_c_xdr.o \ +pics/db_vers_c_xdr.o \ +pics/ldap_xdr.o \ +pics/dit_access.o \ +pics/update.o \ +pics/yptol_utils.o \ +pics/map_ctrl.o + +$(UVAR_PICS) := CERRWARN += -_gcc=-Wno-unused-variable + +# Correcting these might alter logic CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-parentheses # Extra includes, from yp, for yptol files. CPPFLAGS += -I$(SRC)/cmd/ypcmd +# Need the path to nis_clnt.h +CLNT_PICS = pics/db_entry_c_xdr.o pics/ldap_xdr.o pics/db_mindex_c_xdr.o + +$(CLNT_PICS) := CPPFLAGS += -I../libnsl/nis/gen + LIBS = $(DYNLIB) ZDEFS= LDLIBS += -lnsl -lldap -lc diff --git a/usr/src/lib/libnisdb/db_dictionary_c.x b/usr/src/lib/libnisdb/db_dictionary_c.x index 1948cbdcc7..598aa7b786 100644 --- a/usr/src/lib/libnisdb/db_dictionary_c.x +++ b/usr/src/lib/libnisdb/db_dictionary_c.x @@ -22,11 +22,14 @@ /* * db_dictionary_c.x * + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -%#pragma ident "%Z%%M% %I% %E% SMI" +#if RPC_XDR +%#include "xdr_nullptr.h" +#endif /* RPC_XDR */ #if RPC_HDR %#ifndef _DB_DICTIONARY_H diff --git a/usr/src/lib/libnisdb/db_dictxdr.c b/usr/src/lib/libnisdb/db_dictxdr.c index 2fb09e26cc..a9e272ba2a 100644 --- a/usr/src/lib/libnisdb/db_dictxdr.c +++ b/usr/src/lib/libnisdb/db_dictxdr.c @@ -22,13 +22,13 @@ /* * db_dictxdr.c * + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "db_dictionary_c.h" +#include "db_dictionary.h" #include "db_vers_c.h" extern vers db_update_version; diff --git a/usr/src/lib/libnisdb/db_entry_c.x b/usr/src/lib/libnisdb/db_entry_c.x index bbc520a173..e64ddb00c6 100644 --- a/usr/src/lib/libnisdb/db_entry_c.x +++ b/usr/src/lib/libnisdb/db_entry_c.x @@ -22,12 +22,11 @@ /* * db_entry_c.x * + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -%#pragma ident "%Z%%M% %I% %E% SMI" - /* * Some manifest constants, chosen to maximize flexibility without * plugging the wire full of data. @@ -40,6 +39,10 @@ %#include <rpcsvc/nis.h> #endif /* RPC_HDR */ +#if RPC_XDR +%#include "nis_clnt.h" +#endif /* RPC_XDR */ + #ifdef USINGC enum db_status {DB_SUCCESS, DB_NOTFOUND, DB_NOTUNIQUE, DB_BADTABLE, DB_BADQUERY, DB_BADOBJECT, diff --git a/usr/src/lib/libnisdb/db_index_c.x b/usr/src/lib/libnisdb/db_index_c.x index c8aeae69c9..75e9eeecdc 100644 --- a/usr/src/lib/libnisdb/db_index_c.x +++ b/usr/src/lib/libnisdb/db_index_c.x @@ -21,10 +21,15 @@ /* * db_index_c.x * + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#if RPC_XDR +%#include "ldap_xdr.h" +#endif /* RPC_XDR */ + #if RPC_HDR %#ifndef _DB_INDEX_H %#define _DB_INDEX_H diff --git a/usr/src/lib/libnisdb/db_index_entry_c.c b/usr/src/lib/libnisdb/db_index_entry_c.c index 0a8067782a..f1ea9e6921 100644 --- a/usr/src/lib/libnisdb/db_index_entry_c.c +++ b/usr/src/lib/libnisdb/db_index_entry_c.c @@ -19,13 +19,16 @@ * * CDDL HEADER END */ + +/* + * Copyright 2015 Gary Mills + */ + /* * This is a non-recursive version of XDR routine used for db_index_entry * type. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/syslog.h> #include <stdio.h> @@ -34,6 +37,7 @@ #include <memory.h> #include "db_index_entry_c.h" #include "db_table_c.h" +#include "xdr_nullptr.h" bool_t xdr_db_index_entry(xdrs, objp) diff --git a/usr/src/lib/libnisdb/db_mindex3.cc b/usr/src/lib/libnisdb/db_mindex3.cc index 886487f8c5..d3db240b3c 100644 --- a/usr/src/lib/libnisdb/db_mindex3.cc +++ b/usr/src/lib/libnisdb/db_mindex3.cc @@ -19,8 +19,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 RackTop Systems. */ #include <sys/types.h> @@ -214,7 +217,7 @@ db_mindex::entriesFromLDAP(__nis_table_mapping_t *t, db_query *qin, db_query *q, logmsg(MSG_NOTIMECHECK, LOG_WARNING, "%s: Error %d creating new thread; using current one", myself, stat); - stat = (int)entriesFromLDAPthread(arg); + stat = entriesFromLDAPreal(arg); return (stat); } @@ -257,7 +260,7 @@ db_mindex::entriesFromLDAP(__nis_table_mapping_t *t, db_query *qin, db_query *q, #endif /* FORCE_SYNCHRONOUS */ } else { (void) mutex_unlock(&table->mapping.enumLock); - stat = (int)entriesFromLDAPthread(arg); + stat = entriesFromLDAPreal(arg); } return (stat); @@ -273,7 +276,6 @@ extern "C" { static void * entriesFromLDAPthread(void *voidarg) { __entries_from_ldap_arg_t *arg; - int stat; db *dbase; db_table_desc *tbl = 0; char *tableName; @@ -311,7 +313,7 @@ entriesFromLDAPthread(void *voidarg) { tableName = 0; } - stat = entriesFromLDAPreal(arg); + (void) entriesFromLDAPreal(arg); (void) __nis_ulock_db_table(arg->tableName, 1, 0, "entriesFromLDAPthread"); @@ -320,7 +322,7 @@ entriesFromLDAPthread(void *voidarg) { if (arg->dirObj != 0) nis_destroy_object(arg->dirObj); sfree(arg); - return ((void *)stat); + return (NULL); } } diff --git a/usr/src/lib/libnisdb/db_mindex_c.x b/usr/src/lib/libnisdb/db_mindex_c.x index 2b7c7d2242..acb6309fbe 100644 --- a/usr/src/lib/libnisdb/db_mindex_c.x +++ b/usr/src/lib/libnisdb/db_mindex_c.x @@ -21,10 +21,16 @@ /* * db_mindex_c.x * + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#if RPC_XDR +%#include "ldap_xdr.h" +%#include "nis_clnt.h" +#endif /* RPC_XDR */ + #if RPC_HDR %#ifndef _DB_MINDEX_H %#define _DB_MINDEX_H @@ -89,7 +95,6 @@ struct xdr_nis_object_s { }; typedef struct xdr_nis_object_s xdr_nis_object_t; -%extern bool_t xdr_nis_object(); #endif /* USINGC */ #endif /* RPC_HDR */ @@ -106,8 +111,6 @@ typedef struct xdr_nis_object_s xdr_nis_object_t; %}; %typedef struct xdr_nis_object_s xdr_nis_object_t; % -%extern bool_t xdr_nis_object(); -% %class db_mindex { % vers rversion; %// int num_indices; diff --git a/usr/src/lib/libnisdb/db_scheme_c.x b/usr/src/lib/libnisdb/db_scheme_c.x index 8408f4e22b..391d707670 100644 --- a/usr/src/lib/libnisdb/db_scheme_c.x +++ b/usr/src/lib/libnisdb/db_scheme_c.x @@ -22,11 +22,14 @@ /* * db_scheme_c.x * + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -%#pragma ident "%Z%%M% %I% %E% SMI" +#if RPC_XDR +%#include "ldap_xdr.h" +#endif /* RPC_XDR */ #if RPC_HDR %#ifndef _DB_SCHEMA_H diff --git a/usr/src/lib/libnisdb/db_table.cc b/usr/src/lib/libnisdb/db_table.cc index 2995f1a9c9..f4eb620237 100644 --- a/usr/src/lib/libnisdb/db_table.cc +++ b/usr/src/lib/libnisdb/db_table.cc @@ -24,6 +24,8 @@ * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 RackTop Systems. */ #include <stdio.h> @@ -74,7 +76,7 @@ __setMaxTimeT(void) (void) memcpy(&maxTimeT, b, sizeof (time_t)); if (maxTimeT < 1) - maxTimeT = ~(1<<((8*sizeof (maxTimeT))-1)); + maxTimeT = ~(1L<<((8*sizeof (maxTimeT))-1)); } #pragma init(__setMaxTimeT) } diff --git a/usr/src/lib/libnisdb/db_vers_c.x b/usr/src/lib/libnisdb/db_vers_c.x index 1d8f37b453..b2e85dc6b1 100644 --- a/usr/src/lib/libnisdb/db_vers_c.x +++ b/usr/src/lib/libnisdb/db_vers_c.x @@ -22,11 +22,14 @@ /* * db_vers_c.x * + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -%#pragma ident "%Z%%M% %I% %E% SMI" +#if RPC_XDR +%#include "ldap_xdr.h" +#endif /* RPC_XDR */ #if RPC_HDR %#ifndef _DB_VERS_H diff --git a/usr/src/lib/libnisdb/ldap_attr.c b/usr/src/lib/libnisdb/ldap_attr.c index 7513852621..f0e017558e 100644 --- a/usr/src/lib/libnisdb/ldap_attr.c +++ b/usr/src/lib/libnisdb/ldap_attr.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/systeminfo.h> #include <strings.h> #include <rpcsvc/nis.h> @@ -215,7 +214,7 @@ makeFilter(char *attr) { } for (s = c = 0; s < len; s = e+1) { /* Skip blank space, if any */ - for (0; str[s] == ' ' || str[s] == '\t'; s++); + for (; str[s] == ' ' || str[s] == '\t'; s++); /* Find delimiter (comma) or end of string */ for (e = s; str[e] != '\0' && str[e] != ','; e++); str[e] = '\0'; @@ -285,7 +284,7 @@ makeFilterComp(char *filter, int *numComps) { return (0); for (s = 2; s < len; s = e+1) { /* Skip past the '(' */ - for (0; s < len && str[s] != '('; s++); + for (; s < len && str[s] != '('; s++); s++; if (s >= len) break; diff --git a/usr/src/lib/libnisdb/ldap_map.c b/usr/src/lib/libnisdb/ldap_map.c index c251adb5bc..7da24e8877 100644 --- a/usr/src/lib/libnisdb/ldap_map.c +++ b/usr/src/lib/libnisdb/ldap_map.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1240,7 +1241,7 @@ selectTableMapping(__nis_table_mapping_t *t, db_query *q, int wantWrite, int wantObj, char *dbId, int *numMatches) { __nis_table_mapping_t *r, *x, **tp; - int i, j, k, nm, numap; + int i, nm, numap; char *myself = "selectTableMapping"; if (numMatches == 0) @@ -1419,8 +1420,6 @@ extern bool_t xdr_nis_object(register XDR *xdrs, nis_object *objp); int objToLDAP(__nis_table_mapping_t *t, nis_object *o, entry_obj **ea, int numEa) { __nis_table_mapping_t **tp; - XDR xdr; - char *objName; int stat, osize, n, numMatches = 0; void *buf; __nis_rule_value_t *rv; @@ -1545,7 +1544,6 @@ int objFromLDAP(__nis_table_mapping_t *t, nis_object **obj, entry_obj ***eaP, int *numEaP) { __nis_table_mapping_t **tp; - XDR xdr; nis_object *o; __nis_rule_value_t *rv; __nis_ldap_search_t *ls; diff --git a/usr/src/lib/libnisdb/ldap_nisdbquery.c b/usr/src/lib/libnisdb/ldap_nisdbquery.c index 5023496337..2688d9200e 100644 --- a/usr/src/lib/libnisdb/ldap_nisdbquery.c +++ b/usr/src/lib/libnisdb/ldap_nisdbquery.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -41,6 +42,7 @@ #include "ldap_nisdbquery.h" #include "ldap_attr.h" #include "ldap_xdr.h" +#include "ldap_ldap.h" item * @@ -224,7 +226,7 @@ createQuery(int num, char **index, __nis_table_mapping_t *t, __nis_rule_value_t **rvP, int *numVals) { db_query **q; db_qcomp *qc; - int i, j, n, a, nv, niv, stat, sinum; + int i, j, n, a, nv, niv; __nis_rule_value_t *rvq; __nis_buffer_t b = {0, 0}; char *table = 0; @@ -257,7 +259,6 @@ createQuery(int num, char **index, __nis_table_mapping_t *t, /* Create a rule-value from the col=val pairs */ for (n = 0; n < num; n++) { - char *name; char *value; if ((value = strchr(index[n], '=')) == 0) { @@ -272,7 +273,6 @@ createQuery(int num, char **index, __nis_table_mapping_t *t, for (a = 0; a < t->numColumns; a++) { if (strcmp(index[n], t->column[a]) == 0) { - int i, len = slen(value)+1; /* Add col=val pair to 'rvq' */ if (addSCol2RuleValue(index[n], value, rvq)) { @@ -692,7 +692,7 @@ createNisPlusEntry(__nis_table_mapping_t *t, __nis_rule_value_t *rv, __nis_value_t *rval, *lval; __nis_mapping_item_t *litem; int numItems; - int nq, iqc; + int nq; __nis_obj_attr_t **attr = 0; char **dn = 0; int numDN = 0; diff --git a/usr/src/lib/libnisdb/ldap_op.c b/usr/src/lib/libnisdb/ldap_op.c index 4caac35eba..935dea8114 100644 --- a/usr/src/lib/libnisdb/ldap_op.c +++ b/usr/src/lib/libnisdb/ldap_op.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -515,7 +516,6 @@ ldapInit(char *srv, int port, bool_t use_ssl) { int derefOption = LDAP_DEREF_ALWAYS; int timelimit = proxyInfo.search_time_limit; int sizelimit = proxyInfo.search_size_limit; - char *myself = "ldapInit"; if (srv == 0) return (0); @@ -618,7 +618,6 @@ ldapBind(LDAP **ldP, char *who, char *cred, auth_method_t method, */ static int freeCon(__nis_ldap_conn_t *lc) { - char *myself = "freeCon"; if (!assertExclusive(lc)) return (LDAP_PARAM_ERROR); @@ -1034,7 +1033,7 @@ setupConList(char *serverList, char *who, char *cred, auth_method_t method) { } /* Remove leading white space */ - for (0; *sl == ' ' || *sl == '\t'; sl++); + for (; *sl == ' ' || *sl == '\t'; sl++); /* Create connection for each server on the list */ for (s = sl; *s != '\0'; s = e+1) { @@ -2227,7 +2226,6 @@ ldapModify(char *dn, __nis_rule_value_t *rv, char *objClassAttrs, __nis_ldap_conn_t *lc; struct timeval tv; LDAPMessage *msg = 0; - char *myself = "ldapModify"; int msgid; int lderr; char **referralsp = NULL; diff --git a/usr/src/lib/libnisdb/ldap_ruleval.c b/usr/src/lib/libnisdb/ldap_ruleval.c index 40ed7fd3f2..69f015f1ff 100644 --- a/usr/src/lib/libnisdb/ldap_ruleval.c +++ b/usr/src/lib/libnisdb/ldap_ruleval.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -109,7 +110,7 @@ __nis_rule_value_t * growRuleValue(int oldCount, int newCount, __nis_rule_value_t *old, __nis_rule_value_t *rvIn) { __nis_rule_value_t *rv; - int i, j; + int i; char *myself = "growRuleValue"; if (newCount <= 0 || newCount <= oldCount) @@ -425,8 +426,6 @@ __nis_rule_value_t * buildNisPlusRuleValue(__nis_table_mapping_t *t, db_query *q, __nis_rule_value_t *rv) { int i; - __nis_single_value_t *sv; - char *myself = "buildNisPlusRuleValue"; if (t == 0 || q == 0) return (0); @@ -436,9 +435,6 @@ buildNisPlusRuleValue(__nis_table_mapping_t *t, db_query *q, return (0); for (i = 0; i < q->components.components_len; i++) { - int ic; - int iv, v, dup; - int len; /* Ignore out-of-range column index */ if (q->components.components_val[i].which_index >= @@ -617,9 +613,7 @@ addLdapRuleValue(__nis_table_mapping_t *t, __nis_rule_value_t *rv, int doAssign, int *stat) { int i, j; - char **new; __nis_value_t *rval, *lval; - __nis_buffer_t b = {0, 0}; __nis_mapping_item_t *litem; int numItems; char **dn = 0; @@ -745,7 +739,7 @@ addLdapRuleValue(__nis_table_mapping_t *t, /* If we're out of values, repeat the last one */ if (j >= rval->numVals) j = (rval->numVals > 0) ? rval->numVals-1 : 0; - for (0; j < rval->numVals; j++) { + for (; j < rval->numVals; j++) { /* * If this is the 'dn', and the value ends in a * comma, append the appropriate search base. diff --git a/usr/src/lib/libnisdb/ldap_val.c b/usr/src/lib/libnisdb/ldap_val.c index aec4b9fa11..84b0c330a8 100644 --- a/usr/src/lib/libnisdb/ldap_val.c +++ b/usr/src/lib/libnisdb/ldap_val.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2090,7 +2091,7 @@ __nis_value_t ** matchMappingItem(__nis_mapping_format_t *f, __nis_value_t *inVal, int *numVals, char *sepset, char **outstr) { __nis_value_t **v = 0; - int i, n, ni, numItems, nf, nv = 0; + int i, n, ni, numItems, nf; char *str, *valstr; __nis_mapping_format_t *ftmp; char *myself = "matchMappingItem"; diff --git a/usr/src/lib/libnisdb/ldap_xdr.c b/usr/src/lib/libnisdb/ldap_xdr.c index d1a75e1614..45c1b9fa9e 100644 --- a/usr/src/lib/libnisdb/ldap_xdr.c +++ b/usr/src/lib/libnisdb/ldap_xdr.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <string.h> #include <sys/syslog.h> #include <sys/types.h> @@ -38,7 +37,7 @@ #include "ldap_xdr.h" #include "ldap_util.h" -extern bool_t xdr_nis_object(); +#include "nis_clnt.h" /* * In order not to change the on-disk NIS+ DB format, we need make sure diff --git a/usr/src/lib/libnisdb/ldap_xdr.h b/usr/src/lib/libnisdb/ldap_xdr.h index b662cb6ccc..e46bff59b5 100644 --- a/usr/src/lib/libnisdb/ldap_xdr.h +++ b/usr/src/lib/libnisdb/ldap_xdr.h @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #ifndef _LDAP_XDR_H #define _LDAP_XDR_H @@ -60,6 +59,10 @@ nis_object *unXdrNisObject(void *buf, int bufLen, entry_obj ***eaP, void freeEntryObjArray(entry_obj **ea, int numEa); bool_t sameNisPlusObj(nis_object *o1, nis_object *o2); bool_t sameNisPlusPseudoObj(nis_object *o1, entry_obj *e2); +bool_t xdr___nisdb_rwlock_t(XDR *, void *); +bool_t xdr___nisdb_flag_t(XDR *, void *); +bool_t xdr___nisdb_ptr_t(XDR *, void *); +bool_t xdr___nis_table_mapping_t(XDR *, void *); #ifdef __cplusplus } diff --git a/usr/src/lib/libnisdb/nis_db.cc b/usr/src/lib/libnisdb/nis_db.cc index 2908cc99b0..1007a396bf 100644 --- a/usr/src/lib/libnisdb/nis_db.cc +++ b/usr/src/lib/libnisdb/nis_db.cc @@ -23,6 +23,8 @@ * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 RackTop Systems. */ @@ -144,7 +146,7 @@ extern "C" { bool_t db_in_dict_file(char *name) { - return ((bool_t) InUseDictionary->find_table_desc(name)); + return (InUseDictionary->find_table_desc(name) != NULL); } diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_conf.c b/usr/src/lib/libnisdb/nis_parse_ldap_conf.c index 00fb7be9da..584932ce6d 100644 --- a/usr/src/lib/libnisdb/nis_parse_ldap_conf.c +++ b/usr/src/lib/libnisdb/nis_parse_ldap_conf.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -84,6 +85,11 @@ static int yp_parse_ldap_default_conf(__nis_ldap_proxy_info *proxy_info, __nis_config_t *nis_config, __nis_config_info_t *config_info, __nisdb_table_mapping_t *table_info); +/* Forward declarations */ +int yp_parse_ldap_config_file(const char *, __nis_ldap_proxy_info *, + __nis_config_t *, __nis_table_mapping_t **, __nis_config_info_t *, + __nisdb_table_mapping_t *, __yp_domain_context_t *); + /* helper functions */ static config_key get_attrib_num_cmdline(const char *s, @@ -128,7 +134,6 @@ parse_ldap_migration( (tls_method_t)NO_VALUE_SET, NULL, NULL, NULL}; struct stat buf; - int i = 0; p_error = no_parse_error; @@ -412,7 +417,7 @@ yp_parse_ldap_default_conf( char *attr_val; int defflags; config_key attrib_num; - int i, len, attr_len; + int i, len; void *defp; if ((defp = defopen_r(YP_ETCCONFFILE)) != NULL) { @@ -646,7 +651,6 @@ yp_parse_ldap_config_file( __yp_domain_context_t *ypDomains) { int rc = 0; - int numDomains = 0; config_key attrib_num; int fd; char *attr_val = NULL; @@ -733,7 +737,6 @@ get_file_attr_val(int fd, char **attr_val) char *attribute_value; int ret; config_key attrib_num = no_more_keys; - int found_quote = 0; *attr_val = NULL; @@ -808,7 +811,6 @@ connect_to_ldap_config_server( int server_port, __nis_config_info_t *config_info) { - int rc = 0; LDAP *ld = NULL; int ldapVersion = LDAP_VERSION3; int derefOption = LDAP_DEREF_ALWAYS; diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_map.c b/usr/src/lib/libnisdb/nis_parse_ldap_map.c index e0e4d1b7c8..7874ec3fdb 100644 --- a/usr/src/lib/libnisdb/nis_parse_ldap_map.c +++ b/usr/src/lib/libnisdb/nis_parse_ldap_map.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -36,6 +35,8 @@ #include "ldap_parse.h" #include "nis_parse_ldap_conf.h" +#include "nis_parse_ldap_yp_util.h" +#include "nis_parse_ldap_util.h" /* other attribute functions */ static char *getIndex(const char **s_cur, const char *end_s); @@ -93,7 +94,6 @@ add_mapping_attribute( const char *attrib_end; const char *db_id_end; const char *begin_token; - const char *end_token; char *index_string; __nis_object_dn_t *objectDN; __nis_table_mapping_t *t_mapping; @@ -378,9 +378,6 @@ add_ypdomains_attribute( const char *s; const char *attrib_end; int numDomains = 0; - int i; - char *tmp_str; - int ret = 0; attrib_end = attrib_val + attrib_len; for (s = attrib_val; s < attrib_end; s++) { @@ -1511,8 +1508,8 @@ get_rhs( } if (end_token == begin_token + 1 || - *begin_token == ESCAPE_CHAR && - end_token == begin_token + 2) { + (*begin_token == ESCAPE_CHAR && + end_token == begin_token + 2)) { e->type = me_split; e->element.split.item = item; e->element.split.delim = *begin_token; @@ -1652,9 +1649,9 @@ get_print_mapping_element( end_token = end_s; s = get_next_token(&begin_token, &end_token, &t); if (s != NULL && t == quoted_string_token && - (end_token == begin_token + 1 || - *begin_token == ESCAPE_CHAR && - end_token == begin_token + 2)) { + (end_token == begin_token + 1 || + (*begin_token == ESCAPE_CHAR && + end_token == begin_token + 2))) { if (numSubElements != 1 || subElement->type == me_extract || subElement->type == me_split) { @@ -2067,8 +2064,8 @@ get_subElement( break; } if (end_token == begin_token + 1 || - *begin_token == ESCAPE_CHAR && - end_token == begin_token + 2) { + (*begin_token == ESCAPE_CHAR && + end_token == begin_token + 2)) { /* me_split */ delim = (unsigned char)end_token[-1]; s = skip_token(s, end_s, close_paren_token); diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_util.c b/usr/src/lib/libnisdb/nis_parse_ldap_util.c index 617d4bb183..0b63305397 100644 --- a/usr/src/lib/libnisdb/nis_parse_ldap_util.c +++ b/usr/src/lib/libnisdb/nis_parse_ldap_util.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -61,6 +60,7 @@ __nis_mapping_format_t *dup_format_mapping( __nis_mapping_format_t *in); bool_t dup_mapping_element(__nis_mapping_element_t *in, __nis_mapping_element_t *out); +bool_t is_string_ok(char *, int); extern FILE *cons; diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_util.h b/usr/src/lib/libnisdb/nis_parse_ldap_util.h new file mode 100644 index 0000000000..10794bf008 --- /dev/null +++ b/usr/src/lib/libnisdb/nis_parse_ldap_util.h @@ -0,0 +1,44 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Gary Mills + */ + +#ifndef _NIS_PARSE_LDAP_UTIL_H +#define _NIS_PARSE_LDAP_UTIL_H + +/* + * Functions defined in nis_parse_ldap_util.c needed elsewhere + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void *s_malloc(size_t); +extern bool_t add_column(__nis_table_mapping_t *, const char *); +extern bool_t dup_index(__nis_index_t *, __nis_index_t *); +extern bool_t dup_mapping_element(__nis_mapping_element_t *, + __nis_mapping_element_t *); +extern bool_t make_fqdn(__nis_object_dn_t *, const char *); +extern bool_t make_full_dn(char **, const char *); +extern void append_dot(char **); +extern void append_comma(char **); +extern __nis_mapping_rule_t **dup_mapping_rules(__nis_mapping_rule_t **, + int n_rules); +extern __nis_mapping_rule_t *dup_mapping_rule(__nis_mapping_rule_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _NIS_PARSE_LDAP_UTIL_H */ diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.c b/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.c index 70c2741ec6..ced92d8efa 100644 --- a/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.c +++ b/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.c @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -34,13 +35,14 @@ #include "ldap_parse.h" #include "nis_parse_ldap_conf.h" -#include "nis_parse_ldap_err.h" +#include "nis_parse_ldap_util.h" #include "ldap_util.h" -extern __nis_mapping_rule_t **dup_mapping_rules( - __nis_mapping_rule_t **rules, int n_rules); -extern __nis_mapping_rule_t *dup_mapping_rule( - __nis_mapping_rule_t *in); +/* Forward declarations */ +int getfullmapname(char **, const char *); +int checkfullmapname(const char *, const char *, __nis_table_mapping_t **, + __nis_table_mapping_t **); +int append_domainContext(__nis_table_mapping_t **, char *, char *); static int merge_table_mapping(__nis_table_mapping_t *in, __nis_table_mapping_t *out); @@ -138,7 +140,6 @@ merge_table_mapping( __nis_table_mapping_t *out) { int i; - int len; int orig_num_rules; int append; @@ -434,15 +435,12 @@ second_parser_pass(__nis_table_mapping_t **table_mapping) __nis_table_mapping_t *t, *t2; __nis_table_mapping_t *t_new = NULL, *tg; __nis_table_mapping_t *prev = NULL; - __nis_object_dn_t *objectDN; char *objs, *dom; char *objName = NULL; char *lasts; char *tobj, *alias, *dupalias, *tmp; char *myself = "second_parser_pass"; int i = 0, len; - int remove_t = 0; - int add_t = 0; prev = NULL; for (t = *table_mapping; t != NULL; ) { diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.h b/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.h new file mode 100644 index 0000000000..84c6853b2f --- /dev/null +++ b/usr/src/lib/libnisdb/nis_parse_ldap_yp_util.h @@ -0,0 +1,35 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Gary Mills + */ + +#ifndef _NIS_PARSE_LDAP_YP_UTIL_H +#define _NIS_PARSE_LDAP_YP_UTIL_H + +/* + * Functions defined in nis_parse_ldap_yp_util.c needed elsewhere + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int check_domain_specific_order(const char *, config_key, + __nis_table_mapping_t *, __yp_domain_context_t *); +extern void initialize_table_mapping(__nis_table_mapping_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _NIS_PARSE_LDAP_YP_UTIL_H */ diff --git a/usr/src/lib/libnisdb/nisdb_rw.c b/usr/src/lib/libnisdb/nisdb_rw.c index 71357b7b19..2e88f0dfd3 100644 --- a/usr/src/lib/libnisdb/nisdb_rw.c +++ b/usr/src/lib/libnisdb/nisdb_rw.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <rpc/types.h> #include <rpc/xdr.h> @@ -107,8 +106,6 @@ find_reader(pthread_t id, __nisdb_rwlock_t *rw) { int __nisdb_rw_readlock_ok(__nisdb_rwlock_t *rw) { int ret; - pthread_t myself = pthread_self(); - __nisdb_rl_t *rr; if (rw == 0) return (EFAULT); @@ -139,8 +136,6 @@ __nisdb_rw_readlock_ok(__nisdb_rwlock_t *rw) { int __nisdb_rw_force_writelock(__nisdb_rwlock_t *rw) { int ret; - pthread_t myself = pthread_self(); - __nisdb_rl_t *rr; if (rw == 0 || rw->destroyed != 0) return (ESHUTDOWN); @@ -206,7 +201,7 @@ __nisdb_wlock_trylock(__nisdb_rwlock_t *rw, int trylock) { */ if (rw->reader_count > 0) { if ((rr = find_reader(myself, rw)) != 0) { - if (rr->count) + if (rr->count) { /* * We're already holding a read lock, so * if the number of readers equals the number @@ -216,7 +211,7 @@ __nisdb_wlock_trylock(__nisdb_rwlock_t *rw, int trylock) { if (rw->reader_count == (rw->reader_blocked + 1)) all_readers_blocked = 1; - else + } else { /* * We're not holding a read lock, so the * number of readers should equal the number @@ -225,6 +220,7 @@ __nisdb_wlock_trylock(__nisdb_rwlock_t *rw, int trylock) { */ if (rw->reader_count == rw->reader_blocked) all_readers_blocked = 1; + } } } @@ -239,11 +235,11 @@ __nisdb_wlock_trylock(__nisdb_rwlock_t *rw, int trylock) { * - N readers, but all blocked on the mutex */ if ( - (rw->writer_count == 0 && rw->reader_count == 0) || - ((rw->writer_count == 0 || rw->writer.id == myself) && - (rw->reader_count == 0) || - (rw->reader_count == 1 && - rw->reader.id == myself))) { + (rw->writer_count == 0 && rw->reader_count == 0) || + (((rw->writer_count == 0 || rw->writer.id == myself) && + (rw->reader_count == 0)) || + (rw->reader_count == 1 && + rw->reader.id == myself))) { break; } /* @@ -648,7 +644,6 @@ __nisdb_destroy_lock(__nisdb_rwlock_t *rw) { int ret; pthread_t myself = pthread_self(); - __nisdb_rl_t *rr; if (rw == 0) { @@ -674,12 +669,12 @@ __nisdb_destroy_lock(__nisdb_rwlock_t *rw) { * other than this thread. Also, no nested locks may be in * effect. */ - if ((rw->writer_count > 0 && - (rw->writer.id != myself || rw->writer.count != 1) || - (rw->reader_count > 0 && - !(rw->reader_count == 1 && rw->reader.id == myself && - rw->reader.count == 1))) || - (rw->writer_count > 0 && rw->reader_count > 0)) { + if (((rw->writer_count > 0 && + (rw->writer.id != myself || rw->writer.count != 1)) || + (rw->reader_count > 0 && + !(rw->reader_count == 1 && rw->reader.id == myself && + rw->reader.count == 1))) || + (rw->writer_count > 0 && rw->reader_count > 0)) { #ifdef NISDB_MT_DEBUG abort(); #endif /* NISDB_MT_DEBUG */ diff --git a/usr/src/lib/libnisdb/xdr_nullptr.h b/usr/src/lib/libnisdb/xdr_nullptr.h new file mode 100644 index 0000000000..80ea176e43 --- /dev/null +++ b/usr/src/lib/libnisdb/xdr_nullptr.h @@ -0,0 +1,34 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Gary Mills + */ + +#ifndef _XDR_NULLPTR_H +#define _XDR_NULLPTR_H + +/* + * This function is used to control serializing and de-serializing of the + * database objects. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern bool_t xdr_nullptr(XDR *, void **); + +#ifdef __cplusplus +} +#endif + +#endif /* _XDR_NULLPTR_H */ diff --git a/usr/src/lib/libnisdb/yptol/dit_access_utils.c b/usr/src/lib/libnisdb/yptol/dit_access_utils.c index 80d6d1744c..7abe95a895 100644 --- a/usr/src/lib/libnisdb/yptol/dit_access_utils.c +++ b/usr/src/lib/libnisdb/yptol/dit_access_utils.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -37,6 +38,7 @@ #include <ndbm.h> #include <strings.h> #include <errno.h> +#include <ctype.h> #include "../ldap_util.h" #include "../ldap_map.h" #include "../ldap_parse.h" @@ -124,11 +126,9 @@ processSplitField(__nis_table_mapping_t *sf, __nis_value_t *inVal, char *sepset; __nis_rule_value_t *rvq; - __nis_mapping_format_t *ftmp; __nis_value_t **valA, *tempVal; int i, j, res, numVals, oldlen, count; char *str, *oldstr; - char *myself = "processSplitField"; /* sf will be non NULL */ @@ -254,7 +254,7 @@ datumToRuleValue(datum *key, datum *value, __nis_table_mapping_t *t, __nis_value_t **valA; __nis_table_mapping_t *sf; int valueLen, comLen, numVals, nr, count = 1; - int i, j, k, l, af; + int i, j, k, l; char *ipaddr, *ipvalue; /* At this point, 't' is always non NULL */ @@ -645,7 +645,7 @@ addSplitFieldValues(__nis_table_mapping_t *t, __nis_rule_value_t *rv, suc_code buildNISRuleValue(__nis_table_mapping_t *t, __nis_rule_value_t *rv, char *domain) { - int r, i, j, k, l, index, nrq, res, len; + int r, i, j, k, l, nrq, res, len; int numItems, splitname, count, statP; __nis_value_t *rval; __nis_mapping_item_t *litem; @@ -1010,9 +1010,9 @@ singleReadFromDIT(char *map, char *domain, datum *key, datum *value, __nis_rule_value_t *rv_request = 0, *rv_result = 0; __nis_ldap_search_t *ls; __nis_object_dn_t *objectDN = NULL; - int i, rc, nr = 0, nv = 0; + int i, rc, nr = 0; datum *datval = 0; - char *skey, *str, *sipkey; + char *skey, *str; char *myself = "singleReadFromDIT"; *statP = SUCCESS; diff --git a/usr/src/lib/libnisdb/yptol/lock_update.c b/usr/src/lib/libnisdb/yptol/lock_update.c index bf34972a50..1f5dcbe5ea 100644 --- a/usr/src/lib/libnisdb/yptol/lock_update.c +++ b/usr/src/lib/libnisdb/yptol/lock_update.c @@ -20,12 +20,11 @@ */ /* + * Copyright 2015 Gary Mills * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains code supporting the 'update in progress' flag. This is * a near copy of lock flag code (in @@ -76,8 +75,8 @@ init_update_locks_mem() * Initialize cross-process locks in memory-mapped file. */ for (iiter = 0; iiter < MAXHASH; iiter++) { - if (rc = mutex_init(&(shmupdatearray->updatenode[iiter]), - USYNC_PROCESS | LOCK_ROBUST, 0)) { + if ((rc = mutex_init(&(shmupdatearray->updatenode[iiter]), + USYNC_PROCESS | LOCK_ROBUST, 0)) != 0) { if (rc == EBUSY) { ebusy_cnt++; } else { diff --git a/usr/src/lib/libnisdb/yptol/map_conv.c b/usr/src/lib/libnisdb/yptol/map_conv.c index 53aac75b7a..024eed6313 100644 --- a/usr/src/lib/libnisdb/yptol/map_conv.c +++ b/usr/src/lib/libnisdb/yptol/map_conv.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains functions relating to movement of entire maps. */ @@ -44,7 +43,6 @@ * Switch on parts of ypdefs.h */ USE_YPDBPATH -USE_DBM /* * Decs diff --git a/usr/src/lib/libnisdb/yptol/shim.c b/usr/src/lib/libnisdb/yptol/shim.c index 9159d24bdc..89795b502a 100644 --- a/usr/src/lib/libnisdb/yptol/shim.c +++ b/usr/src/lib/libnisdb/yptol/shim.c @@ -19,12 +19,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains the top level shim hook functions. These must have * identical interfaces to the equivalent standard dbm calls. @@ -51,6 +50,7 @@ #include "ypdefs.h" #include "shim.h" #include "yptol.h" +#include "stubs.h" #include "../ldap_parse.h" #include "../ldap_util.h" diff --git a/usr/src/lib/libnisdb/yptol/shim_ancil.c b/usr/src/lib/libnisdb/yptol/shim_ancil.c index 68fb5e5836..7004fec46f 100644 --- a/usr/src/lib/libnisdb/yptol/shim_ancil.c +++ b/usr/src/lib/libnisdb/yptol/shim_ancil.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,12 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef lint -static char sccsid[] = "%Z%%M% %I% %E% SMI"; -#endif - #include <stdlib.h> #include <dirent.h> #include <strings.h> diff --git a/usr/src/lib/libnisdb/yptol/shim_changepasswd.c b/usr/src/lib/libnisdb/yptol/shim_changepasswd.c index dad0153f68..ca552b7096 100644 --- a/usr/src/lib/libnisdb/yptol/shim_changepasswd.c +++ b/usr/src/lib/libnisdb/yptol/shim_changepasswd.c @@ -19,12 +19,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: This is the N2L equivalent of changepasswd.c. The traditional * version modifies the NIS source files and then initiates a @@ -70,6 +69,11 @@ #include "yptol.h" #include "../ldap_util.h" +/* + * Undocumented external function in libnsl + */ +extern int getdomainname(char *, int); + /* Constants */ #define CRYPTPWSIZE CRYPT_MAXCIPHERTEXTLEN #define STRSIZE 100 @@ -433,7 +437,6 @@ proc_map_list(char **map_list, char *domain, char cmdbuf[BUFSIZ]; int map_name_len = 0; int index, ans = 0; - int res; /* If this is a adjunct list check LDAP had some adjunct info */ if ((adjunct_flag) && (!pwd->adjunct)) { @@ -1054,7 +1057,6 @@ get_old_info(char *name, char *domain) { char *myself = "get_old_info"; struct passwd_entry *old_passwd; - char *p; datum key, data; suc_code res; diff --git a/usr/src/lib/libnisdb/yptol/shim_lockmap.c b/usr/src/lib/libnisdb/yptol/shim_lockmap.c index 329c968099..2acadc3b66 100644 --- a/usr/src/lib/libnisdb/yptol/shim_lockmap.c +++ b/usr/src/lib/libnisdb/yptol/shim_lockmap.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains a front end to the map locking code. These are called * when a map, or its map_ctrl structure, needs to be locked @@ -45,6 +44,7 @@ #include <ndbm.h> #include "ypsym.h" #include "shim.h" +#include "stubs.h" /* * FUNCTION : lock_map_ctrl() diff --git a/usr/src/lib/libnisdb/yptol/stubs.h b/usr/src/lib/libnisdb/yptol/stubs.h new file mode 100644 index 0000000000..8c7ddcf65f --- /dev/null +++ b/usr/src/lib/libnisdb/yptol/stubs.h @@ -0,0 +1,39 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Gary Mills + */ + +#ifndef _STUBS_H +#define _STUBS_H + +/* + * Functions defined in yptol/stubs.c needed elsewhere + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Put your definitions in here */ +extern bool +init_lock_map(); +extern int +lock_core(int); +extern int +unlock_core(int); + +#ifdef __cplusplus +} +#endif + +#endif /* _STUBS_H */ diff --git a/usr/src/lib/libnisdb/yptol/ttl_utils.c b/usr/src/lib/libnisdb/yptol/ttl_utils.c index a5b3f1ffa2..d60bce2771 100644 --- a/usr/src/lib/libnisdb/yptol/ttl_utils.c +++ b/usr/src/lib/libnisdb/yptol/ttl_utils.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains utilities relating to TTL calculation. */ @@ -285,7 +284,6 @@ update_map_ttl(map_ctrl *map) suc_code add_to_timeval(struct timeval *t1, int t2) { - long usec; struct timeval oldval; oldval.tv_sec = t1->tv_sec; diff --git a/usr/src/lib/libnisdb/yptol/update.c b/usr/src/lib/libnisdb/yptol/update.c index a429c73136..638c80e7b8 100644 --- a/usr/src/lib/libnisdb/yptol/update.c +++ b/usr/src/lib/libnisdb/yptol/update.c @@ -20,12 +20,11 @@ * CDDL HEADER END */ /* + * Copyright 2015 Gary Mills * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DESCRIPTION: Contains the map update thread and related code. */ @@ -358,6 +357,8 @@ update_thread(void *arg) free_map_ctrl(map); thr_exit(ret); + + return (NULL); } /* |