+ } else if (string_match(optname, "ustconsumerd32-err-sock")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--ustconsumerd32-err-sock");
+ } else {
+ config_string_set(&config.consumerd32_err_unix_sock_path,
+ strdup(arg));
+ if (!config.consumerd32_err_unix_sock_path.value) {
+ ret = -ENOMEM;
+ PERROR("strdup");
+ }
+ }
+ } else if (string_match(optname, "ustconsumerd32-cmd-sock")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--ustconsumerd32-cmd-sock");
+ } else {
+ config_string_set(&config.consumerd32_cmd_unix_sock_path,
+ strdup(arg));
+ if (!config.consumerd32_cmd_unix_sock_path.value) {
+ ret = -ENOMEM;
+ PERROR("strdup");
+ }
+ }
+ } else if (string_match(optname, "no-kernel")) {
+ config.no_kernel = true;
+ } else if (string_match(optname, "quiet") || opt == 'q') {
+ lttng_opt_quiet = true;
+ } else if (string_match(optname, "verbose") || opt == 'v') {
+ /* Verbose level can increase using multiple -v */
+ if (arg) {
+ /* Value obtained from config file */
+ config.verbose = config_parse_value(arg);
+ } else {
+ /* -v used on command line */
+ config.verbose++;
+ }
+ /* Clamp value to [0, 3] */
+ config.verbose = config.verbose < 0 ? 0 :
+ (config.verbose <= 3 ? config.verbose : 3);
+ } else if (string_match(optname, "verbose-consumer")) {
+ if (arg) {
+ config.verbose_consumer = config_parse_value(arg);
+ } else {
+ config.verbose_consumer++;
+ }
+ } else if (string_match(optname, "consumerd32-path")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--consumerd32-path");
+ } else {
+ config_string_set(&config.consumerd32_bin_path,
+ strdup(arg));
+ if (!config.consumerd32_bin_path.value) {
+ PERROR("strdup");
+ ret = -ENOMEM;
+ }
+ }
+ } else if (string_match(optname, "consumerd32-libdir")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--consumerd32-libdir");
+ } else {
+ config_string_set(&config.consumerd32_lib_dir,
+ strdup(arg));
+ if (!config.consumerd32_lib_dir.value) {
+ PERROR("strdup");
+ ret = -ENOMEM;
+ }
+ }
+ } else if (string_match(optname, "consumerd64-path")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--consumerd64-path");
+ } else {
+ config_string_set(&config.consumerd64_bin_path,
+ strdup(arg));
+ if (!config.consumerd64_bin_path.value) {
+ PERROR("strdup");
+ ret = -ENOMEM;
+ }
+ }
+ } else if (string_match(optname, "consumerd64-libdir")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--consumerd64-libdir");
+ } else {
+ config_string_set(&config.consumerd64_lib_dir,
+ strdup(arg));
+ if (!config.consumerd64_lib_dir.value) {
+ PERROR("strdup");
+ ret = -ENOMEM;
+ }
+ }
+ } else if (string_match(optname, "pidfile") || opt == 'p') {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "-p, --pidfile");
+ } else {
+ config_string_set(&config.pid_file_path, strdup(arg));
+ if (!config.pid_file_path.value) {
+ PERROR("strdup");
+ ret = -ENOMEM;
+ }
+ }
+ } else if (string_match(optname, "agent-tcp-port")) {
+ if (!arg || *arg == '\0') {
+ ret = -EINVAL;
+ goto end;
+ }
+ if (lttng_is_setuid_setgid()) {
+ WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ "--agent-tcp-port");
+ } else {
+ unsigned long v;