Merge lp://staging/~jeff-apple/openvista-gtm-integration/bug368789 into lp://staging/openvista-gtm-integration

Proposed by jeff.apple
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~jeff-apple/openvista-gtm-integration/bug368789
Merge into: lp://staging/openvista-gtm-integration
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~jeff-apple/openvista-gtm-integration/bug368789
Reviewer Review Type Date Requested Status
Jon Tai Approve
Review via email: mp+6101@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jon Tai (jontai) wrote :

Looks good, please commit.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mumps/MSCZJOBU.m'
2--- mumps/MSCZJOBU.m 2009-04-28 18:34:54 +0000
3+++ mumps/MSCZJOBU.m 2009-05-01 17:47:24 +0000
4@@ -31,25 +31,19 @@
5 ; PID CAN BE A SINGLE PID, I.E. $J
6 ; PID CAN BE A "*" WHICH SENDS AN INTERRUPT TO ALL MUMPS PROCESSES
7 ;
8- Q:$G(PID)=""
9- ;
10- I PID="*" D Q ; ALL PIDS
11- . N ARRAY
12- . D PIDS(.ARRAY)
13- . N %J S %J=""
14- . F S %J=$O(ARRAY(%J)) Q:%J="" D
15- . . S A="test1",c="mupip intrpt "_%J_" > /dev/null"
16- . . OPEN A:(COMM="mupip intrpt "_%J)::"PIPE" U A C A
17- ;
18- ; JUST 1 PID
19- Q:PID'?1N.N
20- S A="test1"
21- OPEN A:(COMM="mupip intrpt "_PID)::"PIPE" U A C A
22+ N CMD
23+ S PID=$G(PID)
24+ Q:(PID="")!'((PID="*")!(PID=+PID))
25+ ;
26+ S DEV="gtmsignaldev"
27+ S CMD="gtmsignal -q "_$S(PID="*":"-a",1:PID)
28+ OPEN DEV:(COMM=CMD)::"PIPE" U DEV C DEV
29 Q
30 ;
31 KILL(PID) ; Send PID to mupip to kill process
32 Q:PID'?1N.N
33- ZSYSTEM "mupip stop "_PID_" > /dev/null"
34+ S DEV="gtmsignaldev"
35+ OPEN DEV:(COMM="gtmsignal -q -s "_PID)::"PIPE" U DEV C DEV
36 Q
37 ;
38 UNLOCK(NODE,PROC) ; Use lke to remove lock on NODE.
39
40=== added file 'packages/rpm/openvista'
41--- packages/rpm/openvista 1970-01-01 00:00:00 +0000
42+++ packages/rpm/openvista 2009-04-30 06:48:24 +0000
43@@ -0,0 +1,5 @@
44+#%PAM-1.0
45+auth include system-auth
46+account include system-auth
47+password include system-auth
48+session include system-auth
49
50=== renamed file 'packages/rpm/openvista-libs.spec' => 'packages/rpm/openvista-libs-5.3003.spec'
51--- packages/rpm/openvista-libs.spec 2009-04-23 05:35:22 +0000
52+++ packages/rpm/openvista-libs-5.3003.spec 2009-04-30 07:03:03 +0000
53@@ -1,6 +1,12 @@
54-Name: openvista-libs
55+%ifarch x86_64
56+%define gtm_dist /opt/lsb-gtm/V5.3-003_x86_64
57+%else
58+%define gtm_dist /opt/lsb-gtm/V5.3-003_i686
59+%endif
60+
61+Name: openvista-libs-5.3003
62 Version: 0.8
63-Release: 1
64+Release: 2
65 Summary: GT.M External Calls for OpenVista
66 License: AGPL
67 Vendor: Medsphere Systems Corporation
68@@ -8,10 +14,17 @@
69 Group: Applications/System
70 Packager: Jonathan Tai <jon.tai@medsphere.com>
71
72-Requires: pam fis-gtm-5.3003
73-BuildRequires: pam-devel fis-gtm-5.3003
74-
75-Source: openvista-libs-%{version}.tar.bz2
76+Provides: openvista-libs
77+
78+Requires(post): /usr/sbin/semanage, /sbin/restorecon
79+Requires(postun): /usr/sbin/semanage
80+
81+Requires: pam, fis-gtm-5.3003
82+BuildRequires: pam-devel, fis-gtm-5.3003
83+
84+Obsoletes: openvista-libs
85+
86+Source: openvista-libs-5.3003-%{version}.tar.bz2
87 BuildRoot: %{_tmppath}/%{name}-root
88
89 %description
90@@ -21,7 +34,8 @@
91
92 This package provides a shared library that OpenVista code running in GT.M
93 calls out to for PAM authentication and duplicating a device onto a spawned
94-child's stdin/stdout.
95+child's stdin/stdout. This package also provides an suid wrapper around GT.M
96+utilities used to send signals to other GT.M processes.
97
98 %prep
99 %setup
100@@ -30,24 +44,18 @@
101 cd src/libopenvista
102 ./compile.sh
103
104+cd ../../
105+
106+cd src/suidwrapper
107+./compile.sh
108+
109 %install
110 rm -rf %{buildroot}
111
112-install -d %{buildroot}%{_libdir}/openvista
113-install -m 755 src/libopenvista/libopenvista.so %{buildroot}%{_libdir}/openvista
114-
115-install -d %{buildroot}%{_datadir}/openvista
116-install -m 644 src/libopenvista/openvista.xc %{buildroot}%{_datadir}/openvista
117-
118-install -d %{buildroot}%{_sysconfdir}/pam.d
119-cat > %{buildroot}%{_sysconfdir}/pam.d/openvista <<EOF
120-#%PAM-1.0
121-auth include system-auth
122-account include system-auth
123-password include system-auth
124-session include system-auth
125-EOF
126-chmod 644 %{buildroot}%{_sysconfdir}/pam.d/openvista
127+install -d %{buildroot}%{gtm_dist}
128+install -m 550 src/libopenvista/libopenvista.so %{buildroot}%{gtm_dist}
129+install -m 440 src/libopenvista/openvista.xc %{buildroot}%{gtm_dist}
130+install -m 4550 src/suidwrapper/gtmsignal %{buildroot}%{gtm_dist}
131
132 %clean
133 rm -rf %{buildroot}
134@@ -58,17 +66,18 @@
135 %doc COPYING
136 %doc COPYING.AGPL
137 %doc NEWS
138-%{_libdir}/openvista/libopenvista.so
139-%{_datadir}/openvista/openvista.xc
140-%{_sysconfdir}/pam.d/openvista
141+%defattr(-,bin,gtm)
142+%{gtm_dist}/libopenvista.so
143+%{gtm_dist}/openvista.xc
144+%{gtm_dist}/gtmsignal
145
146 %post
147 # See http://fedoraproject.org/wiki/PackagingDrafts/SELinux
148-/usr/sbin/semanage fcontext -a -t textrel_shlib_t %{_libdir}/openvista/libopenvista.so 2>/dev/null || :
149-/sbin/restorecon %{_libdir}/openvista/libopenvista.so || :
150+/usr/sbin/semanage fcontext -a -t textrel_shlib_t %{gtm_dist}/libopenvista.so 2>/dev/null || :
151+/sbin/restorecon %{gtm_dist}/libopenvista.so || :
152
153 %postun
154 # See http://fedoraproject.org/wiki/PackagingDrafts/SELinux
155 if [ $1 -eq 0 ]; then
156- /usr/sbin/semanage fcontext -d -t textrel_shlib_t %{_libdir}/openvista/libopenvista.so 2>/dev/null || :
157+ /usr/sbin/semanage fcontext -d -t textrel_shlib_t %{gtm_dist}/libopenvista.so 2>/dev/null || :
158 fi
159
160=== modified file 'packages/rpm/openvista-utils.spec'
161--- packages/rpm/openvista-utils.spec 2009-04-23 23:17:19 +0000
162+++ packages/rpm/openvista-utils.spec 2009-04-30 06:48:24 +0000
163@@ -1,6 +1,6 @@
164 Name: openvista-utils
165 Version: 0.8
166-Release: 1
167+Release: 2
168 Summary: Utilities for configuring and managing OpenVista
169 License: AGPL
170 Vendor: Medsphere Systems Corporation
171@@ -9,16 +9,22 @@
172 Packager: Jonathan Tai <jon.tai@medsphere.com>
173
174 Requires(pre): /usr/sbin/useradd
175-Requires(post): /sbin/chkconfig
176+Requires(post): /sbin/chkconfig, /sbin/service
177 Requires(preun): /sbin/chkconfig
178-Requires(postun): /usr/sbin/userdel
179+Requires(postun): /usr/sbin/userdel, /sbin/service
180
181-Requires: /bin/bash, coreutils, openssh, /usr/bin/logger, /usr/bin/rsync, /bin/tar, /usr/bin/bzip2, /usr/bin/find, vixie-cron, fis-gtm, openvista-libs
182+Requires: /bin/bash, coreutils, openssh, /usr/bin/logger, /usr/bin/rsync, /bin/tar, /usr/bin/bzip2, /usr/bin/find, vixie-cron
183+Requires: fis-gtm, openvista-libs
184+Requires: httpd, mod_ssl, pam
185
186 # RPM should have a suggests tag...
187-# Suggests: putty-tools, openvista-webdav-config, bash-completion, /usr/bin/pbzip2
188-
189-Source: openvista-utils-%{version}.tar.bz2
190+# Suggests: /usr/bin/puttygen, bash-completion, /usr/bin/pbzip2
191+
192+Obsoletes: openvista-webdav-config
193+
194+Source0: openvista-utils-%{version}.tar.bz2
195+Source1: webdav.conf
196+Source2: openvista
197 BuildArch: noarch
198 BuildRoot: %{_tmppath}/%{name}-root
199
200@@ -56,16 +62,16 @@
201 install scripts/usr/bin/ovimport %{buildroot}%{_bindir}/
202
203 install -d %{buildroot}%{_mandir}/man1/
204-install docs/man1/ovinstanceadd.1 %{buildroot}%{_mandir}/man1/
205-install docs/man1/ovinstancedel.1 %{buildroot}%{_mandir}/man1/
206-install docs/man1/ovrestore.1 %{buildroot}%{_mandir}/man1/
207-install docs/man1/openvista.1 %{buildroot}%{_mandir}/man1/
208-install docs/man1/ovtied.1 %{buildroot}%{_mandir}/man1/
209-install docs/man1/ovcc.1 %{buildroot}%{_mandir}/man1/
210-install docs/man1/ovbackup.1 %{buildroot}%{_mandir}/man1/
211-install docs/man1/ovpurgejournals.1 %{buildroot}%{_mandir}/man1/
212-install docs/man1/ovswitchjournals.1 %{buildroot}%{_mandir}/man1/
213-install docs/man1/ovimport.1 %{buildroot}%{_mandir}/man1/
214+install -m 644 docs/man1/ovinstanceadd.1 %{buildroot}%{_mandir}/man1/
215+install -m 644 docs/man1/ovinstancedel.1 %{buildroot}%{_mandir}/man1/
216+install -m 644 docs/man1/ovrestore.1 %{buildroot}%{_mandir}/man1/
217+install -m 644 docs/man1/openvista.1 %{buildroot}%{_mandir}/man1/
218+install -m 644 docs/man1/ovtied.1 %{buildroot}%{_mandir}/man1/
219+install -m 644 docs/man1/ovcc.1 %{buildroot}%{_mandir}/man1/
220+install -m 644 docs/man1/ovbackup.1 %{buildroot}%{_mandir}/man1/
221+install -m 644 docs/man1/ovpurgejournals.1 %{buildroot}%{_mandir}/man1/
222+install -m 644 docs/man1/ovswitchjournals.1 %{buildroot}%{_mandir}/man1/
223+install -m 644 docs/man1/ovimport.1 %{buildroot}%{_mandir}/man1/
224 gzip %{buildroot}%{_mandir}/man1/ovinstanceadd.1
225 gzip %{buildroot}%{_mandir}/man1/ovinstancedel.1
226 gzip %{buildroot}%{_mandir}/man1/ovrestore.1
227@@ -92,6 +98,18 @@
228
229 install -d %{buildroot}/opt/openvista
230
231+install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
232+install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/
233+
234+install -d %{buildroot}%{_sysconfdir}/httpd/conf
235+touch %{buildroot}%{_sysconfdir}/httpd/conf/webdav.htpasswd
236+
237+install -d %{buildroot}/var/www/html/webdav
238+
239+install -d %{buildroot}%{_sysconfdir}/pam.d
240+
241+install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/
242+
243 %clean
244 rm -rf %{buildroot}
245
246@@ -128,6 +146,10 @@
247 %config %{_sysconfdir}/cron.d/openvista
248 %{_sysconfdir}/cron.daily/openvista
249 %attr(2750,root,openvista) %dir /opt/openvista
250+%{_sysconfdir}/httpd/conf.d/webdav.conf
251+%config %{_sysconfdir}/httpd/conf/webdav.htpasswd
252+%dir /var/www/html/webdav
253+%{_sysconfdir}/pam.d/openvista
254
255 %pre
256 /usr/sbin/useradd -G gtm openvista 2> /dev/null || :
257@@ -138,6 +160,8 @@
258 /sbin/chkconfig --add openvista
259 /sbin/chkconfig openvista on
260
261+/sbin/service httpd reload > /dev/null 2>&1 || :
262+
263 %preun
264 if [ $1 = 0 ]; then
265 /sbin/chkconfig --del openvista-databases
266@@ -154,3 +178,5 @@
267 /usr/sbin/groupdel openvista 2> /dev/null || :
268 fi
269
270+/sbin/service httpd reload > /dev/null 2>&1 || :
271+
272
273=== removed file 'packages/rpm/openvista-webdav-config.spec'
274--- packages/rpm/openvista-webdav-config.spec 2009-04-24 20:40:45 +0000
275+++ packages/rpm/openvista-webdav-config.spec 1970-01-01 00:00:00 +0000
276@@ -1,56 +0,0 @@
277-Name: openvista-webdav-config
278-Version: 0.8
279-Release: 1
280-Summary: WebDAV configuration for OpenVista
281-License: AGPL
282-Vendor: Medsphere Systems Corporation
283-URL: https://medsphere.org/community/project/gtm
284-Group: Applications/System
285-Packager: Jonathan Tai <jon.tai@medsphere.com>
286-
287-Requires: httpd, mod_ssl
288-
289-Source: webdav.conf
290-BuildArch: noarch
291-BuildRoot: %{_tmppath}/%{name}-root
292-
293-%description
294-OpenVista is a cost-effective, open, trusted and complete EHR which enhances
295-patient safety, increases clinical and operational efficiency and provides an
296-opportunity to improve quality of care delivery.
297-
298-This package provides a configuration file for the Apache web server to enable
299-WebDAV. WebDAV is used by OpenVista's document imaging feature.
300-
301-%prep
302-
303-%build
304-
305-%install
306-rm -rf %{buildroot}
307-
308-install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
309-install %{SOURCE0} %{buildroot}%{_sysconfdir}/httpd/conf.d/
310-
311-install -d %{buildroot}%{_sysconfdir}/httpd/conf
312-touch %{buildroot}%{_sysconfdir}/httpd/conf/webdav.htpasswd
313-
314-install -d %{buildroot}/var/www/html/webdav
315-
316-%clean
317-rm -rf %{buildroot}
318-
319-%files
320-%defattr(-,root,root)
321-%{_sysconfdir}/httpd/conf.d/webdav.conf
322-%{_sysconfdir}/httpd/conf/webdav.htpasswd
323-%dir /var/www/html/webdav
324-
325-%post
326-/sbin/service httpd reload > /dev/null 2>&1 || :
327-
328-%postun
329-if [ $1 = 0 ]; then
330- /sbin/service httpd reload > /dev/null 2>&1 || :
331-fi
332-
333
334=== modified file 'rpmbuild.sh'
335--- rpmbuild.sh 2009-04-22 04:16:31 +0000
336+++ rpmbuild.sh 2009-04-30 06:48:24 +0000
337@@ -40,7 +40,7 @@
338 cp -f "$dir/packages/rpm/$package.spec" "$topdir/SPECS/"
339
340 case $package in
341- openvista-utils|openvista-libs)
342+ openvista-utils)
343 # create source tarabll
344 rm -rf "$topdir/SOURCES/${package}-$version"
345 cp -R "$dir" "$topdir/SOURCES/${package}-$version"
346@@ -49,15 +49,19 @@
347 tar -c --bzip2 -f "$topdir/SOURCES/${package}-$version.tar.bz2" -C "$topdir/SOURCES" "${package}-$version"
348 rm -rf "$topdir/SOURCES/${package}-$version"
349
350- ( cd "$topdir/SPECS" && rpmbuild -ba "$package.spec" )
351- ;;
352- openvista-webdav-config)
353 cp -f "$dir/packages/rpm/webdav.conf" "$topdir/SOURCES/"
354+ cp -f "$dir/packages/rpm/openvista" "$topdir/SOURCES/"
355
356 ( cd "$topdir/SPECS" && rpmbuild -ba "$package.spec" )
357 ;;
358- putty-tools)
359- # assume sources are already present
360+ openvista-libs*)
361+ # create source tarabll
362+ rm -rf "$topdir/SOURCES/${package}-$version"
363+ cp -R "$dir" "$topdir/SOURCES/${package}-$version"
364+ rm -rf "$topdir/SOURCES/${package}-$version/.bzr"
365+ rm -f "$topdir/SOURCES/${package}-$version.tar.bz2"
366+ tar -c --bzip2 -f "$topdir/SOURCES/${package}-$version.tar.bz2" -C "$topdir/SOURCES" "${package}-$version"
367+ rm -rf "$topdir/SOURCES/${package}-$version"
368
369 ( cd "$topdir/SPECS" && rpmbuild -ba "$package.spec" )
370 ;;
371@@ -67,6 +71,11 @@
372 # this package must be built as root; assume sudo does not require a password
373 ( cd "$topdir/SPECS" && sudo rpmbuild -ba "$package.spec" )
374 ;;
375+ putty-tools)
376+ # assume sources are already present
377+
378+ ( cd "$topdir/SPECS" && rpmbuild -ba "$package.spec" )
379+ ;;
380 esac
381 done
382
383
384=== modified file 'scripts/usr/lib/openvista/functions'
385--- scripts/usr/lib/openvista/functions 2009-04-17 05:09:55 +0000
386+++ scripts/usr/lib/openvista/functions 2009-04-30 06:48:24 +0000
387@@ -54,7 +54,7 @@
388 gtmgbldir="$root/$instance/globals/mumps.gld"
389 gtm_zinterrupt='I $$JOBEXAM^ZU($ZPOSITION)'
390 gtm_prompt=`echo "$instance>" | tr '[:lower:]' '[:upper:]'`
391- GTMXC_openvista='/usr/share/openvista/openvista.xc'
392+ GTMXC_openvista="$root/$instance/gtm/openvista.xc"
393 PATH="$PATH:$root/$instance/gtm"
394
395 export gtm_dist
396
397=== modified file 'scripts/usr/sbin/ovinstanceadd'
398--- scripts/usr/sbin/ovinstanceadd 2009-04-23 23:19:47 +0000
399+++ scripts/usr/sbin/ovinstanceadd 2009-04-30 17:08:04 +0000
400@@ -119,6 +119,21 @@
401 exit 1
402 fi
403
404+grep "^apache:" /etc/passwd > /dev/null || {
405+ echo "ovinstanceadd: user 'apache' not found in /etc/passwd" >&2
406+ exit 1
407+}
408+
409+if [ ! -d "/var/www/html/webdav" ]; then
410+ echo "ovinstanceadd: /var/www/html/webdav does not exist" >&2
411+ exit 1
412+fi
413+
414+if [ ! -f "/etc/httpd/conf/webdav.htpasswd" ]; then
415+ echo "ovinstanceadd: /etc/httpd/conf/webdav.htpasswd does not exist" >&2
416+ exit 1
417+fi
418+
419 {
420 # use mkdir to create the instance root because it will fail if the
421 # directoy already exists - this avoids a race condition. Also, creating
422@@ -296,28 +311,24 @@
423 exit 1
424 }
425
426-if grep "^apache:" /etc/passwd > /dev/null && [ -d "/var/www/html/webdav" ]; then
427- install -o apache -g apache -m 755 -d "/var/www/html/webdav/$instance" || {
428- echo "ovinstanceadd: Unable to create webdav root" >&2
429- exit 1
430- }
431-
432- ln -s "/var/www/html/webdav/$instance" "$root/$instance/images"
433-fi
434-
435-if [ -x /usr/bin/htpasswd ] && [ -f /etc/httpd/conf/webdav.htpasswd ]; then
436- (
437- umask 077
438- tr -dc '_A-Z-a-z-0-9' < /dev/urandom | head -c16 > "$root/$instance/etc/$instance-webdav_password"
439- )
440- [ -f "$root/$instance/etc/$instance-webdav_password" ] || {
441- echo "ovinstanceadd: Unable to generate WebDAV password" >&2
442- exit 1
443- }
444-
445- htpasswd -b -m "/etc/httpd/conf/webdav.htpasswd" "$instance" "`cat \"$root/$instance/etc/$instance-webdav_password\"`" > /dev/null 2>&1 || {
446- echo "ovinstanceadd: Unable to update /etc/httpd/conf/webdav.htpasswd" >&2
447- exit 1
448- }
449-fi
450+install -o apache -g apache -m 755 -d "/var/www/html/webdav/$instance" || {
451+ echo "ovinstanceadd: Unable to create webdav root" >&2
452+ exit 1
453+}
454+
455+ln -s "/var/www/html/webdav/$instance" "$root/$instance/images"
456+
457+(
458+ umask 077
459+ tr -dc '_A-Z-a-z-0-9' < /dev/urandom | head -c16 > "$root/$instance/etc/$instance-webdav_password"
460+)
461+[ -f "$root/$instance/etc/$instance-webdav_password" ] || {
462+ echo "ovinstanceadd: Unable to generate WebDAV password" >&2
463+ exit 1
464+}
465+
466+htpasswd -b -m "/etc/httpd/conf/webdav.htpasswd" "$instance" "`cat \"$root/$instance/etc/$instance-webdav_password\"`" > /dev/null 2>&1 || {
467+ echo "ovinstanceadd: Unable to update /etc/httpd/conf/webdav.htpasswd" >&2
468+ exit 1
469+}
470
471
472=== modified file 'scripts/usr/sbin/ovinstancedel'
473--- scripts/usr/sbin/ovinstancedel 2009-04-22 04:16:31 +0000
474+++ scripts/usr/sbin/ovinstancedel 2009-04-30 17:08:04 +0000
475@@ -92,6 +92,11 @@
476 exit 1
477 fi
478
479+if [ ! -f "/etc/httpd/conf/webdav.htpasswd" ]; then
480+ echo "ovinstancedel: /etc/httpd/conf/webdav.htpasswd does not exist" >&2
481+ exit 1
482+fi
483+
484 $skip_confirmation || {
485 echo "All routines, database files, journals, backups, tied accounts, and images" >&2
486 echo "associated with '$instance' will be PERMANENTLY deleted." >&2
487@@ -143,12 +148,10 @@
488 exit 1
489 }
490
491-if [ -x /usr/bin/htpasswd ] && [ -f /etc/httpd/conf/webdav.htpasswd ]; then
492- htpasswd -D "/etc/httpd/conf/webdav.htpasswd" "$instance" > /dev/null 2>&1 || {
493- echo "ovinstancedel: Unable to update /etc/httpd/conf/webdav.htpasswd" >&2
494- exit 1
495- }
496-fi
497+htpasswd -D "/etc/httpd/conf/webdav.htpasswd" "$instance" > /dev/null 2>&1 || {
498+ echo "ovinstancedel: Unable to update /etc/httpd/conf/webdav.htpasswd" >&2
499+ exit 1
500+}
501
502 rm -rf "/var/www/html/webdav/$instance" || {
503 echo "ovinstancedel: Unable to remove WebDAV root" >&2
504
505=== modified file 'src/libopenvista/compile.sh'
506--- src/libopenvista/compile.sh 2009-04-23 05:09:48 +0000
507+++ src/libopenvista/compile.sh 2009-04-30 06:54:29 +0000
508@@ -18,6 +18,6 @@
509 # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com.
510
511 gcc -c -FPIC myconv.c
512-gcc -c -FPIC dopam.c
513+gcc -c -FPIC -I /opt/lsb-gtm/V5.3-003_i686 dopam.c
514 gcc -c -FPIC -I /opt/lsb-gtm/V5.3-003_i686 gtmserver.c
515 gcc -o libopenvista.so -shared myconv.o dopam.o gtmserver.o -lpam
516
517=== modified file 'src/libopenvista/dopam.c'
518--- src/libopenvista/dopam.c 2009-02-18 08:00:39 +0000
519+++ src/libopenvista/dopam.c 2009-04-30 06:54:29 +0000
520@@ -22,10 +22,11 @@
521 #include <security/pam_appl.h>
522
523 #include "authdata.h"
524+#include "gtmxc_types.h"
525
526 extern int myconv(int n, const struct pam_message **msg, struct pam_response **resp, void *data);
527
528-int dopam(int count, char *user, char *password, char *pam_mod)
529+xc_long_t dopam(int count, char *user, char *password, char *pam_mod)
530 {
531 int pam_err;
532 pam_handle_t *pamh;
533
534=== modified file 'src/libopenvista/openvista.xc'
535--- src/libopenvista/openvista.xc 2009-04-23 04:45:12 +0000
536+++ src/libopenvista/openvista.xc 2009-04-30 06:48:24 +0000
537@@ -1,3 +1,3 @@
538-/usr/lib/openvista/libopenvista.so
539+/opt/lsb-gtm/V5.3-003_i686/libopenvista.so
540 dopam: xc_long_t dopam(I:xc_char_t*, I:xc_char_t*, I:xc_char_t*)
541 gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_char_t*)
542
543=== added directory 'src/suidwrapper'
544=== added file 'src/suidwrapper/compile.sh'
545--- src/suidwrapper/compile.sh 1970-01-01 00:00:00 +0000
546+++ src/suidwrapper/compile.sh 2009-04-30 03:43:02 +0000
547@@ -0,0 +1,3 @@
548+#!/bin/sh
549+
550+gcc -O2 gtmsignal.c -o gtmsignal
551
552=== added file 'src/suidwrapper/gtmsignal.c'
553--- src/suidwrapper/gtmsignal.c 1970-01-01 00:00:00 +0000
554+++ src/suidwrapper/gtmsignal.c 2009-05-01 16:09:10 +0000
555@@ -0,0 +1,184 @@
556+#include <stdio.h>
557+#include <unistd.h>
558+#include <stdlib.h>
559+#include <getopt.h>
560+#include <limits.h>
561+#include <dirent.h>
562+#include <string.h>
563+#include <sys/stat.h>
564+#include <fcntl.h>
565+
566+#define MUPIP_CMD "mupip"
567+#define MUMPS_CMD "mumps"
568+
569+char mupip[PATH_MAX+1];
570+char mumps[PATH_MAX+1];
571+int quiet = 0;
572+
573+#define ERR_PRINT(...) if (!quiet) fprintf( stderr, __VA_ARGS__ )
574+
575+int is_int( char *str ) {
576+ long long_val;
577+ char *end_ptr;
578+ if (!str) {
579+ return -1;
580+ }
581+ end_ptr = str;
582+ long_val = strtol( str, &end_ptr, 10 );
583+ if (end_ptr==str || *end_ptr!='\0' || long_val>INT_MAX || long_val<INT_MIN) {
584+ return 0;
585+ }
586+ return 1;
587+}
588+
589+void send_signal_to_id( char* id, int do_stop ) {
590+ int child_pid;
591+ if (!(child_pid=fork())) {
592+ /* suppress warnings and messages from mupip */
593+ int fd = open("/dev/null", O_RDWR);
594+ if (-1 != fd) {
595+ dup2(fd, STDIN_FILENO);
596+ dup2(fd, STDOUT_FILENO);
597+ dup2(fd, STDERR_FILENO);
598+ close( fd );
599+ }
600+ if (-1 == execl( mupip, mupip, do_stop ? "stop" : "intrpt", id, (char*)0 ) ) {
601+ ERR_PRINT( "Error invoking mupip command.\n" );
602+ exit( -1 );
603+ }
604+ } else {
605+ waitpid( child_pid, 0, 0 );
606+ }
607+}
608+
609+int is_mumps_process( char *id ) {
610+ char pid_exe[PATH_MAX+1];
611+ char target[PATH_MAX+1];
612+ int size;
613+ sprintf( pid_exe, "/proc/%s/exe", id );
614+ size = readlink(pid_exe, target, PATH_MAX);
615+ target[size] = '\0';
616+ return !strcmp(target, mumps);
617+}
618+
619+void send_signal_to_ids( char **ids, int do_stop ) {
620+ int i;
621+ for (i=0; ids[i]; ++i) {
622+ if (is_mumps_process(ids[i])) {
623+ send_signal_to_id( ids[i], do_stop );
624+ }
625+ }
626+}
627+
628+void send_signal_to_all( int do_stop ) {
629+ struct dirent *dir_entry;
630+ FILE *fp;
631+ char *open_paren, *close_paren, *space;
632+ DIR *dir = opendir("/proc");
633+ if (dir) {
634+ while ( dir_entry = readdir(dir) ) {
635+ if (is_int(dir_entry->d_name) && is_mumps_process(dir_entry->d_name)) {
636+ send_signal_to_id( dir_entry->d_name, do_stop );
637+ }
638+ }
639+ closedir( dir );
640+ }
641+}
642+
643+void find_paths() {
644+ char proc_exe[PATH_MAX];
645+ ssize_t size;
646+ int pid = getpid();
647+ struct stat status;
648+ sprintf(proc_exe, "/proc/%d/exe", pid);
649+ size = readlink(proc_exe, mupip, PATH_MAX+1);
650+ if (0>=size) {
651+ ERR_PRINT( "Could not determine where to find %s.\n", MUMPS_CMD );
652+ exit( -1 );
653+ }
654+ mupip[size]='\0';
655+ strcpy(mumps, mupip);
656+ strcpy(strrchr(mupip, '/')+1, MUPIP_CMD);
657+ strcpy(strrchr(mumps, '/')+1, MUMPS_CMD);
658+ if (-1 == stat(mupip, &status)) {
659+ ERR_PRINT( "Could not find '%s'.\n", mupip );
660+ exit( -1 );
661+ }
662+}
663+
664+void print_usage(FILE *fp, const char* name) {
665+ fprintf( fp, "Usage: %s [OPTION] [pid]...\n", name );
666+ fprintf( fp, "Send mupip STOP or INTRPT to GT.M processes.\n" );
667+ fprintf( fp, "\nOptions\n" );
668+ fprintf( fp, " -a, --all send signal to all GT.M processes\n" );
669+ fprintf( fp, " -s, --stop send STOP instead of INTRPT\n" );
670+ fprintf( fp, " -h, --help print this help\n" );
671+ fprintf( fp, " -q, --quite quiet; do not display warnings\n" );
672+}
673+
674+int main( int argc, char **argv ) {
675+ int do_stop = 0;
676+ int all = 0;
677+ char **pids = 0;
678+ int array_index = 0;
679+
680+ find_paths();
681+ while (1) {
682+ static struct option long_options[] =
683+ {
684+ {"stop", no_argument, 0, 's'},
685+ {"all", no_argument, 0, 'a'},
686+ {"quiet", no_argument, 0, 'q'},
687+ {"help", no_argument, 0, 'h'},
688+ {0, 0, 0, 0}
689+ };
690+ int c = getopt_long( argc, argv, "saqh", long_options, 0 );
691+ if (c==-1)
692+ break;
693+ switch (c) {
694+ case 's':
695+ do_stop = 1;
696+ break;
697+ case 'a':
698+ all = 1;
699+ break;
700+ case 'q':
701+ quiet = 1;
702+ break;
703+ case 'h':
704+ print_usage(stdout, argv[0]);
705+ exit( 0 );
706+ case '?':
707+ print_usage(stderr, argv[0]);
708+ exit(-1);
709+ default:
710+ abort();
711+ }
712+ }
713+
714+ if (optind < argc && !all) {
715+ pids = malloc((argc-optind+1)*sizeof(char*));
716+ pids[argc-optind] = 0;
717+ while (optind < argc) {
718+ if (!is_int(argv[optind])) {
719+ ERR_PRINT( "Invalid process number '%s'.\n", argv[optind] );
720+ exit( -1 );
721+ }
722+ pids[array_index++] = argv[optind];
723+ ++optind;
724+ }
725+ }
726+
727+ if (all) {
728+ send_signal_to_all( do_stop );
729+ } else if (pids) {
730+ send_signal_to_ids( pids, do_stop );
731+ free( pids );
732+ } else {
733+ ERR_PRINT( "No process IDs were given.\n" );
734+ exit( -1 );
735+ }
736+
737+ return 0;
738+}
739+

Subscribers

People subscribed via source and target branches