[mw-devel] MW3 r1095 - trunk/src

arthur at sucs.org arthur at sucs.org
Wed Oct 28 14:32:33 GMT 2009


Author: arthur
Date: 2009-10-28 14:32:33 +0000 (Wed, 28 Oct 2009)
New Revision: 1095

Modified:
   trunk/src/js.c
   trunk/src/main.c
   trunk/src/proto.h
   trunk/src/user.c
Log:
remove redundant checks for local username, decision is now entirely in getmylogin()


Modified: trunk/src/js.c
===================================================================
--- trunk/src/js.c	2009-10-28 13:54:17 UTC (rev 1094)
+++ trunk/src/js.c	2009-10-28 14:32:33 UTC (rev 1095)
@@ -992,7 +992,7 @@
 		return JS_FALSE;
 	}
 
-	if (strcasecmp(pw->pw_name, "bbs")==0) {
+	if (getmylogin()==NULL) {
 		JS_ReportError(cx, "bbs user is not allowed db access");
 		return JS_FALSE;
 	}
@@ -1309,7 +1309,7 @@
 		return -1;
 	}
 
-	if (strcasecmp(pw->pw_name, "bbs")==0) {
+	if (getmylogin()==NULL) {
 		is_local=0;
 	}
 

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-10-28 13:54:17 UTC (rev 1094)
+++ trunk/src/main.c	2009-10-28 14:32:33 UTC (rev 1095)
@@ -398,7 +398,7 @@
 	{
 		char *b;
 		b=(char *)getmylogin();
-		if (b!=NULL && strcmp(b,"bbs"))
+		if (b!=NULL)
 		{
 			if (is_old(user,b,&userposn))
 				list_new_items(user,TRUE);
@@ -409,7 +409,7 @@
 	{
 		char *b;
 		b=(char *)getmylogin();
-		if (b!=NULL && strcmp(b,"bbs"))
+		if (b!=NULL)
 		{
 			/* try and load user - dont care if it fails */
 			is_old(user,b,&userposn);
@@ -421,7 +421,7 @@
 	{
 		char *b;
 		b=(char *)getmylogin();
-		if (b!=NULL && strcmp(b,"bbs"))
+		if (b!=NULL)
 		{
 			/* try and load user - dont care if it fails */
 			is_old(user,b,&userposn);
@@ -433,7 +433,7 @@
 	{
 		char *b;
 		b=(char *)getmylogin();
-		if (b!=NULL && strcmp(b,"bbs"))
+		if (b!=NULL)
 		{
 			/* try and load user - if ok, view since info */
 			if (is_old(user,b,&userposn))

Modified: trunk/src/proto.h
===================================================================
--- trunk/src/proto.h	2009-10-28 13:54:17 UTC (rev 1094)
+++ trunk/src/proto.h	2009-10-28 14:32:33 UTC (rev 1095)
@@ -11,6 +11,7 @@
 #include "bb.h"
 
 /* user.c */
+char *getmylogin(void);
 void update_user(struct person *record, int32_t userposn);
 void fetch_user(struct person *record, int32_t userposn);
 void login_ok(struct person *usr, int32_t *userposn, int *autochat);

Modified: trunk/src/user.c
===================================================================
--- trunk/src/user.c	2009-10-28 13:54:17 UTC (rev 1094)
+++ trunk/src/user.c	2009-10-28 14:32:33 UTC (rev 1095)
@@ -341,8 +341,7 @@
 		show_user_stats(tmp->status,buff,FALSE);
 		printf(_("Status set to [%s]\n"),buff);
 	/* if you have a SUCS account, allow auto-registering if the logon name matches the sucs name */
-	/* a special restricted uid */
-	}else if (getuid()!=119 && !internet && getmylogin()!=NULL && !strcasecmp(getmylogin(),tmp->name))
+	}else if (!internet && getmylogin()!=NULL && !strcasecmp(getmylogin(),tmp->name))
 	{
 		tmp->status|=1;
 		tmp->groups|=1;




More information about the mw-devel mailing list