mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Add more sanity checks. *Lots* of sanity checks. Huge tracts of sanity checks.
Make sure all arguments to the yp_*() functions are valid before sending them off to the server. This is somewhat distressing: once again my FreeBSD box brought down my entire network because of NIS bogosities. I *think* the poor argument checking in this module is the cause, but I still haven't been able to reproduce the exact series of events that lead to the ypserv crashes. For now I've resorted to sticking my FreeBSD box in a seprate domain. Hopefully a weekend of heavy testing will uncover the problem.
This commit is contained in:
parent
0ffe27f544
commit
06643071e5
1 changed files with 40 additions and 8 deletions
|
|
@ -380,10 +380,12 @@ int *outvallen;
|
|||
*outval = NULL;
|
||||
*outvallen = 0;
|
||||
|
||||
/* Sanity check: no null keys allowed! */
|
||||
/* Sanity check */
|
||||
|
||||
if (inkey == NULL || *inkey == '\0')
|
||||
return YPERR_KEY;
|
||||
if (inkey == NULL || !strlen(inkey) || inkeylen <= 0 ||
|
||||
inmap == NULL || !strlen(inmap) ||
|
||||
indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
|
|
@ -459,6 +461,12 @@ int *outvallen;
|
|||
struct timeval tv;
|
||||
int r;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
*outkey = *outval = NULL;
|
||||
*outkeylen = *outvallen = 0;
|
||||
|
||||
|
|
@ -512,14 +520,16 @@ int *outvallen;
|
|||
struct timeval tv;
|
||||
int r;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (inkey == NULL || !strlen(inkey) || inkeylen <= 0 ||
|
||||
inmap == NULL || !strlen(inmap) ||
|
||||
indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
*outkey = *outval = NULL;
|
||||
*outkeylen = *outvallen = 0;
|
||||
|
||||
/* Sanity check: no null keys allowed! */
|
||||
|
||||
if (inkey == NULL || *inkey == '\0')
|
||||
return YPERR_KEY;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
|
|
@ -569,6 +579,12 @@ struct ypall_callback *incallback;
|
|||
u_long status;
|
||||
int clnt_sock;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
|
||||
|
|
@ -611,6 +627,12 @@ int *outorder;
|
|||
struct timeval tv;
|
||||
int r;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
|
|
@ -649,6 +671,11 @@ char **outname;
|
|||
struct timeval tv;
|
||||
int r;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
|
|
@ -685,6 +712,11 @@ struct ypmaplist **outmaplist;
|
|||
struct timeval tv;
|
||||
int r;
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
|
|
|
|||
Loading…
Reference in a new issue