221aa84ce585c86e7ee7a14595c00628e3278fc8
[citadel.git] / webcit / serv_func.c
1 /*
2  * $Id$
3  */
4
5 #include "webcit.h"
6 #include "webserver.h"
7
8 int is_uds = 0;
9 char serv_sock_name[PATH_MAX] = "";
10
11 void DeleteServInfo(ServInfo **FreeMe)
12 {
13         if (*FreeMe == NULL)
14                 return;
15         FreeStrBuf(&(*FreeMe)->serv_nodename);
16         FreeStrBuf(&(*FreeMe)->serv_humannode);
17         FreeStrBuf(&(*FreeMe)->serv_fqdn);
18         FreeStrBuf(&(*FreeMe)->serv_software);
19         FreeStrBuf(&(*FreeMe)->serv_bbs_city);
20         FreeStrBuf(&(*FreeMe)->serv_sysadm);
21         FreeStrBuf(&(*FreeMe)->serv_moreprompt);
22         FreeStrBuf(&(*FreeMe)->serv_default_cal_zone);
23         FreeStrBuf(&(*FreeMe)->serv_svn_revision);
24         free(*FreeMe);
25         *FreeMe = NULL;
26 }
27
28 /*
29  * get info about the server we've connected to
30  *
31  * browser_host         the citadell we want to connect to
32  * user_agent           which browser uses our client?
33  */
34 ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
35 {
36         ServInfo *info;
37         StrBuf *Buf;
38         int a;
39
40         Buf = NewStrBuf();
41         /** Tell the server what kind of client is connecting */
42         serv_printf("IDEN %d|%d|%d|%s|%s",
43                     DEVELOPER_ID,
44                     CLIENT_ID,
45                     CLIENT_VERSION,
46                     ChrPtr(user_agent),
47                     ChrPtr(browser_host)
48         );
49         StrBuf_ServGetln(Buf);
50
51         /** Tell the server what kind of richtext we prefer */
52         serv_puts("MSGP text/calendar|text/vnote|text/html|text/plain");
53         StrBuf_ServGetln(Buf);
54
55         /*
56          * Tell the server that when we save a calendar event, we
57          * want invitations to be generated by the Citadel server
58          * instead of by the client.
59          */
60         serv_puts("ICAL sgi|1");
61         StrBuf_ServGetln(Buf);
62
63         /** Now ask the server to tell us a little bit about itself... */
64         serv_puts("INFO");
65         StrBuf_ServGetln(Buf);
66         if (GetServerStatus(Buf, NULL) != 1) {
67                 FreeStrBuf(&Buf);
68                 return NULL;
69         }
70
71         info = (ServInfo*)malloc(sizeof(ServInfo));
72         memset(info, 0, sizeof(ServInfo));
73         a = 0;
74         while (StrBuf_ServGetln(Buf), (strcmp(ChrPtr(Buf), "000")!= 0)) {
75 /*              lprintf (1, "a: %d [%s]", a, ChrPtr(Buf));*/
76                 switch (a) {
77                 case 0:
78                         info->serv_pid = StrToi(Buf);
79                         WC->ctdl_pid = info->serv_pid;
80                         break;
81                 case 1:
82                         info->serv_nodename = NewStrBufDup(Buf);
83                         break;
84                 case 2:
85                         info->serv_humannode = NewStrBufDup(Buf);
86                         break;
87                 case 3:
88                         info->serv_fqdn = NewStrBufDup(Buf);
89                         break;
90                 case 4:
91                         info->serv_software = NewStrBufDup(Buf);
92                         break;
93                 case 5:
94                         info->serv_rev_level = StrToi(Buf);
95                         break;
96                 case 6:
97                         info->serv_bbs_city = NewStrBufDup(Buf);
98                         break;
99                 case 7:
100                         info->serv_sysadm = NewStrBufDup(Buf);
101                         break;
102                 case 9:
103                         info->serv_moreprompt = NewStrBufDup(Buf);
104                         break;
105                 case 14:
106                         info->serv_supports_ldap = StrToi(Buf);
107                         break;
108                 case 15:
109                         info->serv_newuser_disabled = StrToi(Buf);
110                         break;
111                 case 16:
112                         info->serv_default_cal_zone = NewStrBufDup(Buf);
113                         break;
114                 case 20:
115                         info->serv_supports_sieve = StrToi(Buf);
116                         break;
117                 case 21:
118                         info->serv_fulltext_enabled = StrToi(Buf);
119                         break;
120                 case 22:
121                         info->serv_svn_revision = NewStrBufDup(Buf);
122                         break;
123                 case 23:
124                         info->serv_supports_openid = StrToi(Buf);
125                         break;
126                 }
127                 ++a;
128         }
129         FreeStrBuf(&Buf);
130         return info;
131 }
132
133 int GetConnected (void)
134 {
135         StrBuf *Buf;
136         wcsession *WCC = WC;
137
138         if (WCC->ReadBuf == NULL)
139                 WCC->ReadBuf = NewStrBuf();
140         if (is_uds) /* unix domain socket */
141                 WCC->serv_sock = uds_connectsock(serv_sock_name);
142         else        /* tcp socket */
143                 WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
144         
145         if (WCC->serv_sock < 0) {
146                 do_logout();
147                 FreeStrBuf(&WCC->ReadBuf);
148                 return 1;
149         }
150         else {
151                 long Status;
152                 Buf = NewStrBuf();
153                 WCC->connected = 1;
154                 StrBuf_ServGetln(Buf);  /* get the server greeting */
155                 GetServerStatus(Buf, &Status);
156                 FreeStrBuf(&Buf);
157                 /* Are there too many users already logged in? */
158                 if (Status == 571) {
159                         wprintf(_("This server is already serving its maximum number of users and cannot accept any additional logins at this time.  Please try again later or contact your system administrator."));
160                         end_burst();
161                         end_webcit_session();
162                         return 1;
163                 }
164
165                 /*
166                  * From what host is our user connecting?  Go with
167                  * the host at the other end of the HTTP socket,
168                  * unless we are following X-Forwarded-For: headers
169                  * and such a header has already turned up something.
170                  */
171                 if ( (!follow_xff) || (StrLength(WCC->Hdr->browser_host) == 0) ) {
172                         if (WCC->Hdr->browser_host == NULL) {
173                                 WCC->Hdr->browser_host = NewStrBuf();
174                                 Put(WCC->Hdr->HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"), 
175                                     WCC->Hdr->browser_host, HFreeStrBuf);
176                         }
177                         locate_host(WCC->Hdr->browser_host, WCC->Hdr->http_sock);
178                 }
179                 if (WCC->serv_info == NULL)
180                         WCC->serv_info = get_serv_info(WCC->Hdr->browser_host, WCC->Hdr->user_agent);
181                 if (WCC->serv_info == NULL){
182                         begin_burst();
183                         wprintf(_("Received unexpected answer from Citadel "
184                                   "server; bailing out."));
185                         hprintf("HTTP/1.1 200 OK\r\n");
186                         hprintf("Content-type: text/plain; charset=utf-8\r\n");
187                         end_burst();
188                         end_webcit_session();
189                         return 1;
190                 }
191                 if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
192                         begin_burst();
193                         wprintf(_("You are connected to a Citadel "
194                                   "server running Citadel %d.%02d. \n"
195                                   "In order to run this version of WebCit "
196                                   "you must also have Citadel %d.%02d or"
197                                   " newer.\n\n\n"),
198                                 WCC->serv_info->serv_rev_level / 100,
199                                 WCC->serv_info->serv_rev_level % 100,
200                                 MINIMUM_CIT_VERSION / 100,
201                                 MINIMUM_CIT_VERSION % 100
202                                 );
203                         hprintf("HTTP/1.1 200 OK\r\n");
204                         hprintf("Content-type: text/plain; charset=utf-8\r\n");
205                         end_burst();
206                         end_webcit_session();
207                         return 1;
208                 }
209         }
210         return 0;
211 }
212
213 /**
214  *  Read Citadel variformat text and spit it out as HTML.
215  *  align html align string
216  */
217 inline void fmout(char *align)
218 {
219         _fmout(WC->WBuf, align);
220 }
221
222 void _fmout(StrBuf *Target, char *align)
223 {
224         int intext = 0;
225         int bq = 0;
226         char buf[SIZ];
227
228         StrBufAppendPrintf(Target, "<div align=%s>\n", align);
229         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
230
231                 if ((intext == 1) && (isspace(buf[0]))) {
232                         wprintf("<br />");
233                 }
234                 intext = 1;
235
236                 /**
237                  * Quoted text should be displayed in italics and in a
238                  * different colour.  This code understands Citadel-style
239                  * " >" quotes and will convert to <BLOCKQUOTE> tags.
240                  */
241                 if ((bq == 0) && (!strncmp(buf, " >", 2))) {
242                         StrBufAppendBufPlain(Target, HKEY("<BLOCKQUOTE>"), 0);
243                         bq = 1;
244                 } else if ((bq == 1) && (strncmp(buf, " >", 2))) {
245                         StrBufAppendBufPlain(Target, HKEY("</BLOCKQUOTE>"), 0);
246                         bq = 0;
247                 }
248                 if ((bq == 1) && (!strncmp(buf, " >", 2))) {
249                         strcpy(buf, &buf[2]);
250                 }
251                 /** Activate embedded URL's */
252                 url(buf, sizeof(buf));
253
254                 escputs(buf);
255                 StrBufAppendBufPlain(Target, HKEY("\n"), 0);
256         }
257         if (bq == 1) {
258                 wprintf("</I>");
259         }
260         wprintf("</div><br />\n");
261 }
262
263 void FmOut(StrBuf *Target, char *align, StrBuf *Source)
264 {
265         const char *ptr, *pte;
266         const char *BufPtr = NULL;
267         StrBuf *Line = NewStrBuf();
268         StrBuf *Line1 = NewStrBuf();
269         StrBuf *Line2 = NewStrBuf();
270         int bn = 0;
271         int bq = 0;
272         int i, n, done = 0;
273         long len;
274         int intext = 0;
275
276         StrBufAppendPrintf(Target, "<div class=\"fmout-%s\">\n", align);
277         while ((n = StrBufSipLine(Line, Source, &BufPtr), n >= 0) && !done)
278         {
279                 done = n == 0;
280                 bq = 0;
281                 i = 0;
282                 ptr = ChrPtr(Line);
283                 len = StrLength(Line);
284                 pte = ptr + len;
285
286                 if ((intext == 1) && (isspace(*ptr))) {
287                         StrBufAppendBufPlain(Target, HKEY("<br>"), 0);
288                 }
289                 intext = 1;
290                 if (isspace(*ptr)) while ((ptr < pte) &&
291                        ((*ptr == '>') ||
292                         isspace(*ptr)))
293                 {
294                         if (*ptr == '>')
295                                 bq++;
296                         ptr ++;
297                         i++;
298                 }
299
300                 /**
301                  * Quoted text should be displayed in italics and in a
302                  * different colour.  This code understands Citadel-style
303                  * " >" quotes and will convert to <BLOCKQUOTE> tags.
304                  */
305                 if (i > 0) StrBufCutLeft(Line, i);
306                 
307
308                 for (i = bn; i < bq; i++)                               
309                         StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
310                 for (i = bq; i < bn; i++)                               
311                         StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
312                 bn = bq;
313
314                 if (StrLength(Line) == 0)
315                         continue;
316                 /** Activate embedded URL's */
317                 UrlizeText(Line1, Line, Line2);
318
319                 StrEscAppend(Target, Line1, NULL, 0, 0);
320
321                 StrBufAppendBufPlain(Target, HKEY("\n"), 0);
322         }
323         for (i = 0; i < bn; i++)                                
324                 StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
325         StrBufAppendBufPlain(Target, HKEY("</div><br>\n"), 0);
326         FreeStrBuf(&Line);
327         FreeStrBuf(&Line1);
328         FreeStrBuf(&Line2);
329 }
330
331
332
333
334 /**
335  *  Read Citadel variformat text and spit it out as HTML in a form
336  * suitable for embedding in another message (forward/quote).
337  * (NO LINEBREAKS ALLOWED HERE!)
338  */
339 void pullquote_fmout(void) {
340         int intext = 0;
341         int bq = 0;
342         char buf[SIZ];
343
344         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
345
346                 if ((intext == 1) && (isspace(buf[0]))) {
347                         wprintf("<br />");
348                 }
349                 intext = 1;
350
351                 /**
352                  * Quoted text should be displayed in italics and in a
353                  * different colour.  This code understands Citadel-style
354                  * " >" quotes and will convert to <BLOCKQUOTE> tags.
355                  */
356                 if ((bq == 0) && (!strncmp(buf, " >", 2))) {
357                         wprintf("<BLOCKQUOTE>");
358                         bq = 1;
359                 } else if ((bq == 1) && (strncmp(buf, " >", 2))) {
360                         wprintf("</BLOCKQUOTE>");
361                         bq = 0;
362                 }
363                 if ((bq == 1) && (!strncmp(buf, " >", 2))) {
364                         strcpy(buf, &buf[2]);
365                 }
366
367                 msgescputs(buf);
368         }
369         if (bq == 1) {
370                 wprintf("</I>");
371         }
372 }
373
374
375
376
377 /**
378  *  Transmit message text (in memory) to the server.
379  *
380  *  ptr Pointer to the message being transmitted
381  */
382 void text_to_server(char *ptr)
383 {
384         char buf[256];
385         int ch, a, pos, len;
386
387         pos = 0;
388         buf[0] = 0;
389
390         while (ptr[pos] != 0) {
391                 ch = ptr[pos++];
392                 if (ch == 10) {
393                         len = strlen(buf);
394                         while ( (isspace(buf[len - 1]))
395                                 && (buf[0] !=  '\0') 
396                                 && (buf[1] !=  '\0') )
397                                 buf[--len] = 0;
398                         serv_puts(buf);
399                         buf[0] = 0;
400                         if (ptr[pos] != 0) strcat(buf, " ");
401                 } else {
402                         a = strlen(buf);
403                         buf[a + 1] = 0;
404                         buf[a] = ch;
405                         if ((ch == 32) && (strlen(buf) > 200)) {
406                                 buf[a] = 0;
407                                 serv_puts(buf);
408                                 buf[0] = 0;
409                         }
410                         if (strlen(buf) > 250) {
411                                 serv_puts(buf);
412                                 buf[0] = 0;
413                         }
414                 }
415         }
416         serv_puts(buf);
417 }
418
419
420 /**
421  *  Transmit message text (in memory) to the server,
422  *        converting to Quoted-Printable encoding as we go.
423  *
424  *  ptr Pointer to the message being transmitted
425  */
426 void text_to_server_qp(char *ptr)
427 {
428         unsigned char ch, buf[256];
429         int pos;
430         int output_len = 0;
431
432         pos = 0;
433         buf[0] = 0;
434         output_len = 0;
435
436         while (ptr[pos] != 0) {
437                 ch = (unsigned char)(ptr[pos++]);
438
439                 if (ch == 13) {
440                         /* ignore carriage returns */
441                 }
442                 else if (ch == 10) {
443                         /* hard line break */
444                         if (output_len > 0) {
445                                 if (isspace(buf[output_len-1])) {
446                                         sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
447                                         output_len += 2;
448                                 }
449                         }
450                         buf[output_len++] = 0;
451                         serv_puts((char *)buf);
452                         output_len = 0;
453                 }
454                 else if (ch == 9) {
455                         buf[output_len++] = ch;
456                 }
457                 else if ( (ch >= 32) && (ch <= 60) ) {
458                         buf[output_len++] = ch;
459                 }
460                 else if ( (ch >= 62) && (ch <= 126) ) {
461                         buf[output_len++] = ch;
462                 }
463                 else {
464                         sprintf((char *)&buf[output_len], "=%02X", ch);
465                         output_len += 3;
466                 }
467                 
468                 if (output_len > 72) {
469                         /* soft line break */
470                         if (isspace(buf[output_len-1])) {
471                                 sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
472                                 output_len += 2;
473                         }
474                         buf[output_len++] = '=';
475                         buf[output_len++] = 0;
476                         serv_puts((char *)buf);
477                         output_len = 0;
478                 }
479         }
480
481         /* end of data - transmit anything that's left */
482         if (output_len > 0) {
483                 if (isspace(buf[output_len-1])) {
484                         sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]);
485                         output_len += 2;
486                 }
487                 buf[output_len++] = 0;
488                 serv_puts((char *)buf);
489                 output_len = 0;
490         }
491 }
492
493
494
495
496 /**
497  *  translate server message output to text
498  * (used for editing room info files and such)
499  */
500 void server_to_text()
501 {
502         char buf[SIZ];
503
504         int count = 0;
505
506         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
507                 if ((buf[0] == 32) && (count > 0)) {
508                         wprintf("\n");
509                 }
510                 wprintf("%s", buf);
511                 ++count;
512         }
513 }
514
515
516
517 /**
518  * Read binary data from server into memory using a series of
519  * server READ commands.
520  * \return the read content as StrBuf
521  */
522 int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) 
523 {
524         char buf[SIZ];
525         size_t bytes = 0;
526         size_t thisblock = 0;
527         
528         if (Ret == NULL)
529             return -1;
530
531         while (bytes < total_len) {
532                 thisblock = 4095;
533                 if ((total_len - bytes) < thisblock) {
534                         thisblock = total_len - bytes;
535                         if (thisblock == 0) {
536                                 FlushStrBuf(Ret); 
537                                 FreeStrBuf(&Buf);
538                                 return -1; 
539                         }
540                 }
541                 serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
542                 if (StrBuf_ServGetln(Buf) > 0)
543                 {
544                         if (GetServerStatus(Buf, NULL) == 6)
545                         {
546                             StrBufCutLeft(Buf, 4);
547                             thisblock = StrTol(Buf);
548                             if (!WC->connected) {
549                                     FlushStrBuf(Ret); 
550                                     FreeStrBuf(&Buf); 
551                                     return -1; 
552                             }
553                             StrBuf_ServGetBLOBBuffered(Ret, thisblock);
554                             bytes += thisblock;
555                     }
556                     else {
557                             FreeStrBuf(&Buf);
558                             lprintf(3, "Error: %s\n", &buf[4]);
559                             return -1;
560                     }
561                 }
562         }
563         return StrLength(Ret);
564 }
565
566
567 /**
568  *  Read text from server, appending to a string buffer until the
569  * usual 000 terminator is found.  Caller is responsible for freeing
570  * the returned pointer.
571  */
572 int read_server_text(StrBuf *Buf, long *nLines)
573 {
574         wcsession *WCC = WC;
575         long nRead;
576         long nTotal = 0;
577         long nlines;
578         
579         nlines = 0;
580         while ((WCC->serv_sock!=-1) &&
581                (nRead = StrBuf_ServGetln(Buf), (nRead >= 0) ))
582         {
583                 if (strcmp(ChrPtr(Buf) + nTotal, "000") != 0) {
584                         StrBufCutRight(Buf, nRead);
585                         break;
586                 }
587                 nTotal += nRead;
588                 nlines ++;
589         }
590
591         *nLines = nlines;
592         return nTotal;
593 }
594
595
596
597
598
599
600 int GetServerStatus(StrBuf *Line, long* FullState)
601 {
602         if (FullState != NULL)
603                 *FullState = StrTol(Line);
604         return ChrPtr(Line)[0] - 48;
605 }
606
607
608 void tmplput_serv_ip(StrBuf *Target, WCTemplputParams *TP)
609 {
610         StrBufAppendPrintf(Target, "%d", WC->ctdl_pid);
611 }
612
613 void tmplput_serv_nodename(StrBuf *Target, WCTemplputParams *TP)
614 {
615         wcsession *WCC = WC;
616         if (WCC->serv_info == NULL)
617                 return;
618         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_nodename, 0);
619 }
620
621 void tmplput_serv_humannode(StrBuf *Target, WCTemplputParams *TP)
622 {
623         wcsession *WCC = WC;
624         if (WCC->serv_info == NULL)
625                 return;
626         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_humannode, 0);
627 }
628
629 void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP)
630 {
631         wcsession *WCC = WC;
632         if (WCC->serv_info == NULL)
633                 return;
634         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_fqdn, 0);
635 }
636
637 void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP)
638 {
639         wcsession *WCC = WC;
640         if (WCC->serv_info == NULL)
641                 return;
642         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_software, 0);
643 }
644
645 void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP)
646 {
647         wcsession *WCC = WC;
648         if (WCC->serv_info == NULL)
649                 return;
650         StrBufAppendPrintf(Target, "%d.%02d",
651                             WCC->serv_info->serv_rev_level / 100,
652                             WCC->serv_info->serv_rev_level % 100);
653 }
654 int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP)
655 {
656         wcsession *WCC = WC;
657         if (WCC->serv_info == NULL)
658                 return 0;
659         return WCC->serv_info->serv_newuser_disabled != 0;
660 }
661 int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP)
662 {
663         wcsession *WCC = WC;
664         if (WCC->serv_info == NULL)
665                 return 0;
666         return WCC->serv_info->serv_supports_openid != 0;
667 }
668
669 void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP)
670 {
671         wcsession *WCC = WC;
672         if (WCC->serv_info == NULL)
673                 return;
674         StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
675 }
676
677
678 void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP)
679 {
680         int n = 0;
681         int Done = 0;
682         StrBuf *Line;
683         StrBuf *Buf;
684
685         Buf = NewStrBuf();
686         Line = NewStrBuf();
687         serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
688
689         StrBuf_ServGetln(Line);
690         if (GetServerStatus(Line, NULL) == 1) {
691                 while (!Done &&  (StrBuf_ServGetln(Line)>=0)) {
692                         if ( (StrLength(Line)==3) && 
693                              !strcmp(ChrPtr(Line), "000")) 
694                                 Done = 1;
695                         else
696                         {
697                                 if (n > 0)
698                                         StrBufAppendBufPlain(Buf, "\n", 1, 0);
699                                 StrBufAppendBuf(Buf, Line, 0);
700                         }
701                         n++;
702                 }
703         
704                 FlushStrBuf(Line);
705                 FmOut(Line, "center", Buf);
706                 StrBufAppendTemplate(Target, TP, Line, 1);
707         }
708         FreeStrBuf(&Buf);
709         FreeStrBuf(&Line);
710 }
711
712 void 
713 InitModule_SERVFUNC
714 (void)
715 {
716         is_uds = strcasecmp(ctdlhost, "uds") == 0;
717         if (is_uds)
718                 snprintf(serv_sock_name, PATH_MAX, "%s/citadel.socket", ctdlport);
719
720         RegisterConditional(HKEY("COND:SERV:OPENID"), 2, conditional_serv_supports_openid, CTX_NONE);
721         RegisterConditional(HKEY("COND:SERV:NEWU"), 2, conditional_serv_newuser_disabled, CTX_NONE);
722         RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, CTX_NONE);
723         RegisterNamespace("SERV:NODENAME", 0, 1, tmplput_serv_nodename, CTX_NONE);
724         RegisterNamespace("SERV:HUMANNODE", 0, 1, tmplput_serv_humannode, CTX_NONE);
725         RegisterNamespace("SERV:FQDN", 0, 1, tmplput_serv_fqdn, CTX_NONE);
726         RegisterNamespace("SERV:SOFTWARE", 0, 1, tmplput_serv_software, CTX_NONE);
727         RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, CTX_NONE);
728         RegisterNamespace("SERV:BBS_CITY", 0, 1, tmplput_serv_bbs_city, CTX_NONE);
729         RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, CTX_NONE);
730 /*TODO //       RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmplput_serv_ldap_enabled, 0); */
731 }
732
733
734
735 void 
736 SessionDestroyModule_SERVFUNC
737 (wcsession *sess)
738 {
739         DeleteServInfo(&sess->serv_info);
740 }
741 /*@}*/