citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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