6 #include <moira_site.h>
9 #include <sys/socket.h>
10 #include <netinet/in.h>
15 /******* temporary ********/
16 char *atot(s) char *s; { return s; }
19 static save_info(argc, argv, sq)
22 struct save_queue *sq;
24 sq_save_args(argc, argv, sq);
28 int DisplayCallback(argc, info, form)
33 char buf[1024], name[128];
34 char *MOD_FORMAT = "Modified by %s at %s with %s\n";
37 switch (form->menu->operation) {
39 sprintf(name, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
40 sprintf(buf, "Login name: %-20s Full name: %s\n", info[U_NAME], name);
42 sprintf(buf, "User id: %-23s Login shell %-10s Class: %s\n",
43 info[U_UID], info[U_SHELL], info[U_CLASS]);
45 sprintf(buf, "Account is: %-20s Encrypted MIT ID number: %s\n",
46 user_states[atoi(info[U_STATE])], info[U_MITID]);
48 sprintf(buf, MOD_FORMAT,
49 info[U_MODBY], info[U_MODTIME],info[U_MODWITH]);
53 sprintf(buf, "Finger information for user %s:\n", info[F_NAME]);
55 sprintf(buf, "Login name: %-27s In real life: %s\n", info[F_NAME],
58 sprintf(buf, "Nickname: %-29s Department: %s\n", info[F_NICKNAME],
61 sprintf(buf, "Home: %-33s Home phone: %s\n", info[F_HOME_ADDR],
64 sprintf(buf, "Office: %-31s Office phone: %s\n", info[F_OFFICE_ADDR],
65 info[F_OFFICE_PHONE]);
67 sprintf(buf, MOD_FORMAT, info[F_MODBY], info[F_MODTIME],
72 sprintf(buf, "Post Office information for user %s:\n", info[PO_NAME]);
74 sprintf(buf, "type: %-8s Box: %s\n", info[PO_TYPE], info[PO_BOX]);
76 sprintf(buf, MOD_FORMAT, info[4], info[3], info[5]);
80 sprintf(buf, "Kerberos mapping: User %-9s Principal %s\n",
81 info[KMAP_USER], info[KMAP_PRINCIPAL]);
86 if (!strcmp(info[FS_TYPE], "FSGROUP")) {
89 struct save_queue *sq;
91 sprintf(buf,"%20s Filesystem Group: %s\n", " ", info[FS_NAME]);
94 sprintf(buf,"Comments: %s\n",info[FS_COMMENTS]);
96 sprintf(buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME],
99 AppendToLog("Containing the filesystems (in order):");
102 if ((stat = MoiraQuery("get_fsgroup_members", 1, &info[FS_NAME],
103 save_info, (char *)sq)) != 0) {
104 if (stat == MR_NO_MATCH)
105 AppendToLog(" [no members]");
107 com_err(program_name, stat, NULL);
109 while (sq_get_data(sq, &argv)) {
110 sprintf(buf, " Filesystem: %-32s (sort key: %s)",
119 sprintf(buf,"Filesystem: %s\n", info[FS_NAME]);
121 sprintf(buf,"Type: %-40s Machine: %-15s\n",
122 info[FS_TYPE], info[FS_MACHINE]);
124 sprintf(buf,"Default Access: %-2s Packname: %-17s Mountpoint %s \n",
125 info[FS_ACCESS], info[FS_PACK], info[FS_M_POINT]);
127 sprintf(buf,"Comments: %s\n",info[FS_COMMENTS]);
129 sprintf(buf, "User Ownership: %-30s Group Ownership: %s\n",
130 info[FS_OWNER], info[FS_OWNERS]);
132 sprintf(buf, "Auto Create: %-34s Locker Type: %s\n",
133 atoi(info[FS_CREATE]) ? "ON" : "OFF",
136 sprintf(buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME],
142 sprintf(buf,"Machine: %-20s Directory: %-15s Device: %s\n",
143 info[NFS_NAME], info[NFS_DIR], info[NFS_DEVICE]);
145 sprintf(buf, "Status: %s\n",
146 format_filesys_type(info[NFS_STATUS]));
148 sprintf(buf, "Quota Allocated: %-17s Size: %s\n",
149 info[NFS_ALLOC], info[NFS_SIZE]);
151 sprintf(buf, MOD_FORMAT, info[NFS_MODBY], info[NFS_MODTIME],
156 if (!strcmp(info[Q_TYPE], "ANY"))
157 sprintf(buf, "Filesystem: %s\n", info[Q_FILESYS]);
159 sprintf(buf, "Filesystem: %-45s %s %s\n", info[Q_FILESYS],
160 info[Q_TYPE], info[Q_NAME]);
162 sprintf(buf, "Machine: %-20s Directory: %-15s\n",
163 info[Q_MACHINE], info[Q_DIRECTORY]);
165 sprintf(buf, "Quota: %s\n", info[Q_QUOTA]);
167 sprintf(buf, MOD_FORMAT, info[Q_MODBY], info[Q_MODTIME], info[Q_MODWITH]);
171 (void) sprintf(buf, "List: %s\n", info[L_NAME]);
173 (void) sprintf(buf, "Description: %s\n", info[L_DESC]);
175 if ( atoi(info[L_MAILLIST]))
176 AppendToLog("This list is a mailing list.\n");
178 AppendToLog("This list is NOT a mailing list.\n");
179 if (atoi(info[L_GROUP])) {
180 (void) sprintf(buf,"This list is a Group and its ID number is %s\n",
184 AppendToLog("This list is NOT a Group.\n");
185 if (strcmp(info[L_ACE_TYPE],"NONE") == 0)
186 AppendToLog("This list has no Administrator, how strange?!\n");
188 sprintf(buf, "The Administrator of this list is the %s: %s\n",
189 info[L_ACE_TYPE], info[L_ACE_NAME]);
192 (void) sprintf(buf, "This list is: %s, %s, and %s\n",
193 atoi(info[L_ACTIVE]) ? "active" : "inactive",
194 atoi(info[L_PUBLIC]) ? "public" : "private",
195 atoi(info[L_HIDDEN]) ? "hidden" : "visible");
197 sprintf(buf, MOD_FORMAT, info[L_MODBY], info[L_MODTIME], info[L_MODWITH]);
201 sprintf(buf, "Machine: %-30s Type: %s\n", info[M_NAME], info[M_TYPE]);
203 sprintf(buf, MOD_FORMAT, info[M_MODBY], info[M_MODTIME], info[M_MODWITH]);
206 case MM_SHOW_CLUSTER:
207 sprintf(buf, "Cluster: %s\n", info[C_NAME]);
209 sprintf(buf, "Description: %s\n", info[C_DESCRIPT]);
211 sprintf(buf, "Location: %s\n", info[C_LOCATION]);
213 sprintf(buf, MOD_FORMAT, info[C_MODBY], info[C_MODTIME], info[C_MODWITH]);
217 sprintf(buf, "Cluster: %-20s Label: %-15s Data: %s\n",
218 info[CD_NAME], info[CD_LABEL], info[CD_DATA]);
222 sprintf(buf, "Machine: %-20s Cluster: %s\n", info[0], info[1]);
225 case MM_SHOW_MEMBERS:
227 sprintf(buf, "%-9s %s\n", info[0], info[1]);
229 sprintf(buf, "%s\n", info[0]);
233 sprintf(buf, "Table: %-20s Modified: %s\n", info[0], info[5]);
235 sprintf(buf, " %-8D appends, %-8d updates, %-8d deletes\n",
236 info[2], info[3], info[4]);
241 unsigned long host_address;
242 struct hostent *host_entry;
244 host_address = inet_addr(info[1]);
245 if (host_address != NULL) {
246 host_entry = gethostbyaddr((char *)&host_address, 4, AF_INET);
247 if (host_entry != NULL) {
249 info[1] = strsave(host_entry->h_name);
253 sprintf(buf, "Principal %s on %s (%s)\n", info[0], info[1], info[2]);
255 sprintf(buf, " Connected at %s, client %s\n", info[3], info[4]);
259 sprintf(buf, "Variable: %-20s Value: %s\n", stringval(form, 0),
264 sprintf(buf, "Alias: %-20s Type: %-8s Value: %s\n",
265 info[0], info[1], info[2]);
269 sprintf(buf, "%s:%s mod by %s on %s with %s\n", info[SH_MACHINE],
270 info[SH_SERVICE], info[SH_MODBY], info[SH_MODTIME],
273 if (atoi(info[SH_HOSTERROR]))
274 sprintf(name, "Error %d: %s", atoi(info[SH_HOSTERROR]),
277 strcpy(name, "No error");
278 sprintf(buf, " %s/%s/%s/%s/%s\n",
279 atoi(info[SH_ENABLE]) ? "Enabled" : "Disabled",
280 atoi(info[SH_SUCCESS]) ? "Success" : "Failure",
281 atoi(info[SH_INPROGRESS]) ? "InProgress" : "Idle",
282 atoi(info[SH_OVERRIDE]) ? "Override" : "Normal", name);
284 AppendToLog(" Last Try Last Success Value1 Value2 Value3\n");
285 strcpy(name, atot(info[SH_LASTTRY]));
286 sprintf(buf, " %-20s %-20s %-9d %-9d %s\n", name,
287 atot(info[SH_LASTSUCCESS]), atoi(info[SH_VALUE1]),
288 atoi(info[SH_VALUE2]), info[SH_VALUE3]);
292 sprintf(buf, "The default quota is %s Kbytes.\n", info[0]);
297 sprintf(buf, "%s:%s\n", info[0], info[1]);
299 sprintf(buf, "%s\n", info[0]);
303 sprintf(buf, "Printer: %-35s Spool host: %s\n", info[PCAP_NAME],
304 info[PCAP_SPOOL_HOST]);
306 sprintf(buf, "Spool directory: %-27s Remote Printer Name: %s\n",
307 info[PCAP_SPOOL_DIR], info[PCAP_RPRINTER]);
309 sprintf(buf, "Authentication: %-3s Price/page: %-3s Quota Server: %s\n",
310 atoi(info[PCAP_AUTH]) ? "yes" : "no",
311 info[PCAP_PRICE], info[PCAP_QSERVER]);
313 sprintf(buf, "Comments: %s\n", info[PCAP_COMMENTS]);
315 sprintf(buf, MOD_FORMAT, info[PCAP_MODBY], info[PCAP_MODTIME],
320 sprintf(buf, "Zephyr class: %s\n", info[ZA_CLASS]);
322 if (!strcmp("NONE", info[ZA_XMT_TYPE]))
325 sprintf(name, "Name: %s", info[ZA_XMT_ID]);
326 sprintf(buf, "XMT ACL Type %s %s\n", info[ZA_XMT_TYPE], name);
328 if (!strcmp("NONE", info[ZA_SUB_TYPE]))
331 sprintf(name, "Name: %s", info[ZA_SUB_ID]);
332 sprintf(buf, "SUB ACL Type %s %s\n", info[ZA_SUB_TYPE], name);
334 if (!strcmp("NONE", info[ZA_IWS_TYPE]))
337 sprintf(name, "Name: %s", info[ZA_IWS_ID]);
338 sprintf(buf, "IWS ACL Type %s %s\n", info[ZA_IWS_TYPE], name);
340 if (!strcmp("NONE", info[ZA_IUI_TYPE]))
343 sprintf(name, "Name: %s", info[ZA_IUI_ID]);
344 sprintf(buf, "IUI ACL Type %s %s\n", info[ZA_IUI_TYPE], name);
348 for (i = 0; i < argc; i++) {
349 if (i != 0) AppendToLog(", ");
350 AppendToLog(info[i]);