LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File fakeident.diff of Package pimpd (Project home:lemmy04)

diff -urN pimpd-0.8.orig/pimpd.c pimpd-0.8/pimpd.c
--- pimpd-0.8.orig/pimpd.c	2002-03-04 14:01:19.000000000 +0100
+++ pimpd-0.8/pimpd.c	2004-06-30 19:33:37.904197718 +0200
@@ -17,6 +17,9 @@
  *	along with this program; if not, write to the Free Software
  *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
+ *	Changes after 0.8 (m.homann)
+ *		Added support for ~/.fakeident file containing a name to masquerade as
+ *
  * 	Changes from 0.7 -> 0.8
  * 		Changed -f to only reply with fakeid on an error.
  * 		Added -a to always respond with the fakeid.
@@ -158,8 +161,8 @@
 }
 
 int checktcp(struct ident *this) {
-	unsigned int clp, crp, uid;
-	char *buf, *noidentfile;
+	unsigned int clp, crp, uid, fakelen;
+	char *buf, *noidentfile, *fakeidentfile, *fakename;
 	struct in_addr clip, crip;
 	struct passwd *pwent;
 	FILE *fh, *fi;
@@ -190,6 +193,23 @@
 							*/
 						}
 					}
+					if(!noident) {
+						fakeidentfile = (char *) malloc(strlen(pwent->pw_dir) + 12);
+						fakename = (char *) malloc(80);
+						sprintf(fakeidentfile, "%s/.fakeident", pwent->pw_dir);
+						fi = fopen(fakeidentfile, "r");
+						if(fi) {
+							fakelen=fscanf(fi, "%s", fakename);
+							fclose(fi);
+							if (fakelen==EOF) {
+								syslog(LOG_INFO, "malformed .fakeident file in %s\r\n", pwent->pw_dir);
+								return errorresponse(this->localport, this->remoteport, "UNKNOWN-ERROR");
+							}
+							printf("%d , %d : USERID : UNIX :%s\r\n", this->localport, this->remoteport, fakename);  
+							syslog(LOG_INFO, "%d , %d : USERID : FAKED IDENT [%s masqueraded as %s]", this->localport, this->remoteport, pwent->pw_name, fakename);
+							return 1;
+						}
+					}
 					printf("%d , %d : USERID : UNIX :%s\r\n", this->localport, this->remoteport, pwent->pw_name);
 					syslog(LOG_INFO, "%d , %d : USERID : UNIX :%s", this->localport, this->remoteport, pwent->pw_name);
 					return 1;
diff -urN pimpd-0.8.orig/README pimpd-0.8/README
--- pimpd-0.8.orig/README	2002-03-04 14:04:37.000000000 +0100
+++ pimpd-0.8/README	2004-06-30 19:23:14.753029674 +0200
@@ -15,6 +15,10 @@
 
 CHANGES
 
+	0.8 -> 0.8a (test implementation by m.homann)
+	* added support for ~/.fakeident file, contains username to
+	  masquerade as
+
 	0.7 -> 0.8
 
 	* Changed -f to only reply with fakeid on an error.