X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fstatd%2Fsm-notify.c;h=3259a3e973d774de310f93065fcc1c867a026124;hb=6295bb04c73403a219bc96cc6770fc96bec19ba6;hp=8d90d1f30f7ebdaacaa893d91944c8a7d1ab1c9e;hpb=18c3a41364836e61ceeb8e615e2b059904c5b65f;p=nfs-utils.git diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c index 8d90d1f..3259a3e 100644 --- a/utils/statd/sm-notify.c +++ b/utils/statd/sm-notify.c @@ -29,6 +29,7 @@ #include #include +#include "sockaddr.h" #include "xlog.h" #include "nsm.h" #include "nfsrpc.h" @@ -43,6 +44,8 @@ struct nsm_host { struct nsm_host * next; char * name; + char * mon_name; + char * my_name; struct addrinfo *ai; time_t last_used; time_t send_next; @@ -92,7 +95,8 @@ smn_lookup(const char *name) __attribute_malloc__ static struct nsm_host * -smn_alloc_host(const char *hostname, const time_t timestamp) +smn_alloc_host(const char *hostname, const char *mon_name, + const char *my_name, const time_t timestamp) { struct nsm_host *host; @@ -101,7 +105,14 @@ smn_alloc_host(const char *hostname, const time_t timestamp) goto out_nomem; host->name = strdup(hostname); - if (host->name == NULL) { + host->mon_name = strdup(mon_name); + host->my_name = strdup(my_name); + if (host->name == NULL || + host->mon_name == NULL || + host->my_name == NULL) { + free(host->my_name); + free(host->mon_name); + free(host->name); free(host); goto out_nomem; } @@ -119,10 +130,13 @@ out_nomem: static void smn_forget_host(struct nsm_host *host) { - xlog(D_CALL, "Removing %s from notify list", host->name); + xlog(D_CALL, "Removing %s (%s, %s) from notify list", + host->name, host->mon_name, host->my_name); - nsm_delete_notified_host(host->name); + nsm_delete_notified_host(host->name, host->mon_name, host->my_name); + free(host->my_name); + free(host->mon_name); free(host->name); if (host->ai) freeaddrinfo(host->ai); @@ -133,12 +147,12 @@ static void smn_forget_host(struct nsm_host *host) static unsigned int smn_get_host(const char *hostname, __attribute__ ((unused)) const struct sockaddr *sap, - __attribute__ ((unused)) const struct mon *m, - const time_t timestamp) + const struct mon *m, const time_t timestamp) { struct nsm_host *host; - host = smn_alloc_host(hostname, timestamp); + host = smn_alloc_host(hostname, + m->mon_id.mon_name, m->mon_id.my_id.my_name, timestamp); if (host == NULL) return 0;