From 2c8deb46a0f8da453f53e167a2e90f83fb50fd4c Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Thu, 25 Jun 1987 23:35:02 +0000 Subject: safety --- lib/ZLocations.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'lib/ZLocations.c') diff --git a/lib/ZLocations.c b/lib/ZLocations.c index 670a61c..e9cc83c 100644 --- a/lib/ZLocations.c +++ b/lib/ZLocations.c @@ -16,18 +16,45 @@ #include +#include +#include + Code_t ZSetLocation() { - ZNotice_t notice; - - notice.z_kind = UNACKED; + int retval,quiet; + ZNotice_t notice,retnotice; + ZPacket_t buffer; + char bfr[BUFSIZ]; + struct passwd *pw; + + quiet = 0; + if (pw = getpwuid(getuid())) { + sprintf(bfr,"%s/.hideme",pw->pw_dir); + quiet = !access(bfr,F_OK); + } + + notice.z_kind = ACKED; notice.z_port = 0; notice.z_class = LOGIN_CLASS; - notice.z_class_inst = (char *)Z_GetSender(); - notice.z_opcode = LOGIN_USER_LOGIN; + notice.z_class_inst = ZGetSender(); + notice.z_opcode = quiet?LOGIN_QUIET_LOGIN:LOGIN_USER_LOGIN; notice.z_sender = 0; notice.z_recipient = ""; notice.z_message_len = 0; - return (ZSendNotice(¬ice,1)); + if ((retval = ZSendNotice(¬ice,1)) != ZERR_NONE) + return (retval); + + if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,0, + Z_UIDpred,(char *)¬ice.z_uid)) != + ZERR_NONE) + return (retval); + + if (retnotice.z_kind == SERVNAK) + return (ZERR_SERVNAK); + + if (retnotice.z_kind != SERVACK) + return (ZERR_INTERNAL); + + return (ZERR_NONE); } -- cgit v1.2.3