comparison cli-agentfwd.c @ 547:cf376c696dfc agent-client

Make it compile, update for changes in channel structure.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 01 Jul 2009 04:53:17 +0000
parents ca7e76d981d9
children 61c3513825b0
comparison
equal deleted inserted replaced
546:568638be7203 547:cf376c696dfc
45 #include "signkey.h" 45 #include "signkey.h"
46 #include "auth.h" 46 #include "auth.h"
47 47
48 static int new_agent_chan(struct Channel * channel); 48 static int new_agent_chan(struct Channel * channel);
49 49
50 const struct ChanType chan_cli_agent = { 50 const struct ChanType cli_chan_agent = {
51 0, /* sepfds */ 51 0, /* sepfds */
52 "[email protected]", 52 "[email protected]",
53 new_agent_chan, 53 new_agent_chan,
54 NULL, 54 NULL,
55 NULL, 55 NULL,
83 83
84 setnonblocking(fd); 84 setnonblocking(fd);
85 85
86 ses.maxfd = MAX(ses.maxfd, fd); 86 ses.maxfd = MAX(ses.maxfd, fd);
87 87
88 channel->infd = fd; 88 channel->readfd = fd;
89 channel->outfd = fd; 89 channel->writefd = fd;
90 90
91 // success 91 // success
92 return 0; 92 return 0;
93 } 93 }
94 94
149 buf_free(payload); 149 buf_free(payload);
150 150
151 return inbuf; 151 return inbuf;
152 } 152 }
153 153
154 static SignKeyList * agent_get_key_list(int fd) 154 static struct SignKeyList * agent_get_key_list(int fd)
155 { 155 {
156 buffer * inbuf = NULL; 156 buffer * inbuf = NULL;
157 unsigned int num = 0; 157 unsigned int num = 0;
158 unsigned char packet_type; 158 unsigned char packet_type;
159 unsigned int i; 159 unsigned int i;
181 } 181 }
182 182
183 num = buf_getint(inbuf); 183 num = buf_getint(inbuf);
184 for (i = 0; i < num; i++) { 184 for (i = 0; i < num; i++) {
185 sign_key * pubkey = NULL; 185 sign_key * pubkey = NULL;
186 char key_type = DROPBEAR_SIGNKEY_ANY; 186 int key_type = DROPBEAR_SIGNKEY_ANY;
187 struct SignKeyList *nextkey = NULL; 187 struct SignKeyList *nextkey = NULL;
188 188
189 nextkey = (struct SignKeyList*)m_malloc(sizeof(struct SignKeyList)); 189 nextkey = (struct SignKeyList*)m_malloc(sizeof(struct SignKeyList));
190 if (key) 190 if (key)
191 key->next = nextkey; 191 key->next = nextkey;
216 } 216 }
217 217
218 return retkey; 218 return retkey;
219 } 219 }
220 220
221 /* return DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ 221 void load_agent_keys()
222 SignKeyList * load_agent_keys()
223 { 222 {
224 223
225 SignKeyList * ret_list; 224 struct SignKeyList * ret_list;
226 int fd; 225 int fd;
227 fd = connect_agent(); 226 fd = connect_agent();
228 if (fd < 0) { 227 if (fd < 0) {
229 dropbear_log(LOG_INFO, "Failed to connect to agent"); 228 dropbear_log(LOG_INFO, "Failed to connect to agent");
230 return NULL; 229 return;
231 } 230 }
232 231
233 ret_list = agent_get_key_list(fd); 232 ret_list = agent_get_key_list(fd);
234 close(fd); 233 close(fd);
235 } 234 }