- #define SET_PLUGINS 141
- #define SET_APITIMEOUT 142
+ #define SET_AUTH_TOKEN 141
+ #define SET_PLUGINS 142
+ #define SET_APITIMEOUT 143
+ #define SET_CNTXTIMEOUT 144
{SET_ROOT_BASE ,1,"rootbase" , "Angular Base Root URL [default /opa]"},
{SET_ROOT_API ,1,"rootapi" , "HTML Root API URL [default /api]"},
{SET_ROOT_ALIAS ,1,"alias" , "Muliple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]"},
{SET_ROOT_BASE ,1,"rootbase" , "Angular Base Root URL [default /opa]"},
{SET_ROOT_API ,1,"rootapi" , "HTML Root API URL [default /api]"},
{SET_ROOT_ALIAS ,1,"alias" , "Muliple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]"},
{SET_APITIMEOUT ,1,"apitimeout" , "Plugin API timeout in seconds [default 10]"},
{SET_APITIMEOUT ,1,"apitimeout" , "Plugin API timeout in seconds [default 10]"},
{SET_CACHE_TO ,1,"cache-eol" , "Client cache end of live [default 3600s]"},
{SET_CACHE_TO ,1,"cache-eol" , "Client cache end of live [default 3600s]"},
- {SET_cardid ,1,"setuid" , "Change user id [default don't change]"},
+
+ {SET_USERID ,1,"setuid" , "Change user id [default don't change]"},
{SET_PID_FILE ,1,"pidfile" , "PID file path [default none]"},
{SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"},
{SET_CONFIG_FILE ,1,"config" , "Config Filename [default rootdir/sessions/configs/default.AFB]"},
{SET_PID_FILE ,1,"pidfile" , "PID file path [default none]"},
{SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"},
{SET_CONFIG_FILE ,1,"config" , "Config Filename [default rootdir/sessions/configs/default.AFB]"},
{SET_CONFIG_EXIT ,0,"saveonly" , "Save config on disk and then exit"},
{SET_SMACK ,1,"smack" , "Set Smack Label [default demo]"},
{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"},
{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," --%-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);
// if exist merge config file with CLI arguments
configLoadFile (session, &cliconfig);
// if exist merge config file with CLI arguments
configLoadFile (session, &cliconfig);
// ------------------ sanity check ----------------------------------------
if ((session->background) && (session->foreground)) {
// ------------------ sanity check ----------------------------------------
if ((session->background) && (session->foreground)) {
-
- err = setuid(session->config->setuid);
- if (err) fprintf (stderr, "Fail to change program cardid error=%s", strerror(err));
+ struct passwd *passwd;
+ passwd=getpwnam(session->config->setuid);
+
+ if (passwd == NULL) goto errorSetuid;
+
+ err = setuid(passwd->pw_uid);
+ if (err) goto errorSetuid;
// check session dir and create if it does not exist
if (sessionCheckdir (session) != AFB_SUCCESS) goto errSessiondir;
// check session dir and create if it does not exist
if (sessionCheckdir (session) != AFB_SUCCESS) goto errSessiondir;