Browse code

- big makefile changes - debian fixes (works like a charm now) - ipaddr2he bug fix - changes rpm specs - modified the tar makefile target - new make vars: basedir, cfg-target, modules-target - cfg. file modified on the fly (module-path=modules-target) - ser default cfg. file=cfg-target - etc.

Andrei Pelinescu-Onciul authored on 25/09/2002 19:20:26
Showing 19 changed files
... ...
@@ -10,7 +10,8 @@ auto_gen=lex.yy.c cfg.tab.c   #lexx, yacc etc
10 10
 #include  source related defs
11 11
 include Makefile.sources
12 12
 
13
-exclude_modules=CVS cpl cpl-c ext radius_acc radius_auth snmp mysql 
13
+override exclude_modules:=CVS cpl cpl-c ext radius_acc radius_auth snmp mysql \
14
+	$(exclude_modules)
14 15
 static_modules=
15 16
 static_modules_path=$(addprefix modules/, $(static_modules))
16 17
 extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
... ...
@@ -49,7 +50,7 @@ $(NAME): static_modules
49 49
 lex.yy.c: cfg.lex $(ALLDEP)
50 50
 	$(LEX) $<
51 51
 
52
-cfg.tab.c: cfg.y $(ALLDEP)
52
+cfg.tab.c: cfg.y  $(ALLDEP)
53 53
 	$(YACC) $(YACC_FLAGS) $<
54 54
 
55 55
 .PHONY: all
... ...
@@ -85,27 +86,32 @@ dbg: ser
85 85
 
86 86
 .PHONY: tar
87 87
 tar: mantainer-clean 
88
-	$(TAR) -C .. -zcf ../$(NAME)-$(RELEASE)_src.tar.gz  $(notdir $(CURDIR)) 
88
+	$(TAR) -C .. \
89
+		--exclude=$(notdir $(CURDIR))/test \
90
+		--exclude=$(notdir $(CURDIR))/tmp \
91
+		--exclude=$(notdir $(CURDIR))/debian/ser \
92
+		--exclude=$(notdir $(CURDIR))/debian/ser-mysql-module \
93
+		 -zcf ../$(NAME)-$(RELEASE)_src.tar.gz  $(notdir $(CURDIR)) 
89 94
 
90 95
 # binary dist. tar.gz
91 96
 .PHONY: bin
92 97
 bin:
93 98
 	mkdir -p tmp/ser/usr/local
94
-	$(MAKE) install prefix=tmp/ser/usr/local
99
+	$(MAKE) install basedir=tmp/ser prefix=/usr/local 
95 100
 	$(TAR) -C tmp/ser/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
96 101
 	rm -rf tmp/ser
97 102
 
98 103
 .PHONY: deb
99 104
 deb:
100
-	dpkg-buildpackage -rfakeroot -pgpg -sgpg
105
+	dpkg-buildpackage -rfakeroot -tc
101 106
 
102 107
 .PHONY: sunpkg
103 108
 sunpkg:
104 109
 	mkdir -p tmp/ser
105 110
 	mkdir -p tmp/ser_sun_pkg
106
-	$(MAKE) install prefix=tmp/ser
111
+	$(MAKE) install basedir=tmp/ser prefix=/usr/local
107 112
 	(cd solaris; \
108
-	pkgmk -r ../tmp/ser/ -o -d ../tmp/ser_sun_pkg/ -v "$(RELEASE)" ; \
113
+	pkgmk -r ../tmp/ser/usr/local -o -d ../tmp/ser_sun_pkg/ -v "$(RELEASE)" ;\
109 114
 	cd ..)
110 115
 	cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
111 116
 	pkgtrans -s tmp/ser_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \
... ...
@@ -147,14 +153,22 @@ $(man-prefix)/$(man-dir)/man8:
147 147
 $(man-prefix)/$(man-dir)/man5:
148 148
 		mkdir -p $(man-prefix)/$(man-dir)/man5
149 149
 
