summaryrefslogtreecommitdiff
path: root/lib/ZLocations.c
diff options
context:
space:
mode:
authorGravatar Robert S. French <rfrench@mit.edu>1987-06-25 23:35:02 +0000
committerGravatar Robert S. French <rfrench@mit.edu>1987-06-25 23:35:02 +0000
commit2c8deb46a0f8da453f53e167a2e90f83fb50fd4c (patch)
tree05a4de0b5b0062d87d4563d3add5bb39af59d5e0 /lib/ZLocations.c
parent6e0a23514dfcd08657ceae8aed4dd05d185acebc (diff)
safety
Diffstat (limited to 'lib/ZLocations.c')
-rw-r--r--lib/ZLocations.c39
1 files changed, 33 insertions, 6 deletions
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 <zephyr/zephyr_internal.h>
+#include <pwd.h>
+#include <sys/file.h>
+
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(&notice,1));
+ if ((retval = ZSendNotice(&notice,1)) != ZERR_NONE)
+ return (retval);
+
+ if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,0,
+ Z_UIDpred,(char *)&notice.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);
}