29b54605646eca5e23aca48869c9fe317b9d4821
[citadel.git] / citadel / modules / ctdlproto / serv_file.c
1 /* 
2  * Server functions which handle file transfers and room directories.
3  *
4  * Copyright (c) 1987-2018 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #include <stdlib.h>
16 #include <unistd.h>
17 #include <stdio.h>
18 #include <netdb.h>
19 #include <libcitadel.h>
20 #include <dirent.h>
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 #include "ctdl_module.h"
24 #include "citserver.h"
25 #include "support.h"
26 #include "config.h"
27 #include "user_ops.h"
28
29
30 /*
31  * Server command to delete a file from a room's directory
32  */
33 void cmd_delf(char *filename)
34 {
35         char pathname[64];
36         int a;
37
38         if (CtdlAccessCheck(ac_room_aide))
39                 return;
40
41         if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
42                 cprintf("%d No directory in this room.\n", ERROR + NOT_HERE);
43                 return;
44         }
45
46         if (IsEmptyStr(filename)) {
47                 cprintf("%d You must specify a file name.\n", ERROR + FILE_NOT_FOUND);
48                 return;
49         }
50         for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
51                 if ( (filename[a] == '/') || (filename[a] == '\\') ) {
52                         filename[a] = '_';
53                 }
54         }
55         snprintf(pathname, sizeof pathname,
56                  "%s/%s/%s",
57                  ctdl_file_dir,
58                  CC->room.QRdirname, filename
59         );
60         a = unlink(pathname);
61         if (a == 0) {
62                 cprintf("%d File '%s' deleted.\n", CIT_OK, pathname);
63         }
64         else {
65                 cprintf("%d File '%s' not found.\n", ERROR + FILE_NOT_FOUND, pathname);
66         }
67 }
68
69
70 /*
71  * move a file from one room directory to another
72  */
73 void cmd_movf(char *cmdbuf)
74 {
75         char filename[PATH_MAX];
76         char pathname[PATH_MAX];
77         char newpath[PATH_MAX];
78         char newroom[ROOMNAMELEN];
79         char buf[PATH_MAX];
80         int a;
81         struct ctdlroom qrbuf;
82
83         extract_token(filename, cmdbuf, 0, '|', sizeof filename);
84         extract_token(newroom, cmdbuf, 1, '|', sizeof newroom);
85
86         if (CtdlAccessCheck(ac_room_aide)) return;
87
88         if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
89                 cprintf("%d No directory in this room.\n", ERROR + NOT_HERE);
90                 return;
91         }
92
93         if (IsEmptyStr(filename)) {
94                 cprintf("%d You must specify a file name.\n", ERROR + FILE_NOT_FOUND);
95                 return;
96         }
97
98         for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
99                 if ( (filename[a] == '/') || (filename[a] == '\\') ) {
100                         filename[a] = '_';
101                 }
102         }
103         snprintf(pathname, sizeof pathname, "./files/%s/%s", CC->room.QRdirname, filename);
104         if (access(pathname, 0) != 0) {
105                 cprintf("%d File '%s' not found.\n", ERROR + FILE_NOT_FOUND, pathname);
106                 return;
107         }
108
109         if (CtdlGetRoom(&qrbuf, newroom) != 0) {
110                 cprintf("%d '%s' does not exist.\n", ERROR + ROOM_NOT_FOUND, newroom);
111                 return;
112         }
113         if ((qrbuf.QRflags & QR_DIRECTORY) == 0) {
114                 cprintf("%d '%s' is not a directory room.\n", ERROR + NOT_HERE, qrbuf.QRname);
115                 return;
116         }
117         snprintf(newpath, sizeof newpath, "./files/%s/%s", qrbuf.QRdirname, filename);
118         if (link(pathname, newpath) != 0) {
119                 cprintf("%d Couldn't move file: %s\n", ERROR + INTERNAL_ERROR, strerror(errno));
120                 return;
121         }
122         unlink(pathname);
123
124         /* this is a crude method of copying the file description */
125         snprintf(buf, sizeof buf, "cat ./files/%s/filedir |grep \"%s\" >>./files/%s/filedir", CC->room.QRdirname, filename, qrbuf.QRdirname);
126         system(buf);
127         cprintf("%d File '%s' has been moved.\n", CIT_OK, filename);
128 }
129
130
131 /*
132  * This code is common to all commands which open a file for downloading,
133  * regardless of whether it's a file from the directory, an image, a network
134  * spool file, a MIME attachment, etc.
135  * It examines the file and displays the OK result code and some information
136  * about the file.  NOTE: this stuff is Unix dependent.
137  */
138 void OpenCmdResult(char *filename, const char *mime_type)
139 {
140         struct stat statbuf;
141         time_t modtime;
142         long filesize;
143
144         fstat(fileno(CC->download_fp), &statbuf);
145         CC->download_fp_total = statbuf.st_size;
146         filesize = (long) statbuf.st_size;
147         modtime = (time_t) statbuf.st_mtime;
148
149         cprintf("%d %ld|%ld|%s|%s\n", CIT_OK, filesize, (long)modtime, filename, mime_type);
150 }
151
152
153 /*
154  * open a file for downloading
155  */
156 void cmd_open(char *cmdbuf)
157 {
158         char filename[256];
159         char pathname[PATH_MAX];
160         int a;
161
162         extract_token(filename, cmdbuf, 0, '|', sizeof filename);
163
164         if (CtdlAccessCheck(ac_logged_in)) return;
165
166         if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
167                 cprintf("%d No directory in this room.\n", ERROR + NOT_HERE);
168                 return;
169         }
170
171         if (IsEmptyStr(filename)) {
172                 cprintf("%d You must specify a file name.\n", ERROR + FILE_NOT_FOUND);
173                 return;
174         }
175         if (strstr(filename, "../") != NULL)
176         {
177                 cprintf("%d syntax error.\n", ERROR + ILLEGAL_VALUE);
178                 return;
179         }
180
181         if (CC->download_fp != NULL) {
182                 cprintf("%d You already have a download file open.\n", ERROR + RESOURCE_BUSY);
183                 return;
184         }
185
186         for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
187                 if ( (filename[a] == '/') || (filename[a] == '\\') ) {
188                         filename[a] = '_';
189                 }
190         }
191
192         snprintf(pathname, sizeof pathname, "%s/%s/%s", ctdl_file_dir, CC->room.QRdirname, filename);
193         CC->download_fp = fopen(pathname, "r");
194
195         if (CC->download_fp == NULL) {
196                 cprintf("%d cannot open %s: %s\n", ERROR + INTERNAL_ERROR, pathname, strerror(errno));
197                 return;
198         }
199
200         OpenCmdResult(filename, "application/octet-stream");
201 }
202
203
204 /*
205  * open an image file
206  */
207 void cmd_oimg(char *cmdbuf)
208 {
209         char filename[PATH_MAX];
210         char pathname[PATH_MAX];
211         char MimeTestBuf[32];
212         int rv;
213
214         extract_token(filename, cmdbuf, 0, '|', sizeof filename);
215
216         if (IsEmptyStr(filename)) {
217                 cprintf("%d You must specify a file name.\n", ERROR + FILE_NOT_FOUND);
218                 return;
219         }
220
221         if (CC->download_fp != NULL) {
222                 cprintf("%d You already have a download file open.\n", ERROR + RESOURCE_BUSY);
223                 return;
224         }
225
226         CC->download_fp = fopen(pathname, "rb");
227         if (CC->download_fp == NULL) {
228                 strcat(pathname, ".gif");
229                 CC->download_fp = fopen(pathname, "rb");
230         }
231         if (CC->download_fp == NULL) {
232                 cprintf("%d Cannot open %s: %s\n", ERROR + FILE_NOT_FOUND, pathname, strerror(errno));
233                 return;
234         }
235         rv = fread(&MimeTestBuf[0], 1, 32, CC->download_fp);
236         if (rv == -1) {
237                 cprintf("%d Cannot access %s: %s\n", ERROR + FILE_NOT_FOUND, pathname, strerror(errno));
238                 return;
239         }
240
241         rewind (CC->download_fp);
242         OpenCmdResult(pathname, GuessMimeType(&MimeTestBuf[0], 32));
243 }
244
245
246 /*
247  * open a file for uploading
248  */
249 void cmd_uopn(char *cmdbuf)
250 {
251         int a;
252
253         extract_token(CC->upl_file, cmdbuf, 0, '|', sizeof CC->upl_file);
254         extract_token(CC->upl_mimetype, cmdbuf, 1, '|', sizeof CC->upl_mimetype);
255         extract_token(CC->upl_comment, cmdbuf, 2, '|', sizeof CC->upl_comment);
256
257         if (CtdlAccessCheck(ac_logged_in)) return;
258
259         if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
260                 cprintf("%d No directory in this room.\n", ERROR + NOT_HERE);
261                 return;
262         }
263
264         if (IsEmptyStr(CC->upl_file)) {
265                 cprintf("%d You must specify a file name.\n", ERROR + FILE_NOT_FOUND);
266                 return;
267         }
268
269         if (CC->upload_fp != NULL) {
270                 cprintf("%d You already have a upload file open.\n", ERROR + RESOURCE_BUSY);
271                 return;
272         }
273
274         for (a = 0; !IsEmptyStr(&CC->upl_file[a]); ++a) {
275                 if ( (CC->upl_file[a] == '/') || (CC->upl_file[a] == '\\') ) {
276                         CC->upl_file[a] = '_';
277                 }
278         }
279         snprintf(CC->upl_path, sizeof CC->upl_path, "%s/%s/%s", ctdl_file_dir, CC->room.QRdirname, CC->upl_file);
280         snprintf(CC->upl_filedir, sizeof CC->upl_filedir, "%s/%s/filedir", ctdl_file_dir, CC->room.QRdirname);
281
282         CC->upload_fp = fopen(CC->upl_path, "r");
283         if (CC->upload_fp != NULL) {
284                 fclose(CC->upload_fp);
285                 CC->upload_fp = NULL;
286                 cprintf("%d '%s' already exists\n", ERROR + ALREADY_EXISTS, CC->upl_path);
287                 return;
288         }
289
290         CC->upload_fp = fopen(CC->upl_path, "wb");
291         if (CC->upload_fp == NULL) {
292                 cprintf("%d Cannot open %s: %s\n", ERROR + INTERNAL_ERROR, CC->upl_path, strerror(errno));
293                 return;
294         }
295         cprintf("%d Ok\n", CIT_OK);
296 }
297
298
299 /*
300  * open an image file for uploading
301  */
302 void cmd_uimg(char *cmdbuf)
303 {
304         int is_this_for_real;
305         char basenm[256];
306         int a;
307
308         if (num_parms(cmdbuf) < 2) {
309                 cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE);
310                 return;
311         }
312
313         is_this_for_real = extract_int(cmdbuf, 0);
314         extract_token(CC->upl_mimetype, cmdbuf, 1, '|', sizeof CC->upl_mimetype);
315         extract_token(basenm, cmdbuf, 2, '|', sizeof basenm);
316         if (CC->upload_fp != NULL) {
317                 cprintf("%d You already have an upload file open.\n", ERROR + RESOURCE_BUSY);
318                 return;
319         }
320
321         strcpy(CC->upl_path, "");
322
323         for (a = 0; !IsEmptyStr(&basenm[a]); ++a) {
324                 basenm[a] = tolower(basenm[a]);
325                 if ( (basenm[a] == '/') || (basenm[a] == '\\') ) {
326                         basenm[a] = '_';
327                 }
328         }
329
330         if (CC->user.axlevel >= AxAideU) {
331                 snprintf(CC->upl_path, sizeof CC->upl_path, "%s/%s", ctdl_image_dir, basenm);
332         }
333
334         if (IsEmptyStr(CC->upl_path)) {
335                 cprintf("%d Higher access required.\n", ERROR + HIGHER_ACCESS_REQUIRED);
336                 return;
337         }
338
339         if (is_this_for_real == 0) {
340                 cprintf("%d Ok to send image\n", CIT_OK);
341                 return;
342         }
343
344         CC->upload_fp = fopen(CC->upl_path, "wb");
345         if (CC->upload_fp == NULL) {
346                 cprintf("%d Cannot open %s: %s\n", ERROR + INTERNAL_ERROR, CC->upl_path, strerror(errno));
347                 return;
348         }
349         cprintf("%d Ok\n", CIT_OK);
350         CC->upload_type = UPL_IMAGE;
351 }
352
353
354 /*
355  * close the download file
356  */
357 void cmd_clos(char *cmdbuf)
358 {
359         char buf[256];
360
361         if (CC->download_fp == NULL) {
362                 cprintf("%d You don't have a download file open.\n", ERROR + RESOURCE_NOT_OPEN);
363                 return;
364         }
365
366         fclose(CC->download_fp);
367         CC->download_fp = NULL;
368         cprintf("%d Ok\n", CIT_OK);
369 }
370
371
372 /*
373  * abort an upload
374  */
375 void abort_upl(CitContext *who)
376 {
377         if (who->upload_fp != NULL) {
378                 fclose(who->upload_fp);
379                 who->upload_fp = NULL;
380                 unlink(CC->upl_path);
381         }
382 }
383
384
385 /*
386  * close the upload file
387  */
388 void cmd_ucls(char *cmd)
389 {
390         struct CitContext *CCC = CC;
391         FILE *fp;
392         char upload_notice[512];
393         static int seq = 0;
394
395         if (CCC->upload_fp == NULL) {
396                 cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
397                 return;
398         }
399
400         fclose(CC->upload_fp);
401         CCC->upload_fp = NULL;
402
403         if (!strcasecmp(cmd, "1")) {
404                 cprintf("%d File '%s' saved.\n", CIT_OK, CCC->upl_path);
405                 fp = fopen(CCC->upl_filedir, "a");
406                 if (fp == NULL) {
407                         fp = fopen(CCC->upl_filedir, "w");
408                 }
409                 if (fp != NULL) {
410                         fprintf(fp, "%s %s %s\n", CCC->upl_file, CCC->upl_mimetype, CCC->upl_comment);
411                         fclose(fp);
412                 }
413
414                 if ((CCC->room.QRflags2 & QR2_NOUPLMSG) == 0) {
415                         /* put together an upload notice */
416                         snprintf(upload_notice, sizeof upload_notice,
417                                  "NEW UPLOAD: '%s'\n %s\n%s\n",
418                                  CCC->upl_file, 
419                                  CCC->upl_comment, 
420                                  CCC->upl_mimetype);
421                         quickie_message(CCC->curr_user, NULL, NULL, CCC->room.QRname,
422                                         upload_notice, 0, NULL);
423                 }
424         } else {
425                 abort_upl(CCC);
426                 cprintf("%d File '%s' aborted.\n", CIT_OK, CCC->upl_path);
427         }
428 }
429
430
431 /*
432  * read from the download file
433  */
434 void cmd_read(char *cmdbuf)
435 {
436         long start_pos;
437         size_t bytes;
438         char buf[SIZ];
439         int rc;
440
441         /* The client will transmit its requested offset and byte count */
442         start_pos = extract_long(cmdbuf, 0);
443         bytes = extract_int(cmdbuf, 1);
444         if ((start_pos < 0) || (bytes <= 0)) {
445                 cprintf("%d you have to specify a value > 0.\n", ERROR + ILLEGAL_VALUE);
446                 return;
447         }
448
449         if (CC->download_fp == NULL) {
450                 cprintf("%d You don't have a download file open.\n", ERROR + RESOURCE_NOT_OPEN);
451                 return;
452         }
453
454         /* If necessary, reduce the byte count to the size of our buffer */
455         if (bytes > sizeof(buf)) {
456                 bytes = sizeof(buf);
457         }
458
459         rc = fseek(CC->download_fp, start_pos, 0);
460         if (rc < 0) {
461                 cprintf("%d your file is smaller than %ld.\n", ERROR + ILLEGAL_VALUE, start_pos);
462                 syslog(LOG_ERR, "serv_file: your file %s is smaller than %ld [%s]", 
463                         CC->upl_path, 
464                         start_pos,
465                         strerror(errno)
466                 );
467
468                 return;
469         }
470         bytes = fread(buf, 1, bytes, CC->download_fp);
471         if (bytes > 0) {
472                 /* Tell the client the actual byte count and transmit it */
473                 cprintf("%d %d\n", BINARY_FOLLOWS, (int)bytes);
474                 client_write(buf, bytes);
475         }
476         else {
477                 cprintf("%d %s\n", ERROR, strerror(errno));
478         }
479 }
480
481
482 /*
483  * write to the upload file
484  */
485 void cmd_writ(char *cmdbuf)
486 {
487         struct CitContext *CCC = CC;
488         int bytes;
489         char *buf;
490         int rv;
491
492         unbuffer_output();
493
494         bytes = extract_int(cmdbuf, 0);
495
496         if (CCC->upload_fp == NULL) {
497                 cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
498                 return;
499         }
500         if (bytes <= 0) {
501                 cprintf("%d you have to specify a value > 0.\n", ERROR + ILLEGAL_VALUE);
502                 return;
503         }
504
505         if (bytes > 100000) {
506                 bytes = 100000;
507         }
508
509         cprintf("%d %d\n", SEND_BINARY, bytes);
510         buf = malloc(bytes + 1);
511         client_read(buf, bytes);
512         rv = fwrite(buf, bytes, 1, CCC->upload_fp);
513         if (rv == -1) {
514                 syslog(LOG_ERR, "serv_file: %s", strerror(errno));
515         }
516         free(buf);
517 }
518
519
520 void files_logout_hook(void)
521 {
522         CitContext *CCC = MyContext();
523
524         /*
525          * If there is a download in progress, abort it.
526          */
527         if (CCC->download_fp != NULL) {
528                 fclose(CCC->download_fp);
529                 CCC->download_fp = NULL;
530         }
531
532         /*
533          * If there is an upload in progress, abort it.
534          */
535         if (CCC->upload_fp != NULL) {
536                 abort_upl(CCC);
537         }
538
539 }
540
541
542 /* 
543  * help_subst()  -  support routine for help file viewer
544  */
545 void help_subst(char *strbuf, char *source, char *dest)
546 {
547         char workbuf[SIZ];
548         int p;
549
550         while (p = pattern2(strbuf, source), (p >= 0)) {
551                 strcpy(workbuf, &strbuf[p + strlen(source)]);
552                 strcpy(&strbuf[p], dest);
553                 strcat(strbuf, workbuf);
554         }
555 }
556
557
558 void do_help_subst(char *buffer)
559 {
560         char buf2[16];
561
562         help_subst(buffer, "^nodename", CtdlGetConfigStr("c_nodename"));
563         help_subst(buffer, "^humannode", CtdlGetConfigStr("c_humannode"));
564         help_subst(buffer, "^fqdn", CtdlGetConfigStr("c_fqdn"));
565         help_subst(buffer, "^username", CC->user.fullname);
566         snprintf(buf2, sizeof buf2, "%ld", CC->user.usernum);
567         help_subst(buffer, "^usernum", buf2);
568         help_subst(buffer, "^sysadm", CtdlGetConfigStr("c_sysadm"));
569         help_subst(buffer, "^variantname", CITADEL);
570         help_subst(buffer, "^maxsessions", CtdlGetConfigStr("c_maxsessions"));          // yes it's numeric but str is ok here
571         help_subst(buffer, "^bbsdir", ctdl_message_dir);
572 }
573
574
575 typedef const char *ccharp;
576 /*
577  * display system messages or help
578  */
579 void cmd_mesg(char *mname)
580 {
581         FILE *mfp;
582         char targ[256];
583         char buf[256];
584         char buf2[256];
585         DIR *dp;
586         struct dirent *d;
587
588         extract_token(buf, mname, 0, '|', sizeof buf);
589
590         snprintf(buf2, sizeof buf2, "%s.%d.%d", buf, CC->cs_clientdev, CC->cs_clienttyp);
591
592         /* If the client requested "?" then produce a listing */
593         if (!strcmp(buf, "?")) {
594                 cprintf("%d %s\n", LISTING_FOLLOWS, buf);
595                 dp = opendir(ctdl_message_dir);
596                 if (dp != NULL) {
597                         while (d = readdir(dp), d != NULL) {
598                                 if (d->d_name[0] != '.') {
599                                         cprintf(" %s\n", d->d_name);
600                                 }
601                         }
602                         closedir(dp);
603                 }
604                 cprintf("000\n");
605                 return;
606         }
607
608         /* Otherwise, look for the requested file by name. */
609         snprintf(targ, sizeof targ, "%s/%s", ctdl_message_dir, buf);
610         mfp = fopen(targ, "r");
611         if (mfp==NULL) {
612                 cprintf("%d Cannot open '%s': %s\n",
613                         ERROR + FILE_NOT_FOUND, targ, strerror(errno));
614                 return;
615         }
616         cprintf("%d %s\n", LISTING_FOLLOWS, buf);
617
618         while (fgets(buf, (sizeof buf - 1), mfp) != NULL) {
619                 buf[strlen(buf)-1] = 0;
620                 do_help_subst(buf);
621                 cprintf("%s\n",buf);
622         }
623
624         fclose(mfp);
625         cprintf("000\n");
626 }
627
628
629 /*
630  * enter system messages or help
631  */
632 void cmd_emsg(char *mname)
633 {
634         FILE *mfp;
635         char targ[256];
636         char buf[256];
637         int a;
638
639         unbuffer_output();
640
641         if (CtdlAccessCheck(ac_aide)) return;
642
643         extract_token(buf, mname, 0, '|', sizeof buf);
644         for (a=0; !IsEmptyStr(&buf[a]); ++a) {          /* security measure */
645                 if (buf[a] == '/') buf[a] = '.';
646         }
647
648         if (IsEmptyStr(targ)) {
649                 snprintf(targ, sizeof targ, "%s/%s", ctdl_message_dir, buf);
650         }
651
652         mfp = fopen(targ, "w");
653         if (mfp==NULL) {
654                 cprintf("%d Cannot open '%s': %s\n",
655                         ERROR + INTERNAL_ERROR, targ, strerror(errno));
656                 return;
657         }
658         cprintf("%d %s\n", SEND_LISTING, targ);
659
660         while (client_getln(buf, sizeof buf) >=0 && strcmp(buf, "000")) {
661                 fprintf(mfp, "%s\n", buf);
662         }
663
664         fclose(mfp);
665 }
666
667 /*****************************************************************************/
668 /*                      MODULE INITIALIZATION STUFF                          */
669 /*****************************************************************************/
670
671 CTDL_MODULE_INIT(file_ops)
672 {
673         if (!threading) {
674                 CtdlRegisterSessionHook(files_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 8);
675                 CtdlRegisterProtoHook(cmd_delf, "DELF", "Delete a file");
676                 CtdlRegisterProtoHook(cmd_movf, "MOVF", "Move a file");
677                 CtdlRegisterProtoHook(cmd_open, "OPEN", "Open a download file transfer");
678                 CtdlRegisterProtoHook(cmd_clos, "CLOS", "Close a download file transfer");
679                 CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Open an upload file transfer");
680                 CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Close an upload file transfer");
681                 CtdlRegisterProtoHook(cmd_read, "READ", "File transfer read operation");
682                 CtdlRegisterProtoHook(cmd_writ, "WRIT", "File transfer write operation");
683                 CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download");
684                 CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file");
685                 CtdlRegisterProtoHook(cmd_mesg, "MESG", "fetch system banners");
686                 CtdlRegisterProtoHook(cmd_emsg, "EMSG", "submit system banners");
687         }
688         /* return our Subversion id for the Log */
689         return "file_ops";
690 }