Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG, Page 176 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 Subject
  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; }
  68418   Tue Sep 6 15:29:22 2016 Reply Stefan Rittstefan.ritt@psi.chQuestionWindows3.1.1-3f311c5Re: Highlight code?

In the HTML editor, you can select the code text, then select from the "Styles" drop-down the style "Computer Code", and on the "Normal" drop-down the formatting "Formatted". This puts the code in <pre>  and <code> tags, so you don't have to manipulate HTML directly.

Daniel Sajdyk wrote:

Looks like it works :)

Code need to be put in tags:

<pre><code class="sql">...</code></pre>

but it works.

Thank you :D

 

Best Regards

Daniel Sajdyk

Stefan Ritt wrote:

I did not know about highlight.js . You can put it into any elog page with "Bottom text = ...". I tried it for this forum and put in some C code:

#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("C Programming");
   return 0;
}

Seems like this works nicely. Thanks for that hint.

 

Daniel Sajdyk wrote:

I thought so.

One  more question :) I want manually add that parser (https://highlightjs.org), but I'm newby in that and don't know where ....

I know that downloaded hightlight pack I must put into folder scripts, but where to add this line:

<script>hljs.initHighlightingOnLoad();</script>

 

Stefan Ritt wrote:

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

 

 

 

 

  68417   Tue Sep 6 14:51:19 2016 Reply Daniel Sajdyk like daniel.sajdyk@gmail.comQuestionWindows3.1.1-3f311c5Re: Highlight code?

Looks like it works :)

Code need to be put in tags:

<pre><code class="sql">...</code></pre>

but it works.

Thank you :D

 

Best Regards

Daniel Sajdyk

Stefan Ritt wrote:

I did not know about highlight.js . You can put it into any elog page with "Bottom text = ...". I tried it for this forum and put in some C code:

#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("C Programming");
   return 0;
}

Seems like this works nicely. Thanks for that hint.

 

Daniel Sajdyk wrote:

I thought so.

One  more question :) I want manually add that parser (https://highlightjs.org), but I'm newby in that and don't know where ....

I know that downloaded hightlight pack I must put into folder scripts, but where to add this line:

<script>hljs.initHighlightingOnLoad();</script>

 

Stefan Ritt wrote:

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

 

 

 

Attachment 1: screen.png
screen.png
  68416   Tue Sep 6 14:02:56 2016 Reply Stefan Rittstefan.ritt@psi.chQuestionWindows3.1.1-3f311c5Re: Highlight code?

I did not know about highlight.js . You can put it into any elog page with "Bottom text = ...". I tried it for this forum and put in some C code:

#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("C Programming");
   return 0;
}

Seems like this works nicely. Thanks for that hint.

 

Daniel Sajdyk wrote:

I thought so.

One  more question :) I want manually add that parser (https://highlightjs.org), but I'm newby in that and don't know where ....

I know that downloaded hightlight pack I must put into folder scripts, but where to add this line:

<script>hljs.initHighlightingOnLoad();</script>

 

Stefan Ritt wrote:

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

 

 

  68415   Tue Sep 6 13:45:55 2016 Reply Daniel Sajdykdaniel.sajdyk@gmail.comQuestionWindows3.1.1-3f311c5Re: Highlight code?

I thought so.

One  more question :) I want manually add that parser (https://highlightjs.org), but I'm newby in that and don't know where ....

I know that downloaded hightlight pack I must put into folder scripts, but where to add this line:

<script>hljs.initHighlightingOnLoad();</script>

 

Stefan Ritt wrote:

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

 

  68414   Tue Sep 6 13:41:32 2016 Reply Stefan Rittstefan.ritt@psi.chQuestionWindows3.1.1-3f311c5Re: Highlight code?

You can manually highlight code, but there is no automatic language parser.

Daniel Sajdyk wrote:

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

 

  68413   Tue Sep 6 13:35:05 2016 Question Daniel Sajdykdaniel.sajdyk@gmail.comQuestionWindows3.1.1-3f311c5Highlight code?

Hello :)

Is there any way to highlight code (for example php, SQL) in elogs entries?

Best Regards

Daniel Sajdyk

  Draft   Tue Sep 6 13:29:03 2016  Daniel Sajdykdaniel.sajdyk@gmail.comQuestionWindows3.1.1-3f311c5Hilight code

Hello :)

Is there any way to highlight code (for example php, SQL) in logs entries?

Best Regards

Daniel Sajdyk

ELOG V3.1.5-3fb85fa6