*my_name = argp->mon_id.my_id.my_name;
struct my_id *id = &argp->mon_id.my_id;
char *path;
+ char *cp;
int fd;
notify_list *clnt;
struct in_addr my_addr;
goto failure;
}
my_addr.s_addr = htonl(INADDR_LOOPBACK);
- my_name = "127.0.0.1";
/* 2. Reject any registrations for non-lockd services.
*
goto failure;
}
+ /* my_name must not have white space */
+ for (cp=my_name ; *cp ; cp++)
+ if (*cp == ' ' || *cp == '\t' || *cp == '\r' || *cp == '\n')
+ *cp = '_';
+
/*
* Hostnames checked OK.
* Now choose a hostname to use for matching. We cannot
goto failure;
}
{
- char buf[LINELEN + 1 + SM_MAXSTRLEN + 2];
+ char buf[LINELEN + 1 + SM_MAXSTRLEN*2 + 4];
char *e;
int i;
e = buf + sprintf(buf, "%08x %08x %08x %08x ",
for (i=0; i<SM_PRIV_SIZE; i++)
e += sprintf(e, "%02x", 0xff & (argp->priv[i]));
if (e+1-buf != LINELEN) abort();
- e += sprintf(e, " %s\n", mon_name);
+ e += sprintf(e, " %s %s\n", mon_name, my_name);
write(fd, buf, e-buf);
}
while (fgets(buf, sizeof(buf), f) != NULL) {
int addr, proc, prog, vers;
char priv[SM_PRIV_SIZE];
+ char *monname, *myname;
char *b;
int i;
notify_list *clnt;
b = strchr(buf, '\n');
if (b) *b = 0;
sscanf(buf, "%x %x %x %x ",
- &addr, &prog, &vers, &proc);
+ &addr, &prog, &vers, &proc, myname);
b = buf+36;
for (i=0; i<SM_PRIV_SIZE; i++) {
sscanf(b, "%2x", &p);
b += 2;
}
b++;
- clnt = nlist_new("127.0.0.1", b, 0);
+ monname = b;
+ while (*b && *b != ' ') b++;
+ if (*b) *b++ = '\0';
+ while (*b == ' ') b++;
+ myname = b;
+ clnt = nlist_new(myname, monname, 0);
if (!clnt)
break;
NL_ADDR(clnt).s_addr = addr;
char *mon_name = argp->mon_name,
*my_name = argp->my_id.my_name;
struct my_id *id = &argp->my_id;
+ char *cp;
#ifdef RESTRICTED_STATD
struct in_addr caller;
#endif
inet_ntoa(caller));
goto failure;
}
- my_name = "127.0.0.1";
#endif
+ /* my_name must not have white space */
+ for (cp=my_name ; *cp ; cp++)
+ if (*cp == ' ' || *cp == '\t' || *cp == '\r' || *cp == '\n')
+ *cp = '_';
+
/* Check if we're monitoring anyone. */
if (!(clnt = rtnl)) {
inet_ntoa(caller));
goto failure;
}
- my_name = "127.0.0.1";
#endif
result.state = MY_STATE;