150
-install-cfg:
151
-		$(INSTALL-CFG) etc/ser.cfg $(cfg-prefix)/$(cfg-dir)
150
+install-cfg: $(cfg-prefix)/$(cfg-dir)
151
+		sed -e "s#/usr/lib/ser/modules/#$(modules-target)#g" \
152
+			< etc/ser.cfg > $(cfg-prefix)/$(cfg-dir)ser.cfg
153
+		chmod 644 $(cfg-prefix)/$(cfg-dir)ser.cfg
154
+#		$(INSTALL-CFG) etc/ser.cfg $(cfg-prefix)/$(cfg-dir)
152 155
 
153
-install-bin:
156
+install-bin: $(bin-prefix)/$(bin-dir) utils/gen_ha1/gen_ha1
154 157
 		$(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir)
158
+		$(INSTALL-BIN) scripts/sc $(bin-prefix)/$(bin-dir)/serctl
159
+		$(INSTALL-BIN) scripts/ser_mysql.sh  $(bin-prefix)/$(bin-dir)
160
+		$(INSTALL-BIN) utils/gen_ha1/gen_ha1 $(bin-prefix)/$(bin-dir)
155 161
 
162
+utils/gen_ha1/gen_ha1:
163
+		cd utils/gen_ha1; $(MAKE) all
156 164
 
157
-install-modules:
165
+install-modules: modules $(modules-prefix)/$(modules-dir)
158 166
 	-@for r in $(modules_full_path) "" ; do \
159 167
 		if [ -n "$$r" ]; then \
160 168
 			$(INSTALL-MODULES)  $$r  $(modules-prefix)/$(modules-dir) ; \
... ...
@@ -162,10 +176,10 @@ install-modules:
162 162
 	done 
163 163
 
164 164
 
165
-install-doc:
165
+install-doc: $(doc-prefix)/$(doc-dir)
166 166
 	$(INSTALL-DOC) README $(doc-prefix)/$(doc-dir)
167 167
 
