Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 123354
Collapse All | Expand All

(-)nbsmtp-1.00/main.c (-3 / +14 lines)
Lines 48-54 Link Here
48
{
48
{
49
	servinfo_t serverinfo;
49
	servinfo_t serverinfo;
50
	string_t msg_buffer;
50
	string_t msg_buffer;
51
	string_t *rcpts = NULL;
51
	string_t *rcpts = NULL, *msgrcpts = NULL;
52
	int num_rcpts = 0;
52
53
53
	str_init(&msg_buffer, MAX_MSG_LEN);
54
	str_init(&msg_buffer, MAX_MSG_LEN);
54
55
Lines 89-95 Link Here
89
		}
90
		}
90
	}
91
	}
91
92
92
	switch (parse_options(argc,argv, &serverinfo))
93
	/* Pass in a pointer to rcpts in case the recipients were specified
94
	 * on the command line */
95
	switch (parse_options(argc, argv, &serverinfo, &rcpts)) 
93
	{
96
	{
94
		case 1:
97
		case 1:
95
			return 1;
98
			return 1;
Lines 99-105 Link Here
99
			break;
102
			break;
100
	}
103
	}
101
104
102
	if((rcpts = parse_mail(&msg_buffer, &(serverinfo.num_rcpts))) == NULL)
105
106
	if( (msgrcpts = parse_mail(&msg_buffer, &num_rcpts)) == NULL)
103
	{
107
	{
104
		log_msg(LOG_DEBUG, "Error in parse_mail");
108
		log_msg(LOG_DEBUG, "Error in parse_mail");
105
		if (debug > 0)
109
		if (debug > 0)
Lines 117-122 Link Here
117
#endif
121
#endif
118
	}
122
	}
119
123
124
	/* If no recipients specified on command line, use the ones we parsed
125
	 * out of the headers */
126
	if ( ! rcpts ) {
127
		rcpts = msgrcpts;
128
		serverinfo.num_rcpts = num_rcpts;
129
	}
130
120
	if(send_mail(&msg_buffer, &serverinfo, rcpts))
131
	if(send_mail(&msg_buffer, &serverinfo, rcpts))
121
	{
132
	{
122
		log_msg(LOG_DEBUG, "Error in send_mail");
133
		log_msg(LOG_DEBUG, "Error in send_mail");
(-)nbsmtp-1.00/nbsmtp.8 (+5 lines)
Lines 28-33 Link Here
28
SASL Password
28
SASL Password
29
.IP "-M [l|p|c]"
29
.IP "-M [l|p|c]"
30
SASL Method: l - AUTH LOGIN , p - AUTH PLAIN (default), c - AUTH CRAM-MD5 (only available when SSL compiled in)
30
SASL Method: l - AUTH LOGIN , p - AUTH PLAIN (default), c - AUTH CRAM-MD5 (only available when SSL compiled in)
31
.IP "-t \fIto-address\fP"
32
Envelope Recipient. Specifying a recipient with -t will override the 
33
recipients discovered in the message headers. This is useful for so-called
34
\'bouncing\' of messages. You may use -t multiple times to specify more
35
envelope recipients.
31
.IP "-s"
36
.IP "-s"
32
If SSL compiled-in; use SSL to transfer the message
37
If SSL compiled-in; use SSL to transfer the message
33
.IP "-S"
38
.IP "-S"
(-)nbsmtp-1.00/original.c (-3 / +20 lines)
Lines 51-64 Link Here
51
 * \param[out]	serverinfo	A pointer to a servinfo_t struct
51
 * \param[out]	serverinfo	A pointer to a servinfo_t struct
52
 * \return Returns 0 if everything went ok, 2 if we got -H (print long_help) and 1 in case of error
52
 * \return Returns 0 if everything went ok, 2 if we got -H (print long_help) and 1 in case of error
53
 */
53
 */
54
int parse_options(int argc,char *argv[], servinfo_t *serverinfo)
54
int parse_options(int argc, char *argv[], servinfo_t *serverinfo, 
55
		string_t **rcpts)
55
{
56
{
56
	int c;
57
	int c;
57
	char buffer[BUF_SIZE];
58
	char buffer[BUF_SIZE];
58
	bool_t read_syswide = True;
59
	bool_t read_syswide = True;
59
	bool_t read_localconf = True;
60
	bool_t read_localconf = True;
60
61
61
	for (c = 0 ; c < argc ; c++)
62
	/* argv[0] = "nbsmtp" or whatever name was used to call the program.
63
	 * We don't need to check it as an option */
64
	for (c = 1 ; c < argc ; c++)
62
	{
65
	{
63
		if (strncmp("-n",argv[c],strlen("-n"))==0)
66
		if (strncmp("-n",argv[c],strlen("-n"))==0)
64
		{
67
		{
Lines 78-84 Link Here
78
	}
81
	}
79
82
80
	/* Then read the options */
83
	/* Then read the options */
81
	while ((c = getopt(argc,argv,"h:d:f:c:p:U:P:M:sSvVDHnN")) != -1)
84
	while ((c = getopt(argc,argv,"h:d:f:c:p:U:P:M:t:sSvVDHnN")) != -1)
82
	{
85
	{
83
		switch(c)
86
		switch(c)
84
		{
87
		{
Lines 157-162 Link Here
157
						break;
160
						break;
158
				}
161
				}
159
				break;
162
				break;
163
			case 't':
164
				serverinfo->num_rcpts += 1;
165
				*rcpts = (string_t*) realloc(*rcpts,
166
						(serverinfo->num_rcpts * 
167
						 sizeof(string_t)));
168
				if (! *rcpts) {
169
					perror("realloc in parsing -t");
170
					return 1;
171
				}
172
				(*rcpts)[serverinfo->num_rcpts-1].str = 
173
					(char *)strdup(optarg);
174
				(*rcpts)[serverinfo->num_rcpts-1].len = 
175
				  strlen((*rcpts)[serverinfo->num_rcpts-1].str);
176
				break;
160
			case 'H':
177
			case 'H':
161
				print_help(argv[0]);
178
				print_help(argv[0]);
162
				return 2;
179
				return 2;
(-)nbsmtp-1.00/original.h (-1 / +1 lines)
Lines 32-35 Link Here
32
string_t *parse_mail(string_t*,int*);
32
string_t *parse_mail(string_t*,int*);
33
int send_mail(string_t*,servinfo_t*,string_t*);
33
int send_mail(string_t*,servinfo_t*,string_t*);
34
int get_socket(servinfo_t*);
34
int get_socket(servinfo_t*);
35
int parse_options(int,char*[],servinfo_t*);
35
int parse_options(int,char*[],servinfo_t*,string_t**);
(-)nbsmtp-1.00/util.c (+2 lines)
Lines 262-267 Link Here
262
	printf("  -v\tprint version and exit\n");
262
	printf("  -v\tprint version and exit\n");
263
	printf("  -c\tuse an additional config file\n");
263
	printf("  -c\tuse an additional config file\n");
264
	printf("  -H\tthis help message\n");
264
	printf("  -H\tthis help message\n");
265
	printf("  -t\tspecify envelope to:, overriding message headers\n");
266
	printf("    \tyou may use -t multiple times.\n"); 
265
267
266
	printf("\nSend bug reports and comments to <%s>.\n\n",PACKAGE_BUGREPORT);
268
	printf("\nSend bug reports and comments to <%s>.\n\n",PACKAGE_BUGREPORT);
267
}
269
}

Return to bug 123354