[dovecot-cvs] dovecot/src/login client.c,1.19,1.20 master.c,1.7,1.8

cras at procontrol.fi cras at procontrol.fi
Thu Dec 19 03:02:38 EET 2002


Update of /home/cvs/dovecot/src/login
In directory danu:/tmp/cvs-serv11467/login

Modified Files:
	client.c master.c 
Log Message:
Buffer related cleanups. Use PATH_MAX instead of hardcoded 1024 for paths.
Added str_path() and str_ppath() functions. i_snprintf() now returns only -1
or 0 depending on if buffer got full. dec2str() returns the string allocated
from data stack. Instead of just casting to (long) or (int), we now use
dec2str() with printf-like functions. Added o_stream_send_str(). Added
strocpy() and replaced all strcpy()s and strncpy()s with it.

Pretty much untested, hope it doesn't break too badly :)



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/client.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- client.c	18 Dec 2002 15:15:42 -0000	1.19
+++ client.c	19 Dec 2002 01:02:36 -0000	1.20
@@ -156,7 +156,7 @@
 
 		if (*line == '"')
 			*line++ = '\0';
-		string_remove_escapes(start);
+		str_remove_escapes(start);
 	} else {
 		start = line;
 		while (*line != '\0' && *line != ' ')
@@ -359,7 +359,7 @@
 
 void client_send_line(Client *client, const char *line)
 {
-	o_stream_send(client->output, line, strlen(line));
+	o_stream_send_str(client->output, line);
 	o_stream_send(client->output, "\r\n", 2);
 }
 

Index: master.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/master.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- master.c	18 Dec 2002 15:15:42 -0000	1.7
+++ master.c	19 Dec 2002 01:02:36 -0000	1.8
@@ -77,10 +77,8 @@
 	memcpy(&req.ip, ip, sizeof(IPADDR));
 	memcpy(req.cookie, cookie, AUTH_COOKIE_SIZE);
 
-	if (strlen(login_tag) >= sizeof(req.login_tag))
-		strcpy(req.login_tag, "*");
-	else
-		strcpy(req.login_tag, login_tag);
+	if (strocpy(req.login_tag, login_tag, sizeof(req.login_tag)) < 0)
+		strocpy(req.login_tag, "*", sizeof(req.login_tag));
 
 	if (fd_send(LOGIN_MASTER_SOCKET_FD,
 		    fd, &req, sizeof(req)) != sizeof(req))




More information about the dovecot-cvs mailing list