168
-install-man:
168
+install-man: $(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5
169 169
 	$(INSTALL-MAN)  ser.8 $(man-prefix)/$(man-dir)/man8
170 170
 	$(INSTALL-MAN)  ser.cfg.5 $(man-prefix)/$(man-dir)/man5
171 171
 
... ...
@@ -8,18 +8,28 @@
8 8
 VERSION = 0
9 9
 PATCHLEVEL = 8
10 10
 SUBLEVEL = 7
11
-EXTRAVERSION = -16
11
+EXTRAVERSION = -99
12 12
 
13 13
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
14 14
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
15 15
 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
16 16
 
17
-prefix = /usr/local
18
-cfg-prefix = $(prefix)
19
-bin-prefix = $(prefix)
20
-modules-prefix= $(prefix)
21
-doc-prefix = $(prefix)
22
-man-prefix = $(prefix)
17
+ # install location
18
+PREFIX = /usr/local
19
+prefix = $(PREFIX)
20
+# install path is $(basedir) $(prefix) 
21
+# example:
22
+#  creating a bin. archive in /tmp, which unpacks in /usr/local
23
+#  basedir=/tmp
24
+#  prefix=/usr/local
25
+basedir = 
26
+# install prefixes for various stuff
27
+cfg-prefix = $(basedir)$(prefix)
28
+bin-prefix = $(basedir)$(prefix)
29
+modules-prefix = $(basedir)$(prefix)
30
+doc-prefix = $(basedir)$(prefix)
31
+man-prefix = $(basedir)$(prefix)
32
+ut-prefix = $(basedir)$(prefix)
23 33
 
24 34
 # dirs
25 35
 cfg-dir = etc/ser/
... ...
@@ -27,6 +37,10 @@ bin-dir = sbin/
27 27
 modules-dir = lib/ser/modules/
28 28
 doc-dir = share/doc/ser/
29 29
 man-dir = share/man/
30
+ut-prefix = bin/
31
+# target dirs for various stuff
32
+cfg-target = $(prefix)/$(cfg-dir)
33
+modules-target = $(prefix)/$(modules-dir)
30 34
 
31 35
 
32 36
 ifeq ($(OS), solaris)
... ...
@@ -37,12 +51,20 @@ else
37 37
 INSTALL = install 
38 38
 TAR= tar
39 39
 endif
40
-INSTALL-CFG = $(INSTALL) -m 644
40
+
41
+# INSTALL-CFG = $(INSTALL) -m 644
41 42
 INSTALL-BIN = $(INSTALL) -m 755
42 43
 INSTALL-MODULES = $(INSTALL) -m 755
43 44
 INSTALL-DOC = $(INSTALL) -m 644
44 45
 INSTALL-MAN = $(INSTALL) -m 644
45 46
 
47
+#set some vars from the environment (and not make builtins)
48
+CC   := $(shell echo "$${CC}")
49
+LEX  := $(shell echo "$${LEX}")
50
+YACC := $(shell echo "$${YACC}")
51
+
52
+
53
+
46 54
 
47 55
 # compile-time options
48 56
 #
... ...
@@ -103,16 +125,15 @@ INSTALL-MAN = $(INSTALL) -m 644
103 103
 #  		if enabled, allows forking of the snmp agent just before child
104 104
 #  		forking (done at the top of main_loop). Needed if you want
105 105
 #  		to use the snmp module.
106
-
107
-DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
108
-	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
106
+DEFS= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
107
+	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' \
108
+	 -DCFG_DIR='"$(cfg-target)"'\
109 109
 	 -DPKG_MALLOC \
110 110
 	 -DSHM_MEM  -DSHM_MMAP \
111 111
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
112 112
 	 -DDNS_IP_HACK \
113 113
 	 -DUSE_IPV6 \
114 114
 	 -DF_MALLOC \
115
-	 -DEXTRA_DEBUG \
116 115
 	 #-DDBG_QM_MALLOC \
117 116
 	 #-DVQ_MALLOC  
118 117
 	 #-DCONTACT_BUG
... ...
@@ -127,13 +148,17 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
127 127
 
128 128
 #PROFILE=  -pg #set this if you want profiling
129 129
 #mode = debug
130
-mode = release
130
+ifeq ($(mode),)
131
+	mode = release
132
+endif
131 133
 
132 134
 # platform dependent settings
133 135
 
134 136
 
135 137
 #common
136
-CC=gcc
138
+ifeq ($(CC),)
139
+	CC=gcc
140
+endif
137 141
 LD= $(CC)
138 142
 CC_LONGVER=$(shell if  $(CC) -v 2>/dev/null; then \
139 143
 						$(CC) -v 2>&1 ;\
... ...
@@ -228,8 +253,7 @@ ifeq ($(ARCH), armv4l)
228 228
 	DEFS+= -DFAST_LOCK
229 229
 endif
230 230
 
231
-
232
-
231
+CFLAGS=
233 232
 # setting CFLAGS
234 233
 ifeq ($(mode), release)
235 234
 	#if i386
... ...
@@ -354,7 +378,7 @@ endif	#ARCH, i386
354 354
 
355 355
 	
356 356
 
357
-
357
+LDFLAGS=
358 358
 # setting LDFLAGS
359 359
 ifeq	($(CC_NAME), gcc)
360 360
 ifeq		($(ARCH), sparc64)
... ...
@@ -426,8 +450,12 @@ ifeq	($(CC_NAME), suncc)
426 426
 MOD_CFLAGS=-Kpic  $(CFLAGS)
427 427
 endif
428 428
 
429
-LEX=flex
430
-YACC=bison
429
+ifeq ($(LEX),)
430
+	LEX=flex
431
+endif
432
+ifeq ($(YACC),)
433
+	YACC=bison
434
+endif
431 435
 YACC_FLAGS=-d -b cfg
432 436
 # on linux and freebsd keep it empty (e.g. LIBS= )
433 437
 # on solaris add -lxnet (e.g. LIBS= -lxnet)
... ...
@@ -452,9 +480,9 @@ ifeq  ($(OS), solaris)
452 452
 	YACC=yacc
453 453
 
454 454
 ifeq ($(CC_NAME), suncc)
455
-	LIBS=-lfast -lresolv
455
+	LIBS+= -lfast 
456 456
 endif
457
-	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt -lnsl
457
+	LIBS+= -L/usr/local/lib -L/usr/lib/mysql -lxnet -lrt -lnsl
458 458
 	# -lrt needed for sched_yield
459 459
 endif
460 460
 
... ...
@@ -38,7 +38,7 @@ dep: $(depends)
38 38
 static: $(objs)
39 39
 
40 40
 .PHONY: clean
41
-clean:
41
+clean: 
42 42
 	-@rm -f $(objs) $(NAME) $(objs:.o=.il) 2>/dev/null
43 43
 	-@for r in $(modules) $(static_modules_path) "" ; do \
44 44
 		if [ -n "$$r" ]; then \
... ...
@@ -46,6 +46,7 @@ clean:
46 46
 			$(MAKE) -C $$r clean ; \
47 47
 		fi ; \
48 48
 	done
49
+	@if [ -n "$(modules)" ]; then cd utils/gen_ha1; $(MAKE) clean; fi
49 50
 
50 51
 .PHONY: proper
51 52
 .PHONY: distclean
... ...
@@ -11,7 +11,9 @@
11 11
 # defines: sources, objs, depends
12 12
 #
13 13
 
14
-sources=$(filter-out $(auto_gen), $(wildcard *.c) $(wildcard mem/*.c) $(wildcard parser/*.c) $(wildcard parser/digest/*.c) $(wildcard parser/contact/*.c) $(wildcard db/*.c) ) $(auto_gen)
14
+sources=$(filter-out $(auto_gen), $(wildcard *.c) $(wildcard mem/*.c) \
15
+		$(wildcard parser/*.c) $(wildcard parser/digest/*.c) \
16
+		$(wildcard parser/contact/*.c) $(wildcard db/*.c) ) $(auto_gen)
15 17
 objs=$(sources:.c=.o)
16 18
 extra_objs=
17 19
 depends=$(sources:.c=.d)
... ...
@@ -106,6 +106,8 @@ FIFO fifo
106 106
 FIFO_MODE fifo_mode
107 107
 SERVER_SIGNATURE server_signature
108 108
 REPLY_TO_VIA reply_to_via
109
+USER		"user"|"uid"
110
+GROUP		"group"|"gid"
109 111
 
110 112
 LOADMODULE	loadmodule
111 113
 MODPARAM        modparam
... ...
@@ -200,6 +202,8 @@ EAT_ABLE	[\ \t\b\r]
200 200
 <INITIAL>{SYN_BRANCH}	{ count(); yylval.strval=yytext; return SYN_BRANCH; }
201 201
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
202 202
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
203
+<INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
204
+<INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }
203 205
 <INITIAL>{FIFO}	{ count(); yylval.strval=yytext; return FIFO; }
204 206
 <INITIAL>{FIFO_MODE}	{ count(); yylval.strval=yytext; return FIFO_MODE; }
205 207
 <INITIAL>{SERVER_SIGNATURE}	{ count(); yylval.strval=yytext; return SERVER_SIGNATURE; }
... ...
@@ -114,6 +114,8 @@ struct id_list* lst_tmp;
114 114
 %token LOADMODULE
115 115
 %token MODPARAM
116 116
 %token MAXBUFFER
117
+%token USER
118
+%token GROUP
117 119
 
118 120
 
119 121
 
... ...
@@ -273,7 +275,13 @@ assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
273 273
 		| FIFO EQUAL STRING { fifo=$3; }
274 274
 		| FIFO EQUAL error { yyerror("string value expected"); }
275 275
 		| FIFO_MODE EQUAL NUMBER { fifo_mode=$3; }
276
-		| FIFO_MODE EQUAL NUMBER { yyerror("int value expected"); }
276
+		| FIFO_MODE EQUAL error { yyerror("int value expected"); }
277
+		| USER EQUAL STRING     { user=$3; }
278
+		| USER EQUAL ID         { user=$3; }
279
+		| USER EQUAL error      { yyerror("string value expected"); }
280
+		| GROUP EQUAL STRING     { group=$3; }
281
+		| GROUP EQUAL ID         { group=$3; }
282
+		| GROUP EQUAL error      { yyerror("string value expected"); }
277 283
 		| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
278 284
 		| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
279 285
 		| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
... ...
@@ -36,7 +36,7 @@
36 36
 /* default sip port if none specified */
37 37
 #define SIP_PORT 5060
38 38
 
39
-#define CFG_FILE "/etc/ser/ser.cfg"
39
+#define CFG_FILE CFG_DIR "ser.cfg"
40 40
 
41 41
 
42 42
 /* maximum number of addresses on which we will listen */
... ...
@@ -3,6 +3,11 @@ ser (0.8.7.16) unstable; urgency=low
3 3
   * First Public Release.
4 4
 
5 5
  -- Andrei Pelinescu-Onciul <pelinescu-onciul@fokus.gmd.de>  Tue, 24 Sep 2002 21:33:39 +0200
6
+ser (0.8.7.16) unstable; urgency=low
7
+
8
+  * First Public Release.
9
+
10
+ -- Andrei Pelinescu-Onciul <pelinescu-onciul@fokus.gmd.de>  Tue, 24 Sep 2002 21:33:39 +0200
6 11
 
7 12
 ser (0.8.7.6-1) unstable; urgency=low
8 13
 
... ...
@@ -1 +1,2 @@
1 1
 /etc/ser/ser.cfg
2
+/etc/init.d/ser
... ...
@@ -2,7 +2,7 @@ Source: ser
2 2
 Section: net
3 3
 Priority: optional
4 4
 Maintainer: Andrei Pelinescu-Onciul <pelinescu-onciul@fokus.gmd.de>
5
-Build-Depends: debhelper (>> 3.0.0), libmysqlclient-dev
5
+Build-Depends: debhelper (>> 3.0.0), libmysqlclient-dev, fakeroot
6 6
 Standards-Version: 3.5.2
7 7
 
8 8
 Package: ser
9 9
similarity index 78%
10 10
rename from debian/init.d.ex
11 11
rename to debian/init.d
... ...
@@ -9,12 +9,16 @@
9 9
 #
10 10
 # Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
11 11
 #
12
-# This file was automatically customized by dh-make on Tue, 16 Jul 2002 15:41:31 +0200
12
+#  adapted for ser by Andrei Pelinescu-Onciul <pelinescu-onciul@fokus.gmd.de>
13
+# $Id$
14
+
13 15
 
14 16
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 17
 DAEMON=/usr/sbin/ser
16 18
 NAME=ser
17 19
 DESC=ser
20
+PIDFILE=/var/run/$NAME/$NAME.pid
21
+PARAMS="-P $PIDFILE -u ser -g ser"
18 22
 
19 23
 test -f $DAEMON || exit 0
20 24
 
... ...
@@ -23,13 +27,13 @@ set -e
23 23
 case "$1" in
24 24
   start)
25 25
 	echo -n "Starting $DESC: $NAME"
26
-	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
27
-		--exec $DAEMON
26
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
27
+		--exec $DAEMON -- $PARAMS
28 28
 	echo "."
29 29
 	;;
30 30
   stop)
31 31
 	echo -n "Stopping $DESC: $NAME"
32
-	start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
32
+	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
33 33
 		--exec $DAEMON
34 34
 	echo "."
35 35
 	;;
... ...
@@ -43,7 +47,7 @@ case "$1" in
43 43
 	#
44 44
 	# echo "Reloading $DESC configuration files."
45 45
 	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
46
-	#	/var/run/$NAME.pid --exec $DAEMON
46
+	#	$PIDFILE --exec $DAEMON
47 47
   #;;
48 48
   restart|force-reload)
49 49
 	#
... ...
@@ -53,10 +57,10 @@ case "$1" in
53 53
 	#
54 54
 	echo -n "Restarting $DESC: $NAME"
55 55
 	start-stop-daemon --stop --quiet --pidfile \
56
-		/var/run/$NAME.pid --exec $DAEMON
56
+		$PIDFILE --exec $DAEMON
57 57
 	sleep 1
58 58
 	start-stop-daemon --start --quiet --pidfile \
59
-		/var/run/$NAME.pid --exec $DAEMON
59
+		$PIDFILE --exec $DAEMON  -- $PARAMS
60 60
 	echo "."
61 61
 	;;
62 62
   *)
