Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830919); site kaist.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!zehntel!hplabs!kaist!jhhur From: jhhur@kaist.UUCP (Hur, Jinho) Newsgroups: net.sources Subject: Re: Phone program source Message-ID: <1267@kaist.UUCP> Date: Mon, 14-Jan-85 11:54:53 EST Article-I.D.: kaist.1267 Posted: Mon Jan 14 11:54:53 1985 Date-Received: Thu, 17-Jan-85 12:56:58 EST References: <206@isucs1.UUCP> Organization: KAIST, Seoul, Republic of Korea Lines: 70 The phone program has some anomaly. When user A su'ed on the login by B, phone to C, then the message to C says that A rings C. But when C tries to ring A by 'phone A', 'User not logged in' message appears. It is since phone uses getpwuid(getuid()) for the local user name. It is to be corrected as follows to avoid such anomaly. *** phone.c Sun Jan 13 22:51:31 1985 --- phone.c.old Sun Jan 13 22:50:09 1985 *************** *** 26,32 int dpid; /* daemon pid */ char psockname[80]; /* phone socket name */ struct passwd *pw; /* pointer to password structure */ - struct passwd *getpwnam(); int nodaemon(),daemonstarted(); /* predeclare for signal */ char *getlogin(); /* to avoid confusion. */ --- 26,31 ----- int dpid; /* daemon pid */ char psockname[80]; /* phone socket name */ struct passwd *pw; /* pointer to password structure */ int nodaemon(),daemonstarted(); /* predeclare for signal */ /* Check the number of arguments */ *************** *** 28,34 struct passwd *pw; /* pointer to password structure */ struct passwd *getpwnam(); int nodaemon(),daemonstarted(); /* predeclare for signal */ - char *getlogin(); /* to avoid confusion. */ /* Check the number of arguments */ if (argc < 2) { --- 27,32 ----- char psockname[80]; /* phone socket name */ struct passwd *pw; /* pointer to password structure */ int nodaemon(),daemonstarted(); /* predeclare for signal */ /* Check the number of arguments */ if (argc < 2) { *************** *** 53,60 } /* Get my user name from the uid and the passwd file */ ! pw = getpwnam(getlogin()); ! /* pw = getpwuid(getuid()); */ if (pw == 0) { printf("Can't get your login name."); _exit(1); --- 51,57 ----- } /* Get my user name from the uid and the passwd file */ ! pw = getpwuid(getuid()); if (pw == 0) { printf("Can't get your login name."); _exit(1); -- Hur, Jinho Dept of Computer Science, KAIST uucp: hplabs!kaist!jhhur csnet: jhhur%kaist@csnet-relay.csnet -- real: Hur, Jinho Dept of Computer Science, KAIST uucp: ..!hplabs!kaist!jhhur csnet: jhhur%kaist.csnet@csnet.arpa