Changeset 56330ff for zephyr.c


Ignore:
Timestamp:
Aug 25, 2002, 3:02:14 PM (19 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
c01e477
Parents:
4b464a4
Message:
Moved zsig generation to the zwrite object
Print the zsig used for outgoing messages
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    r4b464a4 r56330ff  
    66#include <zephyr/zephyr.h>
    77#include <com_err.h>
    8 #include <pwd.h>
    98#include "owl.h"
    109
     
    259258  int ret;
    260259  ZNotice_t notice;
    261   char *ptr;
    262   struct passwd *pw;
    263   char zsigtmp[LINE];
    264   char *zsigexec, *zsigowlvar, *zsigzvar;
    265  
    266   zsigexec = owl_global_get_zsig_exec(&g);
    267   zsigowlvar = owl_global_get_zsig(&g);
    268   zsigzvar = ZGetVariable("zwrite-signature");
    269 
    270   if (zsig) {
    271     strcpy(zsigtmp, zsig);
    272   } else if (zsigowlvar && *zsigowlvar) {
    273     strncpy(zsigtmp, zsigowlvar, LINE);
    274   } else if (zsigexec && *zsigexec) {
    275     FILE *file;
    276     char buff[LINE];
    277     strcpy(zsigtmp, "");
    278     file=popen(zsigexec, "r");
    279     if (!file) {
    280       if (zsigzvar && *zsigzvar) {
    281         strncpy(zsigtmp, zsigzvar, LINE);
    282       }
    283     } else {
    284       while (fgets(buff, LINE, file)) { /* wrong sizing */
    285         strcat(zsigtmp, buff);
    286       }
    287       pclose(file);
    288       if (zsigtmp[strlen(zsigtmp)-1]=='\n') {
    289         zsigtmp[strlen(zsigtmp)-1]='\0';
    290       }
    291     }
    292   } else if (zsigzvar) {
    293     strncpy(zsigtmp, zsigzvar, LINE);
    294   } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) {
    295     strncpy(zsigtmp, pw->pw_gecos, LINE);
    296     ptr=strchr(zsigtmp, ',');
    297     if (ptr) {
    298       ptr[0]='\0';
    299     }
    300   } else {
    301     strcpy(zsigtmp, "");
    302   }
    303260   
    304261  memset(&notice, 0, sizeof(notice));
     
    317274  if (opcode) notice.z_opcode=opcode;
    318275
    319   notice.z_message_len=strlen(zsigtmp)+1+strlen(message);
     276  notice.z_message_len=strlen(zsig)+1+strlen(message);
    320277  notice.z_message=owl_malloc(notice.z_message_len+10);
    321   strcpy(notice.z_message, zsigtmp);
    322   memcpy(notice.z_message+strlen(zsigtmp)+1, message, strlen(message));
     278  strcpy(notice.z_message, zsig);
     279  memcpy(notice.z_message+strlen(zsig)+1, message, strlen(message));
    323280
    324281  /* ret=ZSendNotice(&notice, ZAUTH); */
Note: See TracChangeset for help on using the changeset viewer.