• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Done] pilight-daemon -V - currently requires root access
#1
Is there a geniune need for root access when attempting to determine the verison number?

I attemped to do a build but I do not appear to have a recent enough version of CMake on my machine :-(

Here is a 100% completely untested patch :p

Code:
diff --git a/daemon.c b/daemon.c
index 4a4becb..7fa58ce 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1682,12 +1682,6 @@ int main(int argc, char **argv) {
        }
        strcpy(progname, "pilight-daemon");

-       if(geteuid() != 0) {
-               printf("%s requires root priveliges in order to run\n", progname);
-               sfree((void *)&progname);
-               exit(EXIT_FAILURE);
-       }
-
        /* Run main garbage collector when quiting the daemon */
        gc_attach(main_gc);

@@ -1805,6 +1799,12 @@ int main(int argc, char **argv) {
        }
        options_delete(options);

+       if(!show_version && geteuid() != 0) {
+               printf("%s requires root priveliges in order to run\n", progname);
+               sfree((void *)&progname);
+               exit(EXIT_FAILURE);
+       }
+
        if(show_help) {
                printf("Usage: %s [options]\n", progname);
                printf("\t -H --help\t\t\tdisplay usage summary\n");
 
Reply
#2
Okay, for version request there should be no reason, but for running it. Please use the sudo prefix command.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Done] pilight config read access for all gneandr 1 2,031 03-25-2015, 01:46 PM
Last Post: curlymo
  [Done] pilight eventing - dimming step by step terrar 3 2,807 02-11-2015, 02:39 PM
Last Post: Niek
  [Done] pilight api: receiving and sending as gui client sweetpi 3 3,577 05-19-2014, 04:39 PM
Last Post: curlymo
  [Done] Continuous pilight-debug Tommybear1979 1 1,928 05-15-2014, 09:12 PM
Last Post: curlymo
  [Done] pilight-cron (implemented with eventing) dzjaivnt 30 18,797 04-28-2014, 11:48 PM
Last Post: dzjaivnt
  [Done] auto detect pilight (for mobile/desktop apps) (SSDP) Martin 6 4,384 11-30-2013, 06:51 PM
Last Post: curlymo
  [Done] Message from pilight d.m.raspberry 5 2,858 09-23-2013, 10:25 AM
Last Post: curlymo
  [Done] Communicate with daemon via python file to include internal sensors daenny 5 4,185 08-29-2013, 09:46 AM
Last Post: daenny
  [Invalid] Invoking scripts from daemon JurnD 2 1,866 08-27-2013, 06:36 PM
Last Post: JurnD

Forum Jump:


Browsing: 1 Guest(s)