63 63
similarity index 95%
64 64
rename from debian/postinst.ex
65 65
rename to debian/postinst
... ...
@@ -1,4 +1,5 @@
1 1
 #! /bin/sh
2
+# $Id$
2 3
 # postinst script for ser-0.8.7
3 4
 #
4 5
 # see: dh_installdeb(1)
... ...
@@ -25,6 +26,7 @@ set -e
25 25
 
26 26
 case "$1" in
27 27
     configure)
28
+        adduser --system --group --home /var/run/ser ser
28 29
 
29 30
     ;;
30 31
 
31 32
similarity index 99%
32 33
rename from debian/postrm.ex
33 34
rename to debian/postrm
... ...
@@ -1,4 +1,5 @@
1 1
 #! /bin/sh
2
+# $Id$
2 3
 # postrm script for ser-0.8.7
3 4
 #
4 5
 # see: dh_installdeb(1)
... ...
@@ -20,8 +21,6 @@ set -e
20 20
 
21 21
 case "$1" in
22 22
        purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
23
-
24
-
25 23
         ;;
26 24
 
27 25
     *)
... ...
@@ -34,8 +34,8 @@ build-stamp: configure-stamp
34 34
 	dh_testdir
35 35
 
36 36
 	# Add here commands to compile the package.
