1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Copyright (C) Guenther Deschner 2008
|
---|
4 | #
|
---|
5 | # This program is free software; you can redistribute it and/or modify
|
---|
6 | # it under the terms of the GNU General Public License as published by
|
---|
7 | # the Free Software Foundation; either version 3 of the License, or
|
---|
8 | # (at your option) any later version.
|
---|
9 | #
|
---|
10 | # This program is distributed in the hope that it will be useful,
|
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | # GNU General Public License for more details.
|
---|
14 | #
|
---|
15 | # You should have received a copy of the GNU General Public License
|
---|
16 | # along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
17 |
|
---|
18 | tempdir=`mktemp -d /tmp/wb_padXXXXXX`
|
---|
19 | test -n "$tempdir" || exit 1
|
---|
20 | cat >> $tempdir/wb_pad.c << _EOF
|
---|
21 | #include "nsswitch/winbind_client.h"
|
---|
22 |
|
---|
23 | int main(int argc, const char **argv)
|
---|
24 | {
|
---|
25 | struct winbindd_request req;
|
---|
26 | struct winbindd_response resp;
|
---|
27 |
|
---|
28 | if (argc != 2) {
|
---|
29 | printf("usage: %s [req|resp]\n", argv[0]);
|
---|
30 | return 0;
|
---|
31 | }
|
---|
32 |
|
---|
33 | if (strcmp(argv[1], "req") == 0) {
|
---|
34 | printf("%d\n", (uint32_t)sizeof(req));
|
---|
35 | }
|
---|
36 | if (strcmp(argv[1], "resp") == 0) {
|
---|
37 | printf("%d\n", (uint32_t)sizeof(resp));
|
---|
38 | }
|
---|
39 |
|
---|
40 | return 0;
|
---|
41 | }
|
---|
42 | _EOF
|
---|
43 |
|
---|
44 | cleanup() {
|
---|
45 | rm -f $tempdir/wb_pad_32 $tempdir/wb_pad_64 $tempdir/wb_pad.c
|
---|
46 | rmdir $tempdir
|
---|
47 | }
|
---|
48 |
|
---|
49 | cflags="-I. -I../ -I./../lib/replace -Iinclude"
|
---|
50 | ${CC:-gcc} -m32 $RPM_OPT_FLAGS $CFLAGS -o $tempdir/wb_pad_32 $cflags $tempdir/wb_pad.c
|
---|
51 | if [ $? -ne 0 ]; then
|
---|
52 | cleanup
|
---|
53 | exit 1
|
---|
54 | fi
|
---|
55 | ${CC:-gcc} -m64 $RPM_OPT_FLAGS $CFLAGS -o $tempdir/wb_pad_64 $cflags $tempdir/wb_pad.c
|
---|
56 | if [ $? -ne 0 ]; then
|
---|
57 | cleanup
|
---|
58 | exit 1
|
---|
59 | fi
|
---|
60 |
|
---|
61 | out_64_req=`$tempdir/wb_pad_64 req`
|
---|
62 | out_64_resp=`$tempdir/wb_pad_64 resp`
|
---|
63 | out_32_req=`$tempdir/wb_pad_32 req`
|
---|
64 | out_32_resp=`$tempdir/wb_pad_32 resp`
|
---|
65 |
|
---|
66 | cleanup
|
---|
67 |
|
---|
68 | if test "$out_64_req" != "$out_32_req"; then
|
---|
69 | echo "winbind request size differs!"
|
---|
70 | echo "64bit: $out_64_req"
|
---|
71 | echo "32bit: $out_32_req"
|
---|
72 | exit 1
|
---|
73 | fi
|
---|
74 |
|
---|
75 | if test "$out_64_resp" != "$out_32_resp"; then
|
---|
76 | echo "winbind response size differs!"
|
---|
77 | echo "64bit: $out_64_resp"
|
---|
78 | echo "32bit: $out_32_resp"
|
---|
79 | exit 1
|
---|
80 | fi
|
---|
81 |
|
---|
82 | exit 0
|
---|