Fossil SCM

The --localauth option should look at the original IP address, not the abbreviated IP address. Ticket [b99a342a31039df19].

drh 2011-04-14 11:50 trunk
Commit e720f1115e9532a1393f6b6d0578b03e835262a6
1 file changed +4 -3
+4 -3
--- src/login.c
+++ src/login.c
@@ -546,11 +546,12 @@
546546
**
547547
*/
548548
void login_check_credentials(void){
549549
int uid = 0; /* User id */
550550
const char *zCookie; /* Text of the login cookie */
551
- char *zRemoteAddr; /* IP address of the requestor */
551
+ const char *zIpAddr; /* Raw IP address of the requestor */
552
+ char *zRemoteAddr; /* Abbreviated IP address of the requestor */
552553
const char *zCap = 0; /* Capability string */
553554
554555
/* Only run this check once. */
555556
if( g.userUid!=0 ) return;
556557
@@ -559,12 +560,12 @@
559560
** then there is no need to check user credentials.
560561
**
561562
** This feature allows the "fossil ui" command to give the user
562563
** full access rights without having to log in.
563564
*/
564
- zRemoteAddr = ipPrefix(PD("REMOTE_ADDR","nil"));
565
- if( strcmp(zRemoteAddr, "127.0.0.1")==0
565
+ zRemoteAddr = ipPrefix(zIpAddr = PD("REMOTE_ADDR","nil"));
566
+ if( strcmp(zIpAddr, "127.0.0.1")==0
566567
&& g.useLocalauth
567568
&& db_get_int("localauth",0)==0
568569
&& P("HTTPS")==0
569570
){
570571
uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
571572
--- src/login.c
+++ src/login.c
@@ -546,11 +546,12 @@
546 **
547 */
548 void login_check_credentials(void){
549 int uid = 0; /* User id */
550 const char *zCookie; /* Text of the login cookie */
551 char *zRemoteAddr; /* IP address of the requestor */
 
552 const char *zCap = 0; /* Capability string */
553
554 /* Only run this check once. */
555 if( g.userUid!=0 ) return;
556
@@ -559,12 +560,12 @@
559 ** then there is no need to check user credentials.
560 **
561 ** This feature allows the "fossil ui" command to give the user
562 ** full access rights without having to log in.
563 */
564 zRemoteAddr = ipPrefix(PD("REMOTE_ADDR","nil"));
565 if( strcmp(zRemoteAddr, "127.0.0.1")==0
566 && g.useLocalauth
567 && db_get_int("localauth",0)==0
568 && P("HTTPS")==0
569 ){
570 uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
571
--- src/login.c
+++ src/login.c
@@ -546,11 +546,12 @@
546 **
547 */
548 void login_check_credentials(void){
549 int uid = 0; /* User id */
550 const char *zCookie; /* Text of the login cookie */
551 const char *zIpAddr; /* Raw IP address of the requestor */
552 char *zRemoteAddr; /* Abbreviated IP address of the requestor */
553 const char *zCap = 0; /* Capability string */
554
555 /* Only run this check once. */
556 if( g.userUid!=0 ) return;
557
@@ -559,12 +560,12 @@
560 ** then there is no need to check user credentials.
561 **
562 ** This feature allows the "fossil ui" command to give the user
563 ** full access rights without having to log in.
564 */
565 zRemoteAddr = ipPrefix(zIpAddr = PD("REMOTE_ADDR","nil"));
566 if( strcmp(zIpAddr, "127.0.0.1")==0
567 && g.useLocalauth
568 && db_get_int("localauth",0)==0
569 && P("HTTPS")==0
570 ){
571 uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
572

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button