From: Jeffrey Hutzelman Date: Fri, 5 Oct 2001 21:58:00 +0000 (+0000) Subject: ptclient-add-lh-command-20011005 X-Git-Tag: openafs-devel-1_3_0~258 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f6ff74b46b789b5ae94654f0481b892417311a49;p=packages%2Fo%2Fopenafs.git ptclient-add-lh-command-20011005 The attached patch adds a new 'lh' command to the ptclient utility. Analogous to 'l', this command lists the hostCPS for a specified host. --- diff --git a/src/ptserver/ptclient.c b/src/ptserver/ptclient.c index 7311c2d2a..8fa312ff0 100644 --- a/src/ptserver/ptclient.c +++ b/src/ptserver/ptclient.c @@ -22,6 +22,7 @@ RCSID("$Header$"); #else #include #endif +#include #include #include #include @@ -163,6 +164,8 @@ char **argv; prlist alist; idlist lid; namelist lnames; + struct hostent *hostinfo; + struct in_addr *hostaddr; afs_int32 *ptr; char *foo; afs_int32 over; @@ -404,6 +407,31 @@ char **argv; alist.prlist_val = 0; } } + else if (!strcmp(op,"lh")) { + alist.prlist_len = 0; + alist.prlist_val = 0; + /* scanf("%d",&id); */ + if (GetString(name, sizeof(name))) code = PRBADARG; + else if (!(hostinfo = gethostbyname(name))) code = PRBADARG; + else { + hostaddr = hostinfo->h_addr_list[0]; + id = ntohl(hostaddr->s_addr); + code = ubik_Call(PR_GetHostCPS,pruclient,0,id, &alist, &over); + } + if (CodeOk(code)) printf("%s\n",pr_ErrorMsg(code)); + if (code == PRSUCCESS) { + ptr = alist.prlist_val; + if (over) { + printf("Number of groups greater than PR_MAXGROUPS!\n"); + printf("Excess of %d.\n",over); + } + for (i=0;i