37
-	$(MAKE) all 
38
-	$(MAKE) modules modules=modules/mysql
37
+	$(MAKE) all  exclude_modules=mysql cfg-target=/etc/ser/
38
+	$(MAKE) modules modules=modules/mysql cfg-target=/etc/ser/
39 39
 	#/usr/bin/docbook-to-man debian/ser.sgml > ser.1
40 40
 
41 41
 	touch build-stamp
... ...
@@ -57,14 +57,17 @@ install: build
57 57
 	dh_installdirs
58 58
 
59 59
 	# Add here commands to install the package into debian/ser
60
-	$(MAKE) install  \
61
-		prefix=$(CURDIR)/debian/ser/usr \
62
-		cfg-prefix=$(CURDIR)/debian/ser 
63
-	
60
+	$(MAKE) install  exclude_modules=mysql \
61
+		basedir=$(CURDIR)/debian/ser \
62
+		prefix=/usr \
63
+		cfg-prefix=$(CURDIR)/debian/ser \
64
+		cfg-target=/etc/ser/
64 65
 	# install only the mysql module
65 66
 	$(MAKE) install-modules modules=modules/mysql  \
66
-		prefix=$(CURDIR)/debian/ser-mysql-module/usr \
67
-		cfg-prefix=$(CURDIR)/debian/ser-mysql-module 
67
+		basedir=$(CURDIR)/debian/ser-mysql-module \
68
+		prefix=/usr \
69
+		cfg-prefix=$(CURDIR)/debian/ser-mysql-module \
70
+		cfg-target=/etc/ser/
68 71
 	#dh_movefiles
