Skip to content

Commit

Permalink
use const char * instead of char *
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhangui committed May 7, 2024
1 parent b7b7aff commit 2f6e328
Show file tree
Hide file tree
Showing 17 changed files with 152 additions and 109 deletions.
2 changes: 1 addition & 1 deletion indimail-mta-x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ iftocc.o: compile iftocc.c
./compile iftocc.c

ofmipd: load ofmipd.o rwhconfig.o qmail.o \
auto_prefix.o control.o auto_control.o variables.o
auto_prefix.o control.o auto_control.o variables.o
./load ofmipd rwhconfig.o qmail.o \
auto_prefix.o auto_control.o variables.o control.o \
$(static_option) $(QMAILLIB) $(dynamic_option)
Expand Down
7 changes: 5 additions & 2 deletions indimail-mta-x/getDomainToken.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: getDomainToken.c,v $
* Revision 1.8 2024-05-07 12:48:50+05:30 Cprogrammer
* use const char *
*
* Revision 1.7 2024-02-09 15:56:26+05:30 Cprogrammer
* fix match for entries without local/remote directive
*
Expand Down Expand Up @@ -53,7 +56,7 @@ dtype delivery;
* QREGEX environment variable is defined
*/
char *
getDomainToken(char *domain, stralloc *sa)
getDomainToken(const char *domain, stralloc *sa)
{
regex_t qreg;
int len, n, retval, use_regex;
Expand Down Expand Up @@ -143,7 +146,7 @@ getDomainToken(char *domain, stralloc *sa)
void
getversion_getdomaintoke_c()
{
static char *x = "$Id: getDomainToken.c,v 1.7 2024-02-09 15:56:26+05:30 Cprogrammer Exp mbhangui $";
static char *x = "$Id: getDomainToken.c,v 1.8 2024-05-07 12:48:50+05:30 Cprogrammer Exp mbhangui $";

x = sccsidwildmath;
x = sccsidgetdomainth;
Expand Down
7 changes: 5 additions & 2 deletions indimail-mta-x/getDomainToken.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: getDomainToken.h,v $
* Revision 1.3 2024-05-07 12:49:11+05:30 Cprogrammer
* use const char *
*
* Revision 1.2 2021-08-28 23:03:41+05:30 Cprogrammer
* added dtype enum from variables.h
*
Expand All @@ -12,7 +15,7 @@
#include <stralloc.h>

#ifndef lint
static char sccsidgetdomainth[] = "$Id: getDomainToken.h,v 1.2 2021-08-28 23:03:41+05:30 Cprogrammer Exp mbhangui $";
static char sccsidgetdomainth[] = "$Id: getDomainToken.h,v 1.3 2024-05-07 12:49:11+05:30 Cprogrammer Exp mbhangui $";
#endif

typedef enum {
Expand All @@ -22,6 +25,6 @@ typedef enum {
local_or_remote,
} dtype;

char *getDomainToken(char *, stralloc *);
char *getDomainToken(const char *, stralloc *);

#endif
22 changes: 13 additions & 9 deletions indimail-mta-x/qmail-dkim.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: qmail-dkim.c,v 1.82 2024-01-23 01:22:34+05:30 Cprogrammer Exp mbhangui $
* $Id: qmail-dkim.c,v 1.83 2024-05-07 12:49:17+05:30 Cprogrammer Exp mbhangui $
*/
#include "hasdkim.h"
#ifdef HASDKIM
Expand Down Expand Up @@ -60,7 +60,7 @@ struct datetime dt;
unsigned long uid;
int readfd;
DKIMContext ctxt;
char *dkimsignoptions;
const char *dkimsignoptions;

no_return void
die(int e, int what)
Expand Down Expand Up @@ -163,8 +163,8 @@ restore_gid()
custom_error("qmail-dkim", "Z", "unable to restore gid.", 0, "X.3.0");
}

char *
replace_pct(char *keyfn, char *domain, int pos, int *replace)
const char *
replace_pct(const char *keyfn, const char *domain, int pos, int *replace)
{
char *p, *t, *s;
int i, d, r, len;
Expand Down Expand Up @@ -213,7 +213,7 @@ replace_pct(char *keyfn, char *domain, int pos, int *replace)
}

int
dkim_setoptions(DKIMSignOptions *opts, char *signOptions)
dkim_setoptions(DKIMSignOptions *opts, const char *signOptions)
{
int ch, argc;
char **argv;
Expand Down Expand Up @@ -321,9 +321,10 @@ dkim_setoptions(DKIMSignOptions *opts, char *signOptions)
}

static void
write_signature(char *domain, DKIMSignOptions *opts, size_t selector_size)
write_signature(const char *domain, DKIMSignOptions *opts, size_t selector_size)
{
char *pSig, *keyfn, *ptr, *selector;
char *pSig;
const char *keyfn, *ptr, *selector;
int i, r_selector, pct_found;
static stralloc tmp = { 0 };

Expand Down Expand Up @@ -1103,7 +1104,7 @@ main(int argc, char *argv[])
}
if (dkimsign || dkimverify) {
if (dkimsign) {
char *t;
const char *t;

if (!(t = DKIMSignGetDomain(&ctxt))) {
DKIMSignFree(&ctxt);
Expand Down Expand Up @@ -1298,7 +1299,7 @@ main(int argc, char **argv)
void
getversion_qmail_dkim_c()
{
static char *x = "$Id: qmail-dkim.c,v 1.82 2024-01-23 01:22:34+05:30 Cprogrammer Exp mbhangui $";
static char *x = "$Id: qmail-dkim.c,v 1.83 2024-05-07 12:49:17+05:30 Cprogrammer Exp mbhangui $";

#ifdef HASDKIM
x = sccsidmakeargsh;
Expand All @@ -1312,6 +1313,9 @@ getversion_qmail_dkim_c()

/*
* $Log: qmail-dkim.c,v $
* Revision 1.83 2024-05-07 12:49:17+05:30 Cprogrammer
* use const char *
*
* Revision 1.82 2024-01-23 01:22:34+05:30 Cprogrammer
* include buffer_defs.h for buffer size definitions
*
Expand Down
13 changes: 8 additions & 5 deletions indimail-mta-x/qregex.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* $Id: qregex.c,v 1.37 2023-11-03 05:21:55+05:30 Cprogrammer Exp mbhangui $
* $Id: qregex.c,v 1.38 2024-05-07 12:51:49+05:30 Cprogrammer Exp mbhangui $
*
* qregex (v2)
* Author : Evan Borgstrom (evan at unixpimps dot org)
* Created : 2001/12/14 23:08:16
* Modified: $Date: 2023-11-03 05:21:55+05:30 $
* Revision: $Revision: 1.37 $
* Modified: $Date: 2024-05-07 12:51:49+05:30 $
* Revision: $Revision: 1.38 $
*
* Do POSIX regex matching on addresses for anti-relay / spam control.
* It logs to the maillog
Expand All @@ -24,7 +24,7 @@
* www.arda.homeunix.net/store/qmail/
*
* Contributers to qregex:
* Jeremy Kitchen
* Jeremy Kitchen
* kitchen at scriptkitchen dot com
* http://www.scriptkitchen.com/qmail
Expand Down Expand Up @@ -241,14 +241,17 @@ regex_match(stralloc *addr, stralloc *map, char **errStr)
void
getversion_qregex_c()
{
static char *x = "$Id: qregex.c,v 1.37 2023-11-03 05:21:55+05:30 Cprogrammer Exp mbhangui $";
static char *x = "$Id: qregex.c,v 1.38 2024-05-07 12:51:49+05:30 Cprogrammer Exp mbhangui $";

x = sccsidwildmath;
x++;
}

/*
* $Log: qregex.c,v $
* Revision 1.38 2024-05-07 12:51:49+05:30 Cprogrammer
* removed extra wsp
*
* Revision 1.37 2023-11-03 05:21:55+05:30 Cprogrammer
* fix wildmat when pattern file is missing
*
Expand Down
9 changes: 6 additions & 3 deletions indimail-mta-x/surblfilter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: surblfilter.c,v 1.19 2024-01-23 01:23:51+05:30 Cprogrammer Exp mbhangui $
* $Id: surblfilter.c,v 1.20 2024-05-07 12:51:56+05:30 Cprogrammer Exp mbhangui $
*/
#include <unistd.h>
#include <fcntl.h>
Expand Down Expand Up @@ -345,7 +345,7 @@ char *
dns_text(char *dn)
{
int r;

switch (r = dns_txtplus(dn))
{
case DNS_MEM:
Expand Down Expand Up @@ -971,13 +971,16 @@ main(int argc, char **argv)
void
getversion_surblfilter_c()
{
static char *x = "$Id: surblfilter.c,v 1.19 2024-01-23 01:23:51+05:30 Cprogrammer Exp mbhangui $";
static char *x = "$Id: surblfilter.c,v 1.20 2024-05-07 12:51:56+05:30 Cprogrammer Exp mbhangui $";

x++;
}

/*
* $Log: surblfilter.c,v $
* Revision 1.20 2024-05-07 12:51:56+05:30 Cprogrammer
* removed extra wsp
*
* Revision 1.19 2024-01-23 01:23:51+05:30 Cprogrammer
* include buffer_defs.h for buffer size definitions
*
Expand Down
6 changes: 3 additions & 3 deletions indimail-mta-x/wildmat.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-** wildmat.c.orig Wed Dec 3 11:46:31 1997
* $Revision: 1.8 $
* $Revision: 1.9 $
* Do shell-style pattern matching for ?, \, [], and * characters.
* Might not be robust in face of malformed patterns; e.g., "foo[a-"
* could cause a segmentation violation. It is 8bit clean.
Expand Down Expand Up @@ -100,7 +100,7 @@ DoMatch(register char *text, register char *p)

/*- User-level routine. Returns TRUE or FALSE. */
int
wildmat_internal(char *text, char *p)
wildmat_internal(const char *text, const char *p)
{
#ifdef OPTIMIZE_JUST_STAR
if (p[0] == '*' && p[1] == '\0')
Expand Down Expand Up @@ -146,7 +146,7 @@ main()
void
getversion_wildmat_internal_c()
{
static char *x = "$Id: wildmat.c,v 1.8 2022-10-09 23:04:21+05:30 Cprogrammer Exp mbhangui $";
static char *x = "$Id: wildmat.c,v 1.9 2024-05-07 12:49:27+05:30 Cprogrammer Exp mbhangui $";

x = sccsidwildmath;
x++;
Expand Down
7 changes: 5 additions & 2 deletions indimail-mta-x/wildmat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: wildmat.h,v $
* Revision 1.2 2024-05-07 12:49:31+05:30 Cprogrammer
* use const char *
*
* Revision 1.1 2021-05-23 06:35:07+05:30 Cprogrammer
* Initial revision
*
Expand All @@ -8,7 +11,7 @@
#define _WILDMAT_H

#ifndef lint
static char sccsidwildmath[] = "$Id: wildmat.h,v 1.1 2021-05-23 06:35:07+05:30 Cprogrammer Exp mbhangui $";
static char sccsidwildmath[] = "$Id: wildmat.h,v 1.2 2024-05-07 12:49:31+05:30 Cprogrammer Exp mbhangui $";
#endif

#ifndef TRUE
Expand All @@ -28,6 +31,6 @@ static char sccsidwildmath[] = "$Id: wildmat.h,v 1.1 2021-05-23 06:35:07+05:
/*- Do tar(1) matching rules, which ignore a trailing slash? */
#undef MATCH_TAR_PATTERN

int wildmat_internal(char *, char *);
int wildmat_internal(const char *, const char *);

#endif
48 changes: 24 additions & 24 deletions libdkim2-x/create_rpm
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
# $Log: create_rpm,v $
# Revision 1.7 2024-05-07 12:54:53+05:30 Cprogrammer
# use x.y as release
#
# Revision 1.6 2023-07-07 20:59:31+05:30 Cprogrammer
# renamed libdkim to libdkim2
#
Expand All @@ -19,7 +22,7 @@
# Initial revision
#
#
# $Id: create_rpm,v 1.6 2023-07-07 20:59:31+05:30 Cprogrammer Exp mbhangui $
# $Id: create_rpm,v 1.7 2024-05-07 12:54:53+05:30 Cprogrammer Exp mbhangui $
#
curdir=`pwd`
version=$(cat conf-version)
Expand Down Expand Up @@ -107,40 +110,36 @@ if [ $copy_src -eq 1 ] ; then
--exclude="$name-$version/RCS" \
-cf - $name-"$version" \
| gzip -c > $rpmbuild/SOURCES/$name-"$version".tar.gz
dist=`uname -r |cut -d . -f4`
if [ -z "$release" ] ; then
if [ -d /usr/include/dkim ] ; then
qdist=$(rpm -qf /usr/include/dkim|cut -d- -f4|cut -d. -f3)
if [ " $dist" = " $qdist" ] ; then
qversion=$(rpm -qf /usr/include/dkim|cut -d- -f3)
if [ "$qversion" = "$version" ] ; then
release=$(rpm -qf /usr/include/dkim | cut -d- -f4 | cut -d. -f2)
release=$(expr $release + 1)
t1=$(rpm -qf /usr/include/dkim | cut -d- -f4 | cut -d. -f1)
t2=$(rpm -qf /usr/include/dkim | cut -d- -f4 | cut -d. -f2)
t2=$(expr $t2 + 1)
release="$t1.$t2"
else
release=1
release=0.1
fi
else
release=1
fi
else
release=1
release=0.1
fi
fi
cd ..
/bin/cp -p stage/$name-"$version"/$name-rpmlintrc $rpmbuild/SOURCES
else
cd ..
fi
echo -n "Build RPM for $name-"$version"-1."$release" (Y/N) - "
echo -n "Build RPM for $name-"$version"-"$release" (Y/N) - "
read key
if [ " $key" = " Y" -o " $key" = " y" ] ; then
cp stage/$name-"$version"/$name.spec /tmp
sed -i -e "s|^Release: .*|Release: 1.$release%{?dist}|g" /tmp/$name.spec
sed -i -e "s|^Release: .*|Release: $release%{?dist}|g" /tmp/$name.spec
cd $curdir
if [ $? -eq 0 ] ; then
tmprel=`cat conf-release 2>/dev/null`
if [ ! " $tmprel" = " 1.$release" ] ; then
echo 1.$release > conf-release
if [ ! " $tmprel" = " $release" ] ; then
echo $release > conf-release
make -s $name.spec
cp $name.spec /tmp
cd debian
Expand All @@ -155,25 +154,26 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then
echo "rpmbuild -ba $clean /tmp/$name.spec"
rpmbuild -ba $clean /tmp/$name.spec
fi
dist=`uname -r |cut -d . -f4`
if [ $? -eq 0 ] ; then
/bin/rm /tmp/$name.spec
build_arch=`rpmbuild --showrc|grep "^build arch" | awk '{print $4}'`
rpm --addsign $rpmbuild/RPMS/$build_arch/$name-"$version"-"1.$release".$dist.$build_arch.rpm >/dev/null
rpm --addsign $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"1.$release".$dist.$build_arch.rpm >/dev/null
echo $rpmbuild/RPMS/$build_arch/$name-"$version"-"1.$release".$dist.$build_arch.rpm
echo $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"1.$release".$dist.$build_arch.rpm
echo -n "RPM lint for $name-"$version"-1."$release" (Y/N) - "
rpm --addsign $rpmbuild/RPMS/$build_arch/$name-"$version"-"$release".$dist.$build_arch.rpm >/dev/null
rpm --addsign $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"$release".$dist.$build_arch.rpm >/dev/null
echo $rpmbuild/RPMS/$build_arch/$name-"$version"-"$release".$dist.$build_arch.rpm
echo $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"$release".$dist.$build_arch.rpm
echo -n "RPM lint for $name-"$version"-"$release" (Y/N) - "
read key
if [ " $key" = " Y" -o " $key" = " y" ] ; then
(
echo $name
rpmlint $rpmbuild/RPMS/$build_arch/$name-"$version"-"1.$release".$dist.$build_arch.rpm
rpmlint $rpmbuild/RPMS/$build_arch/$name-"$version"-"$release".$dist.$build_arch.rpm
echo ------------------------
echo $name-devel
rpmlint $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"1.$release".$dist.$build_arch.rpm
rpmlint $rpmbuild/RPMS/$build_arch/$name-devel-"$version"-"$release".$dist.$build_arch.rpm
echo ------------------------
echo $name-"$version"-"1.$release".$dist.src.rpm
rpmlint $rpmbuild/SRPMS/$name-"$version"-"1.$release".$dist.src.rpm
echo $name-"$version"-"$release".$dist.src.rpm
rpmlint $rpmbuild/SRPMS/$name-"$version"-"$release".$dist.src.rpm
echo ------------------------
) 2>&1 | less
fi
Expand Down
Loading

0 comments on commit 2f6e328

Please sign in to comment.