/[mailutils]/mailutils/examples/mta.c
ViewVC logotype

Diff of /mailutils/examples/mta.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by gray, Wed Dec 4 23:18:12 2002 UTC revision 1.5 by gray, Thu Dec 5 12:48:05 2002 UTC
# Line 50  Line 50 
50  #endif  #endif
51  #include <stdlib.h>  #include <stdlib.h>
52  #include <unistd.h>  #include <unistd.h>
53  #include <getopt.h>  #ifdef HAVE_GETOPT_H
54    # include <getopt.h>
55    #endif
56  #include <string.h>  #include <string.h>
57  #include <pwd.h>  #include <pwd.h>
58  #include <sys/stat.h>  #include <sys/stat.h>
# Line 336  mta_send (message_t msg) Line 338  mta_send (message_t msg)
338    return 0;    return 0;
339  }  }
340    
341    #define SENDER_WARNING "set sender using -f flag"
342    
343  int  int
344  message_finalize (message_t msg, int warn)  message_finalize (message_t msg, int warn)
345  {  {
# Line 347  message_finalize (message_t msg, int war Line 351  message_finalize (message_t msg, int war
351    
352    if (warn && from_person)    if (warn && from_person)
353      {      {
       char *warn = NULL;  
354        struct passwd *pwd = getpwuid (getuid ());        struct passwd *pwd = getpwuid (getuid ());
355        asprintf (&warn, "%s set sender using -f flag", pwd->pw_name);        char *warn = malloc (strlen (pwd->pw_name) + 1 +
356                               sizeof (SENDER_WARNING));
357          if (warn == NULL)
358            {
359              mu_error ("%s: not enough memory", progname);
360              return 1;
361            }
362          sprintf (warn, "%s %s", pwd->pw_name, SENDER_WARNING);
363        header_set_value (header, "X-Authentication-Warning", warn, 0);        header_set_value (header, "X-Authentication-Warning", warn, 0);
364        free (warn);        free (warn);
365      }      }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26