69 72
 
70 73
 
... ...
@@ -84,7 +87,7 @@ binary-common:
84 84
 #	dh_installemacsen
85 85
 #	dh_installpam
86 86
 #	dh_installmime
87
-#	dh_installinit
87
+	dh_installinit
88 88
 	dh_installcron
89 89
 	dh_installman
90 90
 	dh_installinfo
... ...
@@ -74,6 +74,8 @@ extern int syn_branch;
74 74
 /* extern int process_no; */
75 75
 extern int sip_warning;
76 76
 extern int server_signature;
77
+extern char* user;
78
+extern char* group;
77 79
 /*
78 80
  * debug & log_stderr moved to dprint.h*/
79 81
 
... ...
@@ -418,7 +418,7 @@ static inline struct hostent* ip_addr2he(char* name, int len,
418 418
 	p_aliases[0]=0; /* no aliases*/
419 419
 	p_addr[1]=0; /* only one address*/
420 420
 	p_addr[0]=address;
421
-	strncpy(hostname, name, (len<256)?len:256);
421
+	strncpy(hostname, name, (len<256)?len+1:256);
422 422
 	if (ip->len>16) return 0;
423 423
 	memcpy(address, ip->u.addr, ip->len);
424 424
 	
... ...
@@ -42,6 +42,8 @@
42 42
 #include <sys/fcntl.h>
43 43
 #include <sys/time.h>
44 44
 #include <sys/wait.h>
45
+#include <pwd.h>
46
+#include <grp.h>
45 47
 #include <signal.h>
46 48
 
47 49
 #include <sys/ioctl.h>
... ...
@@ -247,6 +249,8 @@ int server_signature=1;
247 247
 int received_dns = 0;      
248 248
 char* working_dir = 0;
249 249
 char* chroot_dir = 0;
250
+char* user=0;
251
+char* group=0;
250 252
 int uid = 0;
251 253
 int gid = 0;
252 254
 /* a hint to reply modules whether they should send reply
... ...
@@ -869,6 +873,8 @@ int main(int argc, char** argv)
869 869
 	char port_no_str[MAX_PORT_LEN];
870 870
 	int port_no_str_len;
871 871
 	int ret;
872
+	struct passwd *pw_entry;
873
+	struct group  *gr_entry;
872 874
 
873 875
 	/*init*/
874 876
 	port_no_str_len=0;
... ...
@@ -1027,19 +1033,10 @@ int main(int argc, char** argv)
1027 1027
 					chroot_dir=optarg;
1028 1028
 					break;
1029 1029
 			case 'u':
1030
-					uid=strtol(optarg, &tmp, 10);
1031
-					if ((tmp==0) ||(*tmp)){
1032
-						fprintf(stderr, "bad uid number: -u %s\n", optarg);
1033
-						goto error;
1034
-					}
1035
-					/* test if string?*/
1030
+					user=optarg;
1036 1031
 					break;
1037 1032
 			case 'g':
1038
-					gid=strtol(optarg, &tmp, 10);
1039
-					if ((tmp==0) ||(*tmp)){
1040
-						fprintf(stderr, "bad gid number: -g %s\n", optarg);
1041
-						goto error;
1042
-					}
1033
+					group=optarg;
1043 1034
 					break;
1044 1035
 			case 'P':
1045 1036
 					pid_file=optarg;
... ...
@@ -1130,6 +1127,33 @@ int main(int argc, char** argv)
1130 1130
 #endif
1131 1131
 	
1132 1132
 	if (working_dir==0) working_dir="/";
1133
+	
1134
+	/* get uid/gid */
1135
+	if (user){
1136
+		uid=strtol(user, &tmp, 10);
1137
+		if ((tmp==0) ||(*tmp)){
1138
+			/* maybe it's a string */
1139
+			pw_entry=getpwnam(user);
1140
+			if (pw_entry==0){
1141
+				fprintf(stderr, "bad user name/uid number: -u %s\n", user);
1142
+				goto error;
1143
+			}
1144
+			uid=pw_entry->pw_uid;
1145
+			gid=pw_entry->pw_gid;
1146
+		}
1147
+	}
1148
+	if (group){
1149
+		gid=strtol(user, &tmp, 10);
1150
+		if ((tmp==0) ||(*tmp)){
1151
+			/* maybe it's a string */
1152
+			gr_entry=getgrnam(group);
1153
+			if (gr_entry==0){
1154
+				fprintf(stderr, "bad group name/gid number: -u %s\n", group);
1155
+				goto error;
1156
+			}
1157
+			gid=gr_entry->gr_gid;
1158
+		}
1159
+	}
1133 1160
 
1134 1161
 	if (sock_no==0) {
1135 1162
 		/* try to get all listening ipv4 interfaces */
... ...
@@ -1196,7 +1220,6 @@ int main(int argc, char** argv)
1196 1196
 			if (add_alias(*h, strlen(*h))<0){
1197 1197
 				LOG(L_ERR, "ERROR: main: add_alias failed\n");
1198 1198
 			}
1199
-		
1200 1199
 		hostent2ip_addr(&sock_info[r].address, he, 0); /*convert to ip_addr 
1201 1200
 														 format*/
1202 1201
 		if ((tmp=ip_addr2a(&sock_info[r].address))==0) goto error;
... ...
@@ -1235,7 +1258,8 @@ int main(int argc, char** argv)
1235 1235
 		sock_info[r].port_no_str.len=strlen(port_no_str);
1236 1236
 		
1237 1237
 #ifdef EXTRA_DEBUG
1238
-		printf("              %s [%s]:%s\n",sock_info[r].name.s,
1238
+		printf("              %.*s [%s]:%s\n", sock_info[r].name.len, 
1239
+				sock_info[r].name.s,
1239 1240
 				sock_info[r].address_str.s, sock_info[r].port_no_str.s);
1240 1241
 #endif
1241 1242
 	}
... ...
@@ -10,7 +10,7 @@ Release:      %rel
10 10
 Packager:     Jan Janak <J.Janak@sh.cvut.cz>
11 11
 Copyright:    GPL
12 12
 Group:        System Environment/Daemons
13
-Source:       http://iptel.org/ser/stable/%{name}-%{ver}.tar.gz
13
+Source:       http://iptel.org/ser/stable/%{name}-%{ver}_src.tar.gz
14 14
 Source2:      ser.init
15 15
 URL:          http://iptel.org/ser
16 16
 Vendor:       FhG Fokus
... ...
@@ -43,7 +43,7 @@ entries.
43 43
 %setup
44 44
 
45 45
 %build
46
-make all exclude_modules="%exclude"
46
+make all exclude_modules="%exclude" cfg-target=/%{_sysconfdir}/ser/
47 47
 cd utils/gen_ha1
48 48
 make
49 49
 
... ...
@@ -61,6 +61,8 @@ make install cfg-prefix=$RPM_BUILD_ROOT/%{_sysconfdir} \
61 61
 	     doc-dir=ser/ \
62 62
 	     man-prefix=$RPM_BUILD_ROOT/%{_mandir} \
63 63
 	     man-dir="" \
64
+		 cfg-target=/%{_sysconfdir}/ser/ \
65
+		 modules-target=/%{_libdir}/ser/modules/ \
64 66
 	     exclude_modules="%exclude"
65 67
 
66 68
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d
... ...
@@ -138,6 +140,9 @@ fi
138 138
 
139 139
 
140 140
 %changelog
141
+* Wed Sep 25 2002 Andrei Pelinescu - Onciul  <pelinescu-onciul@fokus.gmd.de>
142
+- modified make install & make: added cfg-target & modules-target
143
+
141 144
 * Sun Sep 08 2002 Jan Janak <J.Janak@sh.cvut.cz>
142 145
 - Created subpackage containing mysql connectivity support.
143 146
 
... ...
@@ -10,7 +10,7 @@ Release:      %rel
10 10
 Packager:     Nils Ohlmeier <ohlmeier@fokus.fhg.de>
11 11
 Copyright:    GPL
12 12
 Group:        System Environment/Daemons
13
-Source:       http://iptel.org/ser/stable/%{name}-%{ver}.tar.gz
13
+Source:       http://iptel.org/ser/stable/%{name}-%{ver}_src.tar.gz
14 14
 Source2:      ser.init.SuSE
15 15
 URL:          http://iptel.org/ser
16 16
 Vendor:       FhG Fokus
... ...
@@ -43,7 +43,7 @@ entries.
43 43
 %setup
44 44
 
45 45
 %build
46
-make all exclude_modules="%exclude"
46
+make all cfg-target=/%{_sysconfdir}/ser/ exclude_modules="%exclude"
47 47
 cd utils/gen_ha1
48 48
 make
49 49
 
... ...
@@ -61,6 +61,8 @@ make install cfg-prefix=$RPM_BUILD_ROOT/%{_sysconfdir} \
61 61
 	     doc-dir=ser/ \
62 62
 	     man-prefix=$RPM_BUILD_ROOT/%{_mandir} \
63 63
 	     man-dir="" \
64
+		 cfg-target=/%{_sysconfdir}/ser/ \
65
+		 modules-target=/%{_libdir}/ser/modules/ \
64 66
 	     exclude_modules="%exclude"
65 67
 
66 68
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/init.d
... ...
@@ -139,6 +141,9 @@ sbin/insserv etc/init.d/
139 139
 
140 140
 
141 141
 %changelog
142
+* Wed Sep 25 2002 Andrei Pelinescu - Onciul  <pelinescu-onciul@fokus.gmd.de>
143
+- modified make install & make: added cfg-target & modules-target
144
+
142 145
 * Wen Sep 25 2002 Nils Ohlmeier <ohlmeier@fokus.fhg.de>
143 146
 - Copyed mysql connectivity subpackage from orig rpm.spec.
144 147