source: trunk/dsys/comCHECKSRC@ 282

Last change on this file since 282 was 27, checked in by rainer, 19 years ago

Support for server-to-server relay and more user policies

File size: 3.4 KB
Line 
1#########################################################################
2#
3# Subroutine for the 'checksrc' command
4#
5#########################################################################
6#
7# Copyright Rainer Wichmann (2005)
8#
9# License Information:
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24
25commandCHECKSRC() {
26 printINFO "About to run \"$action\""
27
28 needEXE ls gpg
29
30
31 cd "${basedir}/source" || printFATAL "could not cd to ${basedir}/source"
32
33 LIST=`ls samhain*.tar.gz 2>/dev/null`
34 if test x$? != x0
35 then
36 printINFO "No sources available."
37 fi
38
39 for ff in $LIST
40 do
41 sh_version=`echo "$ff" | sed 's/.*samhain\-//g' | sed 's/\.tar\.gz//g'`
42 if test x"${sh_version}" = x
43 then
44 printFATAL "Cannot determine version for $ff"
45 fi
46
47 if test "$ff" != "samhain-${sh_version}.tar.gz"
48 then
49 printFATAL "Version number not correctly extracted from $ff"
50 fi
51
52 if test -f "samhain-${sh_version}.tar.gz.asc"
53 then
54 :
55 else
56 printWARNING "No detached signature for $ff found"
57 if test x"$cs_delete" = x1
58 then
59 if test x"$simulate" = x0
60 then
61 printLOG "REMOVE $ff: No detached signature found."
62 rm -f "$ff"
63 else
64 printLOG "REMOVE $ff: No detached signature found."
65 printINFO "rm -f $ff"
66 fi
67 else
68 printLOG "BAD: $ff (no signature)"
69 fi
70 continue
71 fi
72
73 sig_lines=`(LANG="C"; gpg --status-fd 1 --verify "samhain-${sh_version}.tar.gz.asc" "samhain-${sh_version}.tar.gz" 2>/dev/null)`
74 sig_ok=`echo ${sig_lines} | grep 'GOODSIG'`
75 sig_nokey=`echo ${sig_lines} | grep 'NO_PUBKEY'`
76
77 if test x"${sig_nokey}" != x
78 then
79 printWARNING "Public key (ID 0F571F6C) not found, trying to import it."
80 gpg --import ${basedir}/private/0F571F6C.asc 2>&5
81 sig_lines=`(LANG="C"; gpg --status-fd 1 --verify "samhain-${sh_version}.tar.gz.asc" "samhain-${sh_version}.tar.gz" 2>/dev/null)`
82 sig_ok=`echo ${sig_lines} | grep 'GOODSIG'`
83 sig_nokey=`echo ${sig_lines} | grep 'NO_PUBKEY'`
84 fi
85
86 if test x"${sig_nokey}" != x
87 then
88 printFATAL "Importing public key failed."
89 fi
90
91 if test x"${sig_ok}" = x
92 then
93 printWARNING "File $ff has no good signature"
94 if test x"$cs_delete" = x1
95 then
96 if test x"$simulate" = x0
97 then
98 printLOG "REMOVE $ff: No good signature found."
99 rm -f "$ff"
100 else
101 printLOG "REMOVE $ff: No good signature found."
102 printINFO "rm -f $ff"
103 fi
104 else
105 printLOG "BAD: $ff (invalid signature)"
106 fi
107 continue
108 fi
109 printLOG "OK: $ff"
110
111 done
112
113 if test x"$cs_delete" = x1
114 then
115 printLOG "Checked sources in ${basedir}/source/ (delete=on)"
116 else
117 printLOG "Checked sources in ${basedir}/source/ (delete=off)"
118 fi
119 return 0
120}
Note: See TracBrowser for help on using the repository browser.