Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG, Page 181 of 806  Not logged in ELOG logo
New entries since:Thu Jan 1 01:00:00 1970
ID Date Icon Author Author Email Category OS ELOG Version Subjectdown
  68419   Tue Sep 6 20:09:07 2016 Reply Mark Bergmanmark.bergman@uphs.upenn.eduQuestionLinux2.90Re: error message "Command Config is not allowed" after registering

 

Mark Bergman wrote:

After registering, elog displays a page with the message:

     Error: Command "Config" is not allowed for user ""

However, the registration is successful. This causes confusion, and results in users registering multiple times.

 

In the elogd.conf file, I have the directive:

     Allow Config = bergman

 

Any suggestions?

 

Well, 5 years after opening this issue, with no responses here, I finally got into the source code and fixed it.

The problem seems to be if eLog is configured to prohibit users (non-administrators) from the "Config" option...but on the initial self-registration, the code goes to the Config screen for the user anyway...resulting in the false error message.

So, I [badly] hacked eLog to fix that, add some debugging/log messages, and to correct a typo.

Attached is the patch against release 3.1.1-1. Try not to cringe too much at my code. :)

Attachment 1: elogd.c.patch
*** ./elogd.c	Tue Aug 23 21:27:39 2016
--- ../../elog-3.1.1.orig/src/elogd.c	Tue Aug  4 09:30:54 2015
***************
*** 80,84 ****
  int _verbose_level, _current_message_id;
  int _logging_level, _ssl_flag;
- BOOL just_registered = FALSE;	/* flag to supress erroneous error */
  
  LOGBOOK *lb_list = NULL;
--- 80,83 ----
***************
*** 13363,13369 ****
  
     if (new_user) {
-       write_logfile(lbs,"In save_user_config() with new_user==TRUE, setting just_registered=TRUE");
-       just_registered = TRUE;
- 
        node = mxml_find_node(lbs->pwd_xml_tree, "/list");
        if (!node) {
--- 13362,13365 ----
***************
*** 13432,13436 ****
        mxml_write_tree(file_name, lbs->pwd_xml_tree);
  
- 
     /* if requested, send notification email to user or admin user */
     if (new_user && !first_user && (self_register == 2 || self_register == 3 || self_register == 4)
--- 13428,13431 ----
***************
*** 13616,13619 ****
--- 13611,13615 ----
                    };
                 }
+ 
                 pl = strtok(NULL, " ,");
              }
***************
*** 26649,26666 ****
     /* save user info if "save" is pressed */
     if (strieq(command, loc("Save")) && isparam("new_user_name") && !isparam("config")) {
!       if (!save_user_config(lbs, getparam("new_user_name"), TRUE)) {
           return 0;
!       }
!       if ( just_registered ) {
!          write_logfile(lbs,"In do_self_register with just_registered==TRUE, resetting flag, calling show_login_page(NULL,\"\",0)");
!          just_registered = FALSE;
!          show_login_page(NULL, "", 0);
!       } else {
!          if (lbs)
!             sprintf(str, "../%s/", lbs->name_enc);
!          else
!             sprintf(str, ".");
!          redirect(lbs, str);
!       }
        return 0;
     }
--- 26645,26655 ----
     /* save user info if "save" is pressed */
     if (strieq(command, loc("Save")) && isparam("new_user_name") && !isparam("config")) {
!       if (!save_user_config(lbs, getparam("new_user_name"), TRUE))
           return 0;
!       if (lbs)
!          sprintf(str, "../%s/", lbs->name_enc);
!       else
!          sprintf(str, ".");
!       redirect(lbs, str);
        return 0;
     }
***************
*** 27355,27364 ****
        /* check if user has access to logbook */
        if (!check_login_user(lbs, getparam("uname"))) {
!       	sprintf(str, "check_login_user access failure: user \"%s\", logbook \"%s\"", uname, lbs->name);
!       	write_logfile(lbs, str);
!          show_error("User has no access to this logbook.");
!          strlcpy(str, loc("New user"), sizeof(str));
!          url_encode(str, sizeof(str));
!          rsprintf("


<b><center><a href=\"?cmd=%s\">%s</a></center></b></td></tr>", str, loc("Register as new user")); return; } --- 27344,27348 ---- /* check if user has access to logbook */ if (!check_login_user(lbs, getparam("uname"))) { ! show_error("Use has no access to this logbook"); return; } *************** *** 27728,27747 **** strencode2(str2, command, sizeof(str2)); strencode2(str3, full_name, sizeof(str3)); ! ! if (strieq(str2,"Config") && just_registered == TRUE ) { ! /* this is the only time to skip the error that "Config" is not an allowed command...as the Config was really ! called in order to complete the self-registration ! ! now, reset the flag */ ! write_logfile(lbs,"In interprete() with just_registered==TRUE, resetting flag, skipping error message that user is not allowed to run command \"Config\""); ! just_registered = FALSE; ! } else { ! sprintf(str, "Error: Command \"%s\" is not allowed for uname \"%s\", full name \"%s\"", str2, uname,str3); ! write_logfile(lbs, str); ! ! sprintf(str, loc("Error: Command \"<b>%s</b>\" is not allowed for login \"<b>%s</b>\", user \"<b>%s</b>\""), str2,uname,str3); ! show_error(str); ! return; ! } } --- 27712,27718 ---- strencode2(str2, command, sizeof(str2)); strencode2(str3, full_name, sizeof(str3)); ! sprintf(str, loc("Error: Command \"<b>%s</b>\" is not allowed for user \"<b>%s</b>\""), str2, str3); ! show_error(str); ! return; }
  65745   Mon Feb 18 07:03:29 2008 Reply Stefan Rittstefan.ritt@psi.chBug reportWindows Re: error "Cannot retrieve host name: No error" using command line in Windows

Dan Gawarecki wrote:

I automatically install software on 3 machines in our lab, and at the end of the process, use eLOG to record relevant information for each machine (all running Windows XP) via the command line program elog.exe.  2 of the machines log their info correctly, but on third machine, I get the following error:

    Cannot retrieve host name: No error

The error is not very clear (i.e., the error is "no error"?), and furthermore, operationally, the error makes no sense to me, for the three machines are supposedly configured the same.


 

The error is produced by the C routine "gethostbyname". This routine tries to obtain the IP address of your host max13 and fails. The error "no error" is the error passed to elog from the underlying operating system, so please blame Windows for that. I guess you have a problem that on the machine you get the error you have some DNS problem, so this machine does not know max13. Try to "ping" max13 or do a "nslookup max13" to verify this. Maybe you have to add your domain after max13, or put this machine explicitly into \Windows\System32\drivers\etc\hosts.

Dan Gawarecki wrote:

I am not sure which version of eLOG is being used, but the size of the elog.exe is 139,264. 

I suggest a new option be added to display the version information, or display the version info whenever eLOG is execute, or display the version info when "-?" option is used.

I added some version information being displayed with the "-?" option. This feature will be contained in the next release.

  65747   Mon Feb 18 17:25:42 2008 Reply Dan Gawareckidan_gawarecki@datacard.comBug reportWindows Re: error "Cannot retrieve host name: No error" using command line in Windows

Stefan:

Thanks for the analysis and information.  Why am I not surprised that the "No error" came from Windows!? 

I tried some of your suggestions with the following results:

1.  Ping ==>= works as expected on the failing machine; that is, can successfully ping "max13"  I also can ping successfully in the reverse direction; that is, from "max13" to my "client" machine.

2.  NSLookUp ==>does not work on any of the 3 machines.

3.  Added the computer name "max13" to HOSTS file; ==> observed no change in behavior (i.e., still fails)

I did notice that on the 2 machines that function as desired that there is no anti-virus software installed, while on the non-funcational machine there is A-V SW installed.  I am able to bring up eLOG via the browser on the non-functional machine, so am unsure if the A-V SW is a factor; that is, why does ELOG via browser work as expected, but not via command line. 

QUESTION:  does command line ELOG connect differently than ELOG through the browser?

I ask this question for perhaps the A-V SW *is* blocking some port or whatever, and I will need to ask our IT department how to remove such a restriction.

 

  65748   Mon Feb 18 17:51:49 2008 Reply Stefan Rittstefan.ritt@psi.chBug reportWindows Re: error "Cannot retrieve host name: No error" using command line in Windows

Dan Gawarecki wrote:

QUESTION:  does command line ELOG connect differently than ELOG through the browser?

I ask this question for perhaps the A-V SW *is* blocking some port or whatever, and I will need to ask our IT department how to remove such a restriction.

ELOG connects in the same way as the browser, but it is a different program. I have seen some firewalls which explicitly exclude browsers in firewall rules. So it might well be that yours blocks ELOG but not your browser. So give it a try and disable it.

  65749   Mon Feb 18 22:20:02 2008 Reply Dan Gawareckidan_gawarecki@datacard.comBug reportWindows Re: error "Cannot retrieve host name: No error" using command line in Windows

Since both my machine and the Elog server PC are inside my company's "security zone", I am not running a firewall on my machine.

 

For what it's worth:  in trying to research the "No error" message, I did come across this information on MS's website; that is, their statement is:

The gethostbyname function retrieves host information corresponding to a host name from a host database.

 

Note  The gethostbyname function has been deprecated by the introduction of the getaddrinfo function. Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname.

SOURCE:  http://msdn2.microsoft.com/en-us/library/ms738524.aspx


  924   Tue Feb 8 15:41:55 2005 Agree Emiliano GabrielliAlberT@SuperAlberT.itBug fixLinux2.5.6Re: erroneus encoding
the following patch corrects the problem, plz apply :


--- elogd.c     2005-02-03 16:46:10.000000000 +0100
+++ elogd_albert.c      2005-02-08 15:40:36.000000000 +0100
@@ -6178,7 +6178,7 @@
    if (getcfg("global", "charset", str, sizeof(str)))
       rsprintf("Content-Type: text/html;charset=%s\r\n", str);
    else
-      rsprintf("Content-Type: text/html;charset=%S\r\n", DEFAULT_HTTP_CHARSET);
+      rsprintf("Content-Type: text/html;charset=%s\r\n", DEFAULT_HTTP_CHARSET);

    if (use_keepalive) {
       rsprintf("Connection: Keep-Alive\r\n");
@@ -11267,7 +11267,7 @@
    rsprintf("Server: ELOG HTTP %s\r\n", VERSION);
    rsprintf("Accept-Ranges: bytes\r\n");
    rsprintf("Connection: close\r\n");
-   rsprintf("Content-Type: text/plain;charset=%S\r\n", DEFAULT_HTTP_CHARSET);
+   rsprintf("Content-Type: text/plain;charset=%s\r\n", DEFAULT_HTTP_CHARSET);
    rsprintf("Pragma: no-cache\r\n");
    rsprintf("Expires: Fri, 01 Jan 1983 00:00:00 GMT\r\n\r\n");
  932   Sat Feb 12 17:31:46 2005 Reply Stefan Rittstefan.ritt@psi.chBug reportLinux2.5.6Re: erroneus encoding
> elog sends wrong HTTP headers, charset is empty and not separed from the
> next one "Connection: Keep-Alive ... this bug tells the browser that the
> encoding is "connection:" ... that is wrong.

This has to do with the "%S" vs. "%s" bug described elsewhere in this forum. 
I fixed that. The validator link above now also reports error free.
  69   Thu Jul 11 16:03:56 2002 Idea Stefan Rittstefan.ritt@psi.chInfo  Re: entry number not updated properly after deleting
> Hello,
>     If you delete a message from the middle of a logbook that contains a 
> bunch of messages, the message numbers do not get updated properly.  For 
> instance, if you have 20 messages in the logbook, and delete number 15, 
> entry numbers 16 through 20 all do not get subtracted by one; their numbers 
> stay the same with #15 just missing in the middle.  
> 
> Mo

That's how it's supposed to be. Once a unique message ID is attached to a 
message, it stays there forever. Think of links to message like

http://midas.psi.ch/elogdemo/Forum/68

If you have such a link in a message or as a bookmark in your browser, and 
the ID gets changed from 68 to 67, then your link would be off.
ELOG V3.1.5-3fb85fa6