* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_parse_etherent):

Minor cleanups.  NUL terminate name string.

	* nis/Versions: No need to export _nss_nisplus_parse_grent,
	_nss_nisplus_parse_pwent, and _nss_nisplus_parse_spent.
This commit is contained in:
Ulrich Drepper 2006-04-14 21:30:52 +00:00
parent 3fc044a113
commit 1620084c4e
3 changed files with 17 additions and 10 deletions

View File

@ -1,5 +1,11 @@
2006-04-14 Ulrich Drepper <drepper@redhat.com> 2006-04-14 Ulrich Drepper <drepper@redhat.com>
* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_parse_etherent):
Minor cleanups. NUL terminate name string.
* nis/Versions: No need to export _nss_nisplus_parse_grent,
_nss_nisplus_parse_pwent, and _nss_nisplus_parse_spent.
* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_parse_aliasent): * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_parse_aliasent):
Avoid unnecessary allocation. Fix adjustment for pointer value. Avoid unnecessary allocation. Fix adjustment for pointer value.

View File

@ -120,8 +120,7 @@ libnss_nisplus {
_nss_nisplus_getservbyname_r; _nss_nisplus_getservbynumber_r; _nss_nisplus_getservbyname_r; _nss_nisplus_getservbynumber_r;
_nss_nisplus_getservent_r; _nss_nisplus_getspent_r; _nss_nisplus_getservent_r; _nss_nisplus_getspent_r;
_nss_nisplus_getspnam_r; _nss_nisplus_netname2user; _nss_nisplus_getspnam_r; _nss_nisplus_netname2user;
_nss_nisplus_parse_grent; _nss_nisplus_parse_pwent; _nss_nisplus_setaliasent;
_nss_nisplus_parse_spent; _nss_nisplus_setaliasent;
_nss_nisplus_setetherent; _nss_nisplus_setgrent; _nss_nisplus_sethostent; _nss_nisplus_setetherent; _nss_nisplus_setgrent; _nss_nisplus_sethostent;
_nss_nisplus_setnetent; _nss_nisplus_setnetgrent; _nss_nisplus_setprotoent; _nss_nisplus_setnetent; _nss_nisplus_setnetgrent; _nss_nisplus_setprotoent;
_nss_nisplus_setpwent; _nss_nisplus_setrpcent; _nss_nisplus_setservent; _nss_nisplus_setpwent; _nss_nisplus_setrpcent; _nss_nisplus_setservent;

View File

@ -38,11 +38,11 @@ static nis_name tablename_val;
static u_long tablename_len; static u_long tablename_len;
#define NISENTRYVAL(idx,col,res) \ #define NISENTRYVAL(idx, col, res) \
((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val) (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
#define NISENTRYLEN(idx,col,res) \ #define NISENTRYLEN(idx, col, res) \
((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len) (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
static int static int
_nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether, _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
@ -55,7 +55,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
return 0; return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
|| result->objects.objects_len != 1 || NIS_RES_NUMOBJ (result) != 1
|| __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
|| strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
"ethers_tbl") != 0 "ethers_tbl") != 0
@ -63,13 +63,15 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
return 0; return 0;
/* Generate the ether entry format and use the normal parser */ /* Generate the ether entry format and use the normal parser */
if (NISENTRYLEN (0, 0, result) +1 > room_left) if (NISENTRYLEN (0, 0, result) + 1 > room_left)
{ {
*errnop = ERANGE; *errnop = ERANGE;
return -1; return -1;
} }
strncpy (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result)); char *cp = __stpncpy (p, NISENTRYVAL (0, 0, result),
room_left -= (NISENTRYLEN (0, 0, result) +1); NISENTRYLEN (0, 0, result));
*cp = '\0';
room_left -= NISENTRYLEN (0, 0, result) + 1;
ether->e_name = p; ether->e_name = p;
struct ether_addr *ea = ether_aton (NISENTRYVAL (0, 1, result)); struct ether_addr *ea = ether_aton (NISENTRYVAL (0, 1, result));