diff cli-algo.c @ 26:0969767bca0d

snapshot of stuff
author Matt Johnston <matt@ucc.asn.au>
date Mon, 26 Jul 2004 02:44:20 +0000
parents e4b6e2d569b2
children 0cfba3034be5
line wrap: on
line diff
--- a/cli-algo.c	Tue Jul 20 12:06:37 2004 +0000
+++ b/cli-algo.c	Mon Jul 26 02:44:20 2004 +0000
@@ -33,7 +33,8 @@
  * direction MUST be the first algorithm  on the client's list
  * that is also on the server's list.
  */
-algo_type * cli_buf_match_algo(buffer* buf, algo_type localalgos[]) {
+algo_type * cli_buf_match_algo(buffer* buf, algo_type localalgos[],
+		int *goodguess) {
 
 	unsigned char * algolist = NULL;
 	unsigned char * remotealgos[MAX_PROPOSED_ALGO];
@@ -41,6 +42,8 @@
 	unsigned int count, i, j;
 	algo_type * ret = NULL;
 
+	*goodguess = 0;
+
 	/* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */
 	algolist = buf_getstring(buf, &len);
 	TRACE(("cli_buf_match_algo: %s", algolist));
@@ -78,6 +81,10 @@
 				if (len == strlen(remotealgos[i]) 
 						&& strncmp(localalgos[j].name, 
 							remotealgos[i], len) == 0) {
+					if (i == 0 && j == 0) {
+						/* was a good guess */
+						*goodguess = 1;
+					}
 					ret = &localalgos[j];
 					goto out;
 				}