Lines Matching refs:daemon
44 char *packet = daemon->packet; in tftp_request()
53 int port = daemon->start_tftp_port; /* may be zero to use ephemeral port */ in tftp_request()
78 iov.iov_len = daemon->packet_buff_sz; in tftp_request()
81 daemon->srv_save = NULL; in tftp_request()
86 if (daemon->options & OPT_NOWILD) in tftp_request()
129 for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next) in tftp_request()
172 if (errno == EADDRINUSE && daemon->start_tftp_port != 0) in tftp_request()
174 if (++port <= daemon->end_tftp_port) in tftp_request()
205 !(daemon->options & OPT_TFTP_NOBLOCK)) in tftp_request()
210 if (transfer->blocksize > (unsigned)daemon->packet_buff_sz - 4) in tftp_request()
211 transfer->blocksize = (unsigned)daemon->packet_buff_sz - 4; in tftp_request()
230 strcpy(daemon->namebuff, "/"); in tftp_request()
231 if (daemon->tftp_prefix) in tftp_request()
233 if (daemon->tftp_prefix[0] == '/') in tftp_request()
234 daemon->namebuff[0] = 0; in tftp_request()
235 strncat(daemon->namebuff, daemon->tftp_prefix, (MAXDNAME-1) - strlen(daemon->namebuff)); in tftp_request()
236 if (daemon->tftp_prefix[strlen(daemon->tftp_prefix)-1] != '/') in tftp_request()
237 strncat(daemon->namebuff, "/", (MAXDNAME-1) - strlen(daemon->namebuff)); in tftp_request()
239 if (daemon->options & OPT_TFTP_APREF) in tftp_request()
241 size_t oldlen = strlen(daemon->namebuff); in tftp_request()
244 strncat(daemon->namebuff, inet_ntoa(peer.sin_addr), (MAXDNAME-1) - strlen(daemon->namebuff)); in tftp_request()
245 strncat(daemon->namebuff, "/", (MAXDNAME-1) - strlen(daemon->namebuff)); in tftp_request()
248 if (stat(daemon->namebuff, &statbuf) == -1 || !S_ISDIR(statbuf.st_mode)) in tftp_request()
249 daemon->namebuff[oldlen] = 0; in tftp_request()
255 if (strstr(filename, daemon->namebuff) == filename) in tftp_request()
256 daemon->namebuff[0] = 0; in tftp_request()
262 daemon->namebuff[0] = 0; in tftp_request()
263 strncat(daemon->namebuff, filename, (MAXDNAME-1) - strlen(daemon->namebuff)); in tftp_request()
269 len = tftp_err_oops(packet, daemon->namebuff); in tftp_request()
282 …my_syslog(MS_TFTP | LOG_INFO, _("TFTP sent %s to %s"), daemon->namebuff, inet_ntoa(peer.sin_addr)); in tftp_request()
283 transfer->next = daemon->tftp_trans; in tftp_request()
284 daemon->tftp_trans = transfer; in tftp_request()
290 char *packet = daemon->packet, *namebuff = daemon->namebuff; in check_tftp_fileperm()
298 if (daemon->tftp_prefix && strstr(namebuff, "/../")) in check_tftp_fileperm()
325 else if ((daemon->options & OPT_TFTP_SECURE) && uid != statbuf.st_uid) in check_tftp_fileperm()
333 for (t = daemon->tftp_trans; t; t = t->next) in check_tftp_fileperm()
378 } *mess = (struct ack *)daemon->packet; in check_tftp_listeners()
381 for (transfer = daemon->tftp_trans, up = &daemon->tftp_trans; transfer; transfer = tmp) in check_tftp_listeners()
388 daemon->srv_save = NULL; in check_tftp_listeners()
390 …if ((len = recv(transfer->sockfd, daemon->packet, daemon->packet_buff_sz, 0)) >= (ssize_t)sizeof(s… in check_tftp_listeners()
402 char *p = daemon->packet + sizeof(struct ack); in check_tftp_listeners()
403 char *end = daemon->packet + len; in check_tftp_listeners()
435 daemon->srv_save = NULL; in check_tftp_listeners()
437 if ((len = get_block(daemon->packet, transfer)) == -1) in check_tftp_listeners()
439 len = tftp_err_oops(daemon->packet, transfer->file->filename); in check_tftp_listeners()
453 while(sendto(transfer->sockfd, daemon->packet, len, 0, in check_tftp_listeners()