#define SET_CONFIG_EXIT 138
#define SET_SMACK 140
- #define SET_PLUGINS 141
- #define SET_APITIMEOUT 142
- #define SET_CNTXTIMEOUT 143
+ #define SET_AUTH_TOKEN 141
+ #define SET_PLUGINS 142
+ #define SET_APITIMEOUT 143
+ #define SET_CNTXTIMEOUT 144
#define DISPLAY_VERSION 150
#define DISPLAY_HELP 151
{SET_CONFIG_EXIT ,0,"saveonly" , "Save config on disk and then exit"},
{SET_SMACK ,1,"smack" , "Set Smack Label [default demo]"},
- {SET_PLUGINS ,1,"mods" , "Enable module [default all]"},
+ {SET_PLUGINS ,1,"plugins" , "Load Plugins from dir [default = PLUGIN_INSTALL_DIR"},
+ {SET_AUTH_TOKEN ,1,"token" , "Initial Secret [default=no-session, --token="" for session without authentication]"},
{DISPLAY_VERSION ,0,"version" , "Display version and copyright"},
{DISPLAY_HELP ,0,"help" , "Display this help"},
fprintf (stderr," --%-15s %s\n", command, cliOptions[ind].help);
}
}
- fprintf (stderr,"Example:\n %s\\\n --verbose --port=1234 --smack=xxxx --mods=alsa:dbus\n", name);
+ fprintf (stderr,"Example:\n %s\\\n --verbose --port=1234 --smack=xxxx --token='azerty' --plugins=build/plugins\n", name);
} // end printHelp
/*----------------------------------------------------------
fprintf (stderr, "hoops returned from infinite loop [report bug]\n");
}
}
-
+
/*---------------------------------------------------------
| main
| Parse option and launch action
cliconfig.smack = optarg;
break;
+ case SET_AUTH_TOKEN:
+ if (optarg == 0) goto needValueForOption;
+ cliconfig.token = optarg;
+ break;
+
case SET_PLUGINS:
if (optarg == 0) goto needValueForOption;
- fprintf (stderr, "Not Implemented yet\n");
cliconfig.plugins = optarg;
break;
}
}
- // Create session config
- configInit (/* session & config are initialized globally */);
-
+
// if exist merge config file with CLI arguments
configLoadFile (session, &cliconfig);
+ initPlugins(session);
// ------------------ sanity check ----------------------------------------
if ((session->background) && (session->foreground)) {
}
// let's not take the risk to run as ROOT
- if (getuid() == 0) goto errorNoRoot;
+ //if (getuid() == 0) goto errorNoRoot;
// check session dir and create if it does not exist
if (sessionCheckdir (session) != AFB_SUCCESS) goto errSessiondir;
fprintf (stderr,"\nERR:AFB-daemon Failed to change UID to username=[%s]\n\n", session->config->setuid);
exit (-1);
-errorNoRoot:
- fprintf (stderr,"\nERR:AFB-daemon Not allow to run as root [use --seteuid=username option]\n\n");
- exit (-1);
+//errorNoRoot:
+// fprintf (stderr,"\nERR:AFB-daemon Not allow to run as root [use --seteuid=username option]\n\n");
+// exit (-1);
errorPidFile:
fprintf (stderr,"\nERR:AFB-daemon Failed to write pid file [%s]\n\n", session->config->pidfile);