The new server API no longer uses upload_type. Removed it from CitContext.
[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 }
351
352
353 /*
354  * close the download file
355  */
356 void cmd_clos(char *cmdbuf)
357 {
358         char buf[256];
359
360         if (CC->download_fp == NULL) {
361                 cprintf("%d You don't have a download file open.\n", ERROR + RESOURCE_NOT_OPEN);
362                 return;
363         }
364
365         fclose(CC->download_fp);
366         CC->download_fp = NULL;
367         cprintf("%d Ok\n", CIT_OK);
368 }
369
370
371 /*
372  * abort an upload
373  */
374 void abort_upl(CitContext *who)
375 {
376         if (who->upload_fp != NULL) {
377                 fclose(who->upload_fp);
378                 who->upload_fp = NULL;
379                 unlink(CC->upl_path);
380         }
381 }
382
383
384 /*
385  * close the upload file
386  */
387 void cmd_ucls(char *cmd)
388 {
389         struct CitContext *CCC = CC;
390         FILE *fp;
391         char upload_notice[512];
392         static int seq = 0;
393
394         if (CCC->upload_fp == NULL) {
395                 cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
396                 return;
397         }
398
399         fclose(CC->upload_fp);
400         CCC->upload_fp = NULL;
401
402         if (!strcasecmp(cmd, "1")) {
403                 cprintf("%d File '%s' saved.\n", CIT_OK, CCC->upl_path);
404                 fp = fopen(CCC->upl_filedir, "a");
405                 if (fp == NULL) {
406                         fp = fopen(CCC->upl_filedir, "w");
407                 }
408                 if (fp != NULL) {
409                         fprintf(fp, "%s %s %s\n", CCC->upl_file, CCC->upl_mimetype, CCC->upl_comment);
410                         fclose(fp);
411                 }
412
413                 if ((CCC->room.QRflags2 & QR2_NOUPLMSG) == 0) {
414                         /* put together an upload notice */
415                         snprintf(upload_notice, sizeof upload_notice,
416                                  "NEW UPLOAD: '%s'\n %s\n%s\n",
417                                  CCC->upl_file, 
418                                  CCC->upl_comment, 
419                                  CCC->upl_mimetype);
420                         quickie_message(CCC->curr_user, NULL, NULL, CCC->room.QRname,
421                                         upload_notice, 0, NULL);
422                 }
423         } else {
424                 abort_upl(CCC);
425                 cprintf("%d File '%s' aborted.\n", CIT_OK, CCC->upl_path);
426         }
427 }
428
429
430 /*
431  * read from the download file
432  */
433 void cmd_read(char *cmdbuf)
434 {
435         long start_pos;
436         size_t bytes;
437         char buf[SIZ];
438         int rc;
439
440         /* The client will transmit its requested offset and byte count */
441         start_pos = extract_long(cmdbuf, 0);
442         bytes = extract_int(cmdbuf, 1);
443         if ((start_pos < 0) || (bytes <= 0)) {
444                 cprintf("%d you have to specify a value > 0.\n", ERROR + ILLEGAL_VALUE);
445                 return;
446         }
447
448         if (CC->download_fp == NULL) {
449                 cprintf("%d You don't have a download file open.\n", ERROR + RESOURCE_NOT_OPEN);
450                 return;
451         }
452
453         /* If necessary, reduce the byte count to the size of our buffer */
454         if (bytes > sizeof(buf)) {
455                 bytes = sizeof(buf);
456         }
457
458         rc = fseek(CC->download_fp, start_pos, 0);
459         if (rc < 0) {
460                 cprintf("%d your file is smaller than %ld.\n", ERROR + ILLEGAL_VALUE, start_pos);
461                 syslog(LOG_ERR, "serv_file: your file %s is smaller than %ld [%s]", 
462                         CC->upl_path, 
463                         start_pos,
464                         strerror(errno)
465                 );
466
467                 return;
468         }
469         bytes = fread(buf, 1, bytes, CC->download_fp);
470         if (bytes > 0) {
471                 /* Tell the client the actual byte count and transmit it */
472                 cprintf("%d %d\n", BINARY_FOLLOWS, (int)bytes);
473                 client_write(buf, bytes);
474         }
475         else {
476                 cprintf("%d %s\n", ERROR, strerror(errno));
477         }
478 }
479
480
481 /*
482  * write to the upload file
483  */
484 void cmd_writ(char *cmdbuf)
485 {
486         struct CitContext *CCC = CC;
487         int bytes;
488         char *buf;
489         int rv;
490
491         unbuffer_output();
492
493         bytes = extract_int(cmdbuf, 0);
494
495         if (CCC->upload_fp == NULL) {
496                 cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
497                 return;
498         }
499         if (bytes <= 0) {
500                 cprintf("%d you have to specify a value > 0.\n", ERROR + ILLEGAL_VALUE);
501                 return;
502         }
503
504         if (bytes > 100000) {
505                 bytes = 100000;
506         }
507
508         cprintf("%d %d\n", SEND_BINARY, bytes);
509         buf = malloc(bytes + 1);
510         client_read(buf, bytes);
511         rv = fwrite(buf, bytes, 1, CCC->upload_fp);
512         if (rv == -1) {
513                 syslog(LOG_ERR, "serv_file: %s", strerror(errno));
514         }
515         free(buf);
516 }
517
518
519 void files_logout_hook(void)
520 {
521         CitContext *CCC = MyContext();
522
523         /*
524          * If there is a download in progress, abort it.
525          */
526         if (CCC->download_fp != NULL) {
527                 fclose(CCC->download_fp);
528                 CCC->download_fp = NULL;
529         }
530
531         /*
532          * If there is an upload in progress, abort it.
533          */
534         if (CCC->upload_fp != NULL) {
535                 abort_upl(CCC);
536         }
537
538 }
539
540
541 /* 
542  * help_subst()  -  support routine for help file viewer
543  */
544 void help_subst(char *strbuf, char *source, char *dest)
545 {
546         char workbuf[SIZ];
547         int p;
548
549         while (p = pattern2(strbuf, source), (p >= 0)) {
550                 strcpy(workbuf, &strbuf[p + strlen(source)]);
551                 strcpy(&strbuf[p], dest);
552                 strcat(strbuf, workbuf);
553         }
554 }
555
556
557 void do_help_subst(char *buffer)
558 {
559         char buf2[16];
560
561         help_subst(buffer, "^nodename", CtdlGetConfigStr("c_nodename"));
562         help_subst(buffer, "^humannode", CtdlGetConfigStr("c_humannode"));
563         help_subst(buffer, "^fqdn", CtdlGetConfigStr("c_fqdn"));
564         help_subst(buffer, "^username", CC->user.fullname);
565         snprintf(buf2, sizeof buf2, "%ld", CC->user.usernum);
566         help_subst(buffer, "^usernum", buf2);
567         help_subst(buffer, "^sysadm", CtdlGetConfigStr("c_sysadm"));
568         help_subst(buffer, "^variantname", CITADEL);
569         help_subst(buffer, "^maxsessions", CtdlGetConfigStr("c_maxsessions"));          // yes it's numeric but str is ok here
570         help_subst(buffer, "^bbsdir", ctdl_message_dir);
571 }
572
573
574 typedef const char *ccharp;
575 /*
576  * display system messages or help
577  */
578 void cmd_mesg(char *mname)
579 {
580         FILE *mfp;
581         char targ[256];
582         char buf[256];
583         char buf2[256];
584         DIR *dp;
585         struct dirent *d;
586
587         extract_token(buf, mname, 0, '|', sizeof buf);
588
589         snprintf(buf2, sizeof buf2, "%s.%d.%d", buf, CC->cs_clientdev, CC->cs_clienttyp);
590
591         /* If the client requested "?" then produce a listing */
592         if (!strcmp(buf, "?")) {
593                 cprintf("%d %s\n", LISTING_FOLLOWS, buf);
594                 dp = opendir(ctdl_message_dir);
595                 if (dp != NULL) {
596                         while (d = readdir(dp), d != NULL) {
597                                 if (d->d_name[0] != '.') {
598                                         cprintf(" %s\n", d->d_name);
599                                 }
600                         }
601                         closedir(dp);
602                 }
603                 cprintf("000\n");
604                 return;
605         }
606
607         /* Otherwise, look for the requested file by name. */
608         snprintf(targ, sizeof targ, "%s/%s", ctdl_message_dir, buf);
609         mfp = fopen(targ, "r");
610         if (mfp==NULL) {
611                 cprintf("%d Cannot open '%s': %s\n",
612                         ERROR + FILE_NOT_FOUND, targ, strerror(errno));
613                 return;
614         }
615         cprintf("%d %s\n", LISTING_FOLLOWS, buf);
616
617         while (fgets(buf, (sizeof buf - 1), mfp) != NULL) {
618                 buf[strlen(buf)-1] = 0;
619                 do_help_subst(buf);
620                 cprintf("%s\n",buf);
621         }
622
623         fclose(mfp);
624         cprintf("000\n");
625 }
626
627
628 /*
629  * enter system messages or help
630  */
631 void cmd_emsg(char *mname)
632 {
633         FILE *mfp;
634         char targ[256];
635         char buf[256];
636         int a;
637
638         unbuffer_output();
639
640         if (CtdlAccessCheck(ac_aide)) return;
641
642         extract_token(buf, mname, 0, '|', sizeof buf);
643         for (a=0; !IsEmptyStr(&buf[a]); ++a) {          /* security measure */
644                 if (buf[a] == '/') buf[a] = '.';
645         }
646
647         if (IsEmptyStr(targ)) {
648                 snprintf(targ, sizeof targ, "%s/%s", ctdl_message_dir, buf);
649         }
650
651         mfp = fopen(targ, "w");
652         if (mfp==NULL) {
653                 cprintf("%d Cannot open '%s': %s\n",
654                         ERROR + INTERNAL_ERROR, targ, strerror(errno));
655                 return;
656         }
657         cprintf("%d %s\n", SEND_LISTING, targ);
658
659         while (client_getln(buf, sizeof buf) >=0 && strcmp(buf, "000")) {
660                 fprintf(mfp, "%s\n", buf);
661         }
662
663         fclose(mfp);
664 }
665
666 /*****************************************************************************/
667 /*                      MODULE INITIALIZATION STUFF                          */
668 /*****************************************************************************/
669
670 CTDL_MODULE_INIT(file_ops)
671 {
672         if (!threading) {
673                 CtdlRegisterSessionHook(files_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 8);
674                 CtdlRegisterProtoHook(cmd_delf, "DELF", "Delete a file");
675                 CtdlRegisterProtoHook(cmd_movf, "MOVF", "Move a file");
676                 CtdlRegisterProtoHook(cmd_open, "OPEN", "Open a download file transfer");
677                 CtdlRegisterProtoHook(cmd_clos, "CLOS", "Close a download file transfer");
678                 CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Open an upload file transfer");
679                 CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Close an upload file transfer");
680                 CtdlRegisterProtoHook(cmd_read, "READ", "File transfer read operation");
681                 CtdlRegisterProtoHook(cmd_writ, "WRIT", "File transfer write operation");
682                 CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download");
683                 CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file");
684                 CtdlRegisterProtoHook(cmd_mesg, "MESG", "fetch system banners");
685                 CtdlRegisterProtoHook(cmd_emsg, "EMSG", "submit system banners");
686         }
687         /* return our Subversion id for the Log */
688         return "file_ops";
689 }