return master;
}
+#ifdef FUZZING
static struct thread_master *master;
struct thread_master *frr_init_fast(void)
{
const char *dir;
dir = di->module_path ? di->module_path : frr_moduledir;
#endif
- char p_instance[16] = "", p_pathspace[256] = "";
-
- srandom(time(NULL));
-
- if (di->instance) {
- snprintf(frr_protonameinst, sizeof(frr_protonameinst), "%s[%u]",
- di->logname, di->instance);
- snprintf(p_instance, sizeof(p_instance), "-%d", di->instance);
- }
- if (di->pathspace)
- snprintf(p_pathspace, sizeof(p_pathspace), "%s/",
- di->pathspace);
-
- snprintf(config_default, sizeof(config_default), "%s%s%s%s.conf",
- frr_sysconfdir, p_pathspace, di->name, p_instance);
- snprintf(pidfile_default, sizeof(pidfile_default), "%s/%s%s.pid",
- frr_vtydir, di->name, p_instance);
#if 0
#ifdef HAVE_SQLITE3
snprintf(dbfile_default, sizeof(dbfile_default), "%s/%s%s%s.db",
frr_dbdir, p_pathspace, di->name, p_instance);
#endif
#endif
-
zprivs_preinit(di->privs);
openzlog(di->progname, di->logname, di->instance,
command_setup_early_logging(di->early_logging, di->early_loglevel);
+#if 0
if (!frr_zclient_addr(&zclient_addr, &zclient_addr_len,
frr_zclientpath)) {
fprintf(stderr, "Invalid zserv socket path: %s\n",
if (di->vty_path)
frr_mkdir(di->vty_path, true);
}
+#endif
#if 0
frrmod_init(di->module);
#endif
log_ref_init();
+#if 0
log_ref_vty_init();
+#endif
lib_error_init();
#if 0
return master;
}
+#endif
const char *frr_get_progname(void)
{
/* we have caps, we have no need to ever change back the original user
*/
/* only change uid if we don't have the correct one */
+#ifndef FUZZING
if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) {
if (setreuid(zprivs_state.zuid, zprivs_state.zuid)) {
fprintf(stderr,
exit(1);
}
}
+#endif
if (!zprivs_state.syscaps_p)
return;
/* apply caps. CAP_EFFECTIVE is cleared. we'll raise the caps as
* and when, and only when, they are needed.
*/
+#ifndef FUZZING
if (cap_set_proc(zprivs_state.caps)) {
cap_t current_caps;
char *current_caps_text = NULL;
exit(1);
}
+#endif
/* set methods for the caller to use */
zprivs->change = zprivs_change_caps;
struct zebra_privs_t *_zprivs_raise(struct zebra_privs_t *privs,
const char *funcname)
{
+#ifdef FUZZING
+ return NULL;
+#endif
int save_errno = errno;
struct zebra_privs_refs_t *refs;
void _zprivs_lower(struct zebra_privs_t **privs)
{
+#ifdef FUZZING
+ return;
+#endif
int save_errno = errno;
struct zebra_privs_refs_t *refs;
zprivs_state.zsuid = geteuid(); /* initial uid */
/* add groups only if we changed uid - otherwise skip */
+#ifndef FUZZING
if ((ngroups) && (zprivs_state.zsuid != zprivs_state.zuid)) {
if (setgroups(ngroups, groups)) {
fprintf(stderr, "privs_init: could not setgroups, %s\n",
exit(1);
}
}
+#endif
#ifdef HAVE_CAPABILITIES
zprivs_caps_init(zprivs);
*/
zprivs_state.zsuid = geteuid();
/* only change uid if we don't have the correct one */
+#ifndef FUZZING
if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) {
if (setreuid(-1, zprivs_state.zuid)) {
fprintf(stderr,
zprivs->change = zprivs_change_uid;
zprivs->current_state = zprivs_state_uid;
+#endif
#endif /* HAVE_CAPABILITIES */
}