SHA256
1
0
forked from pool/atftp
OBS User unknown 2007-01-15 22:51:51 +00:00 committed by Git OBS Bridge
commit b61cab1107
13 changed files with 843 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

70
atftp-0.7.dif Normal file
View File

@ -0,0 +1,70 @@
Index: argz.h
===================================================================
--- argz.h.orig
+++ argz.h
@@ -180,7 +180,7 @@ extern char *argz_next (__const char *__
#ifdef __USE_EXTERN_INLINES
extern inline char *
__argz_next (__const char *__argz, size_t __argz_len,
- __const char *__entry) __THROW
+ __const char *__entry)
{
if (__entry)
{
@@ -194,7 +194,7 @@ __argz_next (__const char *__argz, size_
}
extern inline char *
argz_next (__const char *__argz, size_t __argz_len,
- __const char *__entry) __THROW
+ __const char *__entry)
{
return __argz_next (__argz, __argz_len, __entry);
}
Index: tftp.c
===================================================================
--- tftp.c.orig
+++ tftp.c
@@ -354,7 +354,7 @@ char *command_generator(const char *text
void make_arg(char *string, int *argc, char ***argv)
{
static char *tmp = NULL;
- int argz_len;
+ size_t argz_len;
/* split the string to an argz vector */
if (argz_create_sep(string, ' ', &tmp, &argz_len) != 0)
@@ -731,7 +731,7 @@ int get_file(int argc, char **argv)
fsync(data.sockfd);
close(data.sockfd);
- return OK;
+ return tftp_result;
}
#ifdef HAVE_MTFTP
Index: tftp_file.c
===================================================================
--- tftp_file.c.orig
+++ tftp_file.c
@@ -59,9 +59,9 @@ int tftp_find_bitmap_hole(int prev_hole,
unsigned int next_word;
/* initial stuff */
- next_hole = prev_hole + 1;
- next_word_no = next_hole / 32;
- next_bit_no = next_hole % 32;
+ next_hole = 0;
+ next_word_no = next_hole / 32; /* effectively 0 */
+ next_bit_no = next_hole % 32; /* effectively 0 */
next_word = bitmap[next_word_no];
/* Check if there is a remainder of the current word to traverse */
@@ -136,7 +136,7 @@ int tftp_receive_file(struct client_data
struct hostent *host;
int master_client = 0;
unsigned int file_bitmap[NB_BLOCK];
- int prev_bitmap_hole = -1; /* the previous hole found in the bitmap */
+ int prev_bitmap_hole = 0; /* the previous hole found in the bitmap */
char string[MAXLEN];
int prev_block_number = 0; /* needed to support netascii convertion */

3
atftp-0.7.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90a3cb7d2bf4ef3d82bdff2d01d95ca1f53607438211c944bb3ee4ae7ac27b6f
size 164599

View File

@ -0,0 +1,109 @@
Index: logger.c
===================================================================
--- logger.c.orig
+++ logger.c
@@ -27,6 +27,7 @@
#include <time.h>
#include <unistd.h>
#include <netdb.h>
+#include <pthread.h>
#include "logger.h"
#define MAXLEN 128
@@ -102,17 +103,17 @@ void logger(int severity, const char *fm
if (severity <= log_priority)
{
vsnprintf(message, sizeof(message), fmt, args);
-
+
if (log_fp)
{
- fprintf(log_fp, "%s %s %s[%d.%d]: %s\n", time_buf, hostname,
+ fprintf(log_fp, "%s %s %s[%d.%ld]: %s\n", time_buf, hostname,
log_ident, getpid(), pthread_self(), message);
fflush(log_fp);
}
else if (log_syslog_is_open)
syslog(severity, "%s", message);
else
- fprintf(stderr, "%s %s %s[%d.%d]: %s\n", time_buf, hostname,
+ fprintf(stderr, "%s %s %s[%d.%ld]: %s\n", time_buf, hostname,
log_ident, getpid(), pthread_self(), message);
}
va_end(args);
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -66,7 +66,7 @@ AC_PROG_CC
dnl Check for AIX
AC_AIX
-CFLAGS="-g -Wall -D_REENTRANT"
+CFLAGS="${CFLAGS} -g -Wall -D_REENTRANT"
if test x$debug = xtrue; then
CFLAGS="$CFLAGS -O0 -DDEBUG"
Index: tftpd_list.c
===================================================================
--- tftpd_list.c.orig
+++ tftpd_list.c
@@ -143,13 +143,13 @@ int tftpd_list_find_multicast_server_and
char options[MAXLEN];
char string[MAXLEN];
char *index;
- int len;
+ size_t len;
*thread = NULL;
opt_request_to_string(tftp_options, options, MAXLEN);
index = strstr(options, "multicast");
- len = (int)index - (int)options;
+ len = (size_t)(index - options);
/* lock the whole list before walking it */
pthread_mutex_lock(&thread_list_mutex);
@@ -166,7 +166,7 @@ int tftpd_list_find_multicast_server_and
/* must have exact same option string */
if (strncmp(string, options, len) == 0)
{
- *thread = current;
+ *thread = current;
/* insert the new client at the end. If the client is already
in the list, don't add it again. */
tmp = current->client_info;
@@ -188,17 +188,17 @@ int tftpd_list_find_multicast_server_and
}
tmp->next = client;
/* unlock mutex and exit */
- pthread_mutex_unlock(&current->client_mutex);
+ pthread_mutex_unlock(&current->client_mutex);
pthread_mutex_unlock(&thread_list_mutex);
return 1;
}
}
- pthread_mutex_unlock(&current->client_mutex);
+ pthread_mutex_unlock(&current->client_mutex);
}
current = current->next;
}
pthread_mutex_unlock(&thread_list_mutex);
-
+
return 0;
}
Index: tftp_mtftp.c
===================================================================
--- tftp_mtftp.c.orig
+++ tftp_mtftp.c
@@ -63,7 +63,7 @@ extern int tftp_cancel;
* If mode = 0, count missed packet from block 0. Else, start after first
* received block.
*/
-int tftp_mtftp_missed_packet(int file_bitmap[], int last_block, int mode)
+int tftp_mtftp_missed_packet(unsigned int file_bitmap[], int last_block, int mode)
{
int missed_block = 0;
int block_number = 0;

19
atftp-0.7_sol_ip.patch Normal file
View File

@ -0,0 +1,19 @@
Index: tftp_io.c
===================================================================
--- tftp_io.c.orig
+++ tftp_io.c
@@ -284,12 +284,14 @@ int tftp_get_packet(int sock1, int sock2
cmsg != NULL && cmsg->cmsg_len >= sizeof(*cmsg);
cmsg = CMSG_NXTHDR(&msg, cmsg))
{
+#ifdef SOL_IP
if (cmsg->cmsg_level == SOL_IP
&& cmsg->cmsg_type == IP_PKTINFO)
{
pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg);
sa_to->sin_addr = pktinfo->ipi_addr;
}
+#endif
break;
}
}

View File

@ -0,0 +1,41 @@
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271816
Index: tftpd.c
===================================================================
--- tftpd.c.orig
+++ tftpd.c
@@ -157,6 +157,7 @@ int main(int argc, char **argv)
struct servent *serv;
struct passwd *user;
struct group *group;
+ pthread_t tid;
#ifdef HAVE_MTFTP
pthread_t mtftp_thread;
@@ -466,7 +467,7 @@ int main(int argc, char **argv)
new->client_info->next = NULL;
/* Start a new server thread. */
- if (pthread_create(&new->tid, NULL, tftpd_receive_request,
+ if (pthread_create(&tid, NULL, tftpd_receive_request,
(void *)new) != 0)
{
logger(LOG_ERR, "Failed to start new thread");
@@ -567,7 +568,8 @@ void *tftpd_receive_request(void *arg)
/* Detach ourself. That way the main thread does not have to
* wait for us with pthread_join. */
- pthread_detach(pthread_self());
+ data->tid = pthread_self();
+ pthread_detach(data->tid);
/* Read the first packet from stdin. */
data_size = data->data_buffer_size;
@@ -733,7 +735,7 @@ void *tftpd_receive_request(void *arg)
/* free the thread structure */
free(data);
-
+
logger(LOG_INFO, "Server thread exiting");
pthread_exit(NULL);
}

13
atftp-CLK_TCK.diff Normal file
View File

@ -0,0 +1,13 @@
--- stats.c
+++ stats.c
@@ -142,6 +142,10 @@
pthread_mutex_unlock(&s_stats.mutex);
}
+#ifndef CLK_TCK
+#define CLK_TCK CLOCKS_PER_SEC
+#endif
+
/*
* Called at the end of the main thread, when no other threads are
* running, to print the final statistics.

196
atftp.changes Normal file
View File

@ -0,0 +1,196 @@
-------------------------------------------------------------------
Mon Jul 31 16:16:43 CEST 2006 - mrueckert@suse.de
- added /var/run/atftpd/ (0755,nobody,nogroup):
at ftp can finally create pid files
the default pid file for a single instance will be
/var/run/atftpd/pid
- added support to run multiple instances of atftpd bound to specific
IP addresses:
* new sysconfig variable ATFTPD_BIND_ADDRESSES: whitespace
seperated list of ip addresses.
* each instance has its own pid file /var/run/atftpd/$ip.pid
-------------------------------------------------------------------
Sat Jul 1 04:54:51 CEST 2006 - mrueckert@suse.de
- bump the version number to 0.7.0:
This fix is needed because 0.7 < 0.7cvs. Replaced %{version}
with %{pkg_version} everywhere. %{pkg_version} holds the original
value of 0.7.
-------------------------------------------------------------------
Thu Mar 30 18:32:19 CEST 2006 - mrueckert@suse.de
- added atftp-0.7_compiler_warnings.patch:
o missing include of pthread.h
o make the the 1st parameter of tftp_mtftp_missed_packet
unsigned int to fix a differ in signedness warning
o configure overwrote the CFLAGS from the environment.
o fixed logging of threadids
- added atftp-0.7_thread_crash.patch:
fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271816
- added atftp-0.7_sol_ip.patch:
only use the SOL_IP if it is defined
- updated atftp-0.7.dif:
o really always run through the whole bitmap to find old holes.
(bug #148779, #65660)
-------------------------------------------------------------------
Wed Jan 25 21:34:30 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Tue Dec 20 11:56:43 CET 2005 - ro@suse.de
- define CLK_TCK if not already done
-------------------------------------------------------------------
Thu Mar 3 19:12:15 CET 2005 - nashif@suse.de
- Applied patch from #65660: transfer breaks down if packets get
dropped
-------------------------------------------------------------------
Thu Mar 3 19:06:48 CET 2005 - nashif@suse.de
- According to #65660 memory allocation issue not present anymore
-------------------------------------------------------------------
Sun Feb 13 21:46:53 CET 2005 - nashif@suse.de
- fixed segfault on x86_64
-------------------------------------------------------------------
Tue Nov 16 06:44:58 CET 2004 - ro@suse.de
- merge old changelog entries (after checking all fixes are here)
- removed also destdir.patch (included upstream)
-------------------------------------------------------------------
Fri Nov 12 19:17:31 CET 2004 - jhargado@suse.de
- Added a patch to fix a problem where if a client requests a file
that doesn't exist, sometimes the daemon would exit without warning.
The .7 version of atftp is needed in SLRS to allow HA functionality.
This package is only included in the SLRS distribution.
-------------------------------------------------------------------
Sat Sep 11 17:21:40 CEST 2004 - kukuk@suse.de
- Adjust to new glibc __THROW define
-------------------------------------------------------------------
Mon Apr 12 03:05:46 CEST 2004 - nashif@suse.de
- update to 0.7 final
- when called in batch mode, return right exit code if
operation fails.
-------------------------------------------------------------------
Tue Mar 9 15:23:01 CET 2004 - ms@suse.de
- include timeout patch:
We finally got a network trace with
the ACKs included. When the client fails the checksum, it stops acking
the server. This was occurring anywhere from the middle to the end of the
730MB download. It boils down to slower systems are taking to long to
write the network data to the disk and in the meanwhile the tftp timeout
value is incrementing and when it reaches 5 tftp timeouts, the clients
gives up!! Dan added code to reset the timeout counter when the client
received another good packet. With this fix, the clients, even slow
clients never failed. We think adding more memory to the slower clients
made the problem worse because it took longer to write the memory cache
out to the disk and caused more timeouts. While trying to cause more
timeouts on the clients (we paused the client in the middle of the
download), we noticed the server code has the same timeout scheme so Dan
also added this code to reset the timeout counter when good packets were
received. These fixes look solid, even under error conditions.
-------------------------------------------------------------------
Mon Mar 1 05:33:58 CET 2004 - nashif@suse.de
- Update to 0.7 cvs
-------------------------------------------------------------------
Wed Feb 4 17:54:51 CET 2004 - ms@suse.de
- according to Anas Nashif <nashif@suse.de> the current version
0.6.2 includes the fix for bug (#27341). buffer overflow when a long
filename is sent to the server
-------------------------------------------------------------------
Wed Feb 4 15:26:43 CET 2004 - ms@suse.de
- include version 0.6.2 to SLES8 includes important multicast
fixes related to project Point-of-Sale (#34074)
-------------------------------------------------------------------
Thu Feb 19 10:50:20 CET 2004 - kukuk@suse.de
- Cleanup neededforbuild
-------------------------------------------------------------------
Sat Jan 10 21:11:12 CET 2004 - adrian@suse.de
- build as user
-------------------------------------------------------------------
Fri Aug 29 04:38:45 CEST 2003 - nashif@suse.de
- Provide default tftp directory
-------------------------------------------------------------------
Fri Aug 1 05:46:44 CEST 2003 - nashif@suse.de
- update to 0.6.2
- Fixes bug #27341
- Readded conflict to tftp
-------------------------------------------------------------------
Wed May 28 16:41:41 CEST 2003 - nashif@suse.de
- Removed conflict to tftp
- added manpages as doc files
-------------------------------------------------------------------
Mon May 26 13:05:04 CEST 2003 - lmuelle@suse.de
- Remove set -e from init script; exit with rc 5 if binary is not installed
-------------------------------------------------------------------
Wed Jan 1 17:21:33 CET 2003 - nashif@suse.de
- Fixed bug #22614: missing metadata in sysconfig template
-------------------------------------------------------------------
Sat Sep 14 06:23:15 CEST 2002 - nashif@suse.de
- Added missing restart to init script
-------------------------------------------------------------------
Fri Aug 30 17:04:36 CEST 2002 - nashif@suse.de
- Fixed bug #18661: Removed ; from sysconfig file
-------------------------------------------------------------------
Sat Aug 17 18:31:00 CEST 2002 - nashif@suse.de
- Fixed bug #17793: Added PreReq
- Fixed init script output
-------------------------------------------------------------------
Sun Jun 9 06:45:05 CEST 2002 - nashif@suse.de
- Update to version 0.6.1.1
-------------------------------------------------------------------
Sat Apr 13 18:00:14 CEST 2002 - nashif@suse.de
- Use tftp_LDADD for libraries instead of LDFLAGS
-------------------------------------------------------------------
Sat Mar 23 04:38:43 CET 2002 - nashif@suse.de
- Initial release (0.50)

208
atftp.spec Normal file
View File

@ -0,0 +1,208 @@
#
# spec file for package atftp (Version 0.7.0)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: atftp
%define pkg_version 0.7
Version: 0.7.0
Release: 2
License: GPL
Group: System/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: readline-devel tcpd-devel
PreReq: %insserv_prereq %fillup_prereq
Conflicts: tftp
URL: ftp://ftp.mamalinux.com/pub/atftp/
Source: %{name}-%{pkg_version}.tar.bz2
Source1: atftpd.init.d
Source2: atftpd.sysconfig
Patch1: atftp-0.7.dif
Patch2: atftp-CLK_TCK.diff
Patch3: atftp-0.7_compiler_warnings.patch
Patch4: atftp-0.7_thread_crash.patch
Patch5: atftp-0.7_sol_ip.patch
Summary: Advanced TFTP Server and Client
%description
atftp stands for Advanced Trivial File Transfer Protocol. It is called
"advanced", in contrast to others TFTP servers, for two reasons. First,
it is intended to be fully compliant with all related RFCs. This
includes RFC1350, RFC2090, RFC2347, RFC2348, and RFC2349. Second, atftp
is intended for serving boot files to large clusters. It is
multithreaded and will eventually support multicast, allowing faster
boot of hundreds of machines simultaneously.
Authors:
--------
Jean-Pierre Lefebvre <helix@step.polymtl.ca>
Remi Lefebvre <remi@debian.org>
%prep
%setup -q -n %{name}-%{pkg_version}
%patch1
%patch2
%patch3
%patch4
%patch5
%build
autoreconf -fi
%configure
%{__make}
%install
%makeinstall
# SuSE rc
%{__install} -D -m 0755 %{S:1} %{buildroot}/etc/init.d/atftpd
%{__ln_s} -f ../../etc/init.d/atftpd %{buildroot}%{_sbindir}/rcatftpd
%{__install} -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.atftpd
%{__install} -Dd -m 0750 %{buildroot}/var/run/atftpd/
%clean
%{__rm} -rf %{buildroot}
%preun
%stop_on_removal atftpd
%post
%{fillup_and_insserv -n -s atftpd}
%postun
%restart_on_update atftpd
%{insserv_cleanup}
%files
%defattr(-,root,root)
%doc BUGS FAQ LICENSE README TODO
%{_bindir}/atftp
%{_sbindir}/atftpd
%{_sbindir}/in.tftpd
%{_sbindir}/rcatftpd
/etc/init.d/atftpd
/var/adm/fillup-templates/sysconfig.atftpd
%{_mandir}/man1/atftp.1.gz
%{_mandir}/man8/atftpd.8.gz
%{_mandir}/man8/in.tftpd.8.gz
%dir %attr(-,nobody,nogroup) /var/run/atftpd/
%changelog -n atftp
* Mon Jul 31 2006 - mrueckert@suse.de
- added /var/run/atftpd/ (0755,nobody,nogroup):
at ftp can finally create pid files
the default pid file for a single instance will be
/var/run/atftpd/pid
- added support to run multiple instances of atftpd bound to specific
IP addresses:
* new sysconfig variable ATFTPD_BIND_ADDRESSES: whitespace
seperated list of ip addresses.
* each instance has its own pid file /var/run/atftpd/$ip.pid
* Sat Jul 01 2006 - mrueckert@suse.de
- bump the version number to 0.7.0:
This fix is needed because 0.7 < 0.7cvs. Replaced %%{version}
with %%{pkg_version} everywhere. %%{pkg_version} holds the original
value of 0.7.
* Thu Mar 30 2006 - mrueckert@suse.de
- added atftp-0.7_compiler_warnings.patch:
o missing include of pthread.h
o make the the 1st parameter of tftp_mtftp_missed_packet
unsigned int to fix a differ in signedness warning
o configure overwrote the CFLAGS from the environment.
o fixed logging of threadids
- added atftp-0.7_thread_crash.patch:
fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271816
- added atftp-0.7_sol_ip.patch:
only use the SOL_IP if it is defined
- updated atftp-0.7.dif:
o really always run through the whole bitmap to find old holes.
(bug #148779, #65660)
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Dec 20 2005 - ro@suse.de
- define CLK_TCK if not already done
* Thu Mar 03 2005 - nashif@suse.de
- Applied patch from #65660: transfer breaks down if packets get
dropped
* Thu Mar 03 2005 - nashif@suse.de
- According to #65660 memory allocation issue not present anymore
* Sun Feb 13 2005 - nashif@suse.de
- fixed segfault on x86_64
* Tue Nov 16 2004 - ro@suse.de
- merge old changelog entries (after checking all fixes are here)
- removed also destdir.patch (included upstream)
* Fri Nov 12 2004 - jhargado@suse.de
- Added a patch to fix a problem where if a client requests a file
that doesn't exist, sometimes the daemon would exit without warning.
The .7 version of atftp is needed in SLRS to allow HA functionality.
This package is only included in the SLRS distribution.
* Sat Sep 11 2004 - kukuk@suse.de
- Adjust to new glibc __THROW define
* Mon Apr 12 2004 - nashif@suse.de
- update to 0.7 final
- when called in batch mode, return right exit code if
operation fails.
* Tue Mar 09 2004 - ms@suse.de
- include timeout patch:
We finally got a network trace with
the ACKs included. When the client fails the checksum, it stops acking
the server. This was occurring anywhere from the middle to the end of the
730MB download. It boils down to slower systems are taking to long to
write the network data to the disk and in the meanwhile the tftp timeout
value is incrementing and when it reaches 5 tftp timeouts, the clients
gives up!! Dan added code to reset the timeout counter when the client
received another good packet. With this fix, the clients, even slow
clients never failed. We think adding more memory to the slower clients
made the problem worse because it took longer to write the memory cache
out to the disk and caused more timeouts. While trying to cause more
timeouts on the clients (we paused the client in the middle of the
download), we noticed the server code has the same timeout scheme so Dan
also added this code to reset the timeout counter when good packets were
received. These fixes look solid, even under error conditions.
* Mon Mar 01 2004 - nashif@suse.de
- Update to 0.7 cvs
* Thu Feb 19 2004 - kukuk@suse.de
- Cleanup neededforbuild
* Wed Feb 04 2004 - ms@suse.de
- according to Anas Nashif <nashif@suse.de> the current version
0.6.2 includes the fix for bug (#27341). buffer overflow when a long
filename is sent to the server
* Wed Feb 04 2004 - ms@suse.de
- include version 0.6.2 to SLES8 includes important multicast
fixes related to project Point-of-Sale (#34074)
* Sat Jan 10 2004 - adrian@suse.de
- build as user
* Fri Aug 29 2003 - nashif@suse.de
- Provide default tftp directory
* Fri Aug 01 2003 - nashif@suse.de
- update to 0.6.2
- Fixes bug #27341
- Readded conflict to tftp
* Wed May 28 2003 - nashif@suse.de
- Removed conflict to tftp
- added manpages as doc files
* Mon May 26 2003 - lmuelle@suse.de
- Remove set -e from init script; exit with rc 5 if binary is not installed
* Wed Jan 01 2003 - nashif@suse.de
- Fixed bug #22614: missing metadata in sysconfig template
* Sat Sep 14 2002 - nashif@suse.de
- Added missing restart to init script
* Fri Aug 30 2002 - nashif@suse.de
- Fixed bug #18661: Removed ; from sysconfig file
* Sat Aug 17 2002 - nashif@suse.de
- Fixed bug #17793: Added PreReq
- Fixed init script output
* Sun Jun 09 2002 - nashif@suse.de
- Update to version 0.6.1.1
* Sat Apr 13 2002 - nashif@suse.de
- Use tftp_LDADD for libraries instead of LDFLAGS
* Sat Mar 23 2002 - nashif@suse.de
- Initial release (0.50)

128
atftpd.init.d Normal file
View File

@ -0,0 +1,128 @@
#! /bin/sh
# Copyright (c) 2002,2003 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Anas Nashif
#
# /etc/init.d/atftpd
# and its symbolic link
# /usr/sbin/rcatftpd
#
### BEGIN INIT INFO
# Provides: atftpd
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: launch atftpd server
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# rc_active checks whether a service is activated by symlinks
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
ATFTPD_BIN="/usr/sbin/atftpd"
if [ ! -x $ATFTPD_BIN ]; then
echo -n "Advanced Trivial FTP server, $ATFTPD_BIN is not installed."
# Tell the user this has skipped
rc_status -s
exit 5
fi
# Set default in case of missing sysconfig file
ATFTPD_USE_INETD=yes
ATFTPD_OPTIONS=""
if [ -f /etc/sysconfig/atftpd ]; then
. /etc/sysconfig/atftpd
fi
if [ "$ATFTPD_USE_INETD" = "yes" ]; then
exit 0;
fi
case "$1" in
start)
if [ -n "$ATFTPD_BIND_ADDRESSES" ]; then
for IP in $ATFTPD_BIND_ADDRESSES; do
echo -n "Starting Advanced Trivial FTP server on $IP"
startproc -p "/var/run/atftpd/$IP.pid" -f $ATFTPD_BIN --pidfile "/var/run/atftpd/$IP.pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY --bind-address $IP
rc_status -v
done
else
echo -n "Starting Advanced Trivial FTP server"
startproc $ATFTPD_BIN --pidfile "/var/run/atftpd/pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY
rc_status -v
fi
;;
stop)
echo -n "Stopping Advanced Trivial FTP server"
killproc -TERM $ATFTPD_BIN
rc_status -v
# Remember status and be verbose
# rc_status -v
;;
try-restart)
## Do a restart only if the service was active before.
## Note: try-restart is not (yet) part of LSB (as of 1.2)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for service atftp:"
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Return value is slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $ATFTPD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart}"
exit 1
;;
esac
rc_exit

32
atftpd.sysconfig Normal file
View File

@ -0,0 +1,32 @@
## Path: Network/FTP/Atftpd
## Description: ATFTP Configuration
## Type: string
## Default: "--daemon "
#
# atftpd options
#
ATFTPD_OPTIONS="--daemon "
## Type: yesno
## Default: no
#
# Use inetd instead of daemon
#
ATFTPD_USE_INETD="no"
## Type: string
## Default: "/tftpboot"
#
# TFTP directory must be a world readable/writable directory.
# By default /tftpboot is assumed.
#
ATFTPD_DIRECTORY="/tftpboot"
## Type: string
## Default: ""
#
# Whitespace seperated list of IP addresses which ATFTPD binds to.
# One instance of the service is started on each IP address.
# By default atftpd will listen on all available IP addresses/interfaces.
#
ATFTPD_BIND_ADDRESSES=""

0
ready Normal file
View File