From de5f132afedb37176b2870537903d921363a45be Mon Sep 17 00:00:00 2001 From: Manvendra Bhangui Date: Fri, 10 May 2024 00:14:58 +0530 Subject: [PATCH] fix discarded-qualifier compiler warnings (#67) * fix discarded-qualifier compiler warnings * fixed duplicate symbol error * updated RCS logs for indimail-mta * added RCS logs for daemontools * added RCS log for ucspi-tcp * create_rpm: use x.y for release * updated ChangeLogs --- daemontools-x/conf-cc-LINUX | 2 +- daemontools-x/create_rpm | 47 ++-- daemontools-x/deepsleep.c | 5 +- daemontools-x/doc/ChangeLog | 2 + daemontools-x/envdir.c | 9 +- daemontools-x/envuidgid.c | 5 +- daemontools-x/fghack.c | 7 +- daemontools-x/inotify.c | 11 +- daemontools-x/installer.c | 9 +- daemontools-x/logselect.c | 5 +- daemontools-x/match.c | 5 +- daemontools-x/multilog.c | 17 +- daemontools-x/multipipe.c | 5 +- daemontools-x/pgrphack.c | 5 +- daemontools-x/qfilelog.c | 5 +- daemontools-x/readproctitle.c | 5 +- daemontools-x/run_init.c | 8 +- daemontools-x/setlock.c | 5 +- daemontools-x/setuidgid.c | 11 +- daemontools-x/softlimit.c | 5 +- daemontools-x/sorted.c | 5 +- daemontools-x/spipe.c | 5 +- daemontools-x/supervise.c | 39 +-- daemontools-x/svc.c | 5 +- daemontools-x/svcfns.c | 5 +- daemontools-x/svok.c | 5 +- daemontools-x/svscan.c | 37 +-- daemontools-x/svstat.c | 7 +- daemontools-x/tai2tai64n.c | 13 +- daemontools-x/tai64n.c | 5 +- daemontools-x/tai64n2tai.c | 10 +- daemontools-x/tai64nlocal.c | 7 +- daemontools-x/tai64nunix.c | 7 +- daemontools-x/teepipe.c | 5 +- indimail-mta-x/822addr.c | 5 +- indimail-mta-x/822body.c | 5 +- indimail-mta-x/822bodyfilter.c | 5 +- indimail-mta-x/822date.c | 5 +- indimail-mta-x/822field.c | 5 +- indimail-mta-x/822fields.c | 5 +- indimail-mta-x/822header.c | 5 +- indimail-mta-x/822headerfilter.c | 5 +- indimail-mta-x/822headerok.c | 5 +- indimail-mta-x/822print.c | 13 +- indimail-mta-x/822received.c | 5 +- indimail-mta-x/Makefile | 6 +- indimail-mta-x/TARGETS | 5 + indimail-mta-x/addrlist.c | 5 +- indimail-mta-x/atrn.c | 9 +- indimail-mta-x/authcram.c | 7 +- indimail-mta-x/auto-strarr.c | 5 +- indimail-mta-x/auto-uid.c | 5 +- indimail-mta-x/autoresponder.c | 82 +++---- indimail-mta-x/batv.c | 11 +- indimail-mta-x/bodycheck.c | 7 +- indimail-mta-x/bodycheck.h | 5 +- indimail-mta-x/bouncesaying.c | 5 +- indimail-mta-x/cdb-database.c | 5 +- indimail-mta-x/cdb_match.c | 11 +- indimail-mta-x/cdb_match.h | 9 +- indimail-mta-x/cdbdump.c | 7 +- indimail-mta-x/cdbget.c | 5 +- indimail-mta-x/cdbmake.c | 5 +- indimail-mta-x/cdbstats.c | 11 +- indimail-mta-x/cdbtest.c | 11 +- indimail-mta-x/checkaddr.c | 5 +- indimail-mta-x/checkdomain.c | 5 +- indimail-mta-x/chkspawn.c | 5 +- indimail-mta-x/cidr.c | 5 +- indimail-mta-x/cleanq.c | 9 +- indimail-mta-x/columnt.c | 5 +- indimail-mta-x/condredirect.c | 9 +- indimail-mta-x/condtomaildir.c | 7 +- indimail-mta-x/conf-cc-LINUX | 2 +- indimail-mta-x/control.c | 27 ++- indimail-mta-x/control.h | 22 +- indimail-mta-x/create_rpm | 44 ++-- indimail-mta-x/ctrlenv.c | 12 +- indimail-mta-x/custom_error.c | 7 +- indimail-mta-x/custom_error.h | 7 +- indimail-mta-x/delivery_rate.c | 7 +- indimail-mta-x/delivery_rate.h | 7 +- indimail-mta-x/dns.c | 13 +- indimail-mta-x/dns_text.c | 5 +- indimail-mta-x/dnsbl.c | 17 +- indimail-mta-x/dnsblcheck.c | 5 +- indimail-mta-x/dnscname.c | 5 +- indimail-mta-x/dnsdoe.c | 5 +- indimail-mta-x/dnsfq.c | 5 +- indimail-mta-x/dnsip.c | 5 +- indimail-mta-x/dnsmxip.c | 5 +- indimail-mta-x/dnsptr.c | 5 +- indimail-mta-x/dnstlsarr.c | 11 +- indimail-mta-x/dnstxt.c | 5 +- indimail-mta-x/do_cleanq.c | 5 +- indimail-mta-x/do_match.c | 9 +- indimail-mta-x/do_match.h | 4 +- indimail-mta-x/do_rate.c | 11 +- indimail-mta-x/do_rate.h | 9 +- indimail-mta-x/do_ripmime.c | 5 +- indimail-mta-x/do_scan.c | 11 +- indimail-mta-x/doc/ChangeLog | 2 + indimail-mta-x/dossl.c | 26 +- indimail-mta-x/dossl.h | 18 +- indimail-mta-x/dot-forward.c | 21 +- indimail-mta-x/drate.c | 27 ++- indimail-mta-x/envrules.c | 21 +- indimail-mta-x/envrules.h | 7 +- indimail-mta-x/estack.c | 108 --------- indimail-mta-x/etrn.c | 27 ++- indimail-mta-x/etrn.h | 5 +- indimail-mta-x/except.c | 5 +- indimail-mta-x/fastforward.c | 48 ++-- indimail-mta-x/filterit.h | 7 +- indimail-mta-x/filterit_sub.c | 41 ++-- indimail-mta-x/filterto.c | 7 +- indimail-mta-x/fmt_xpid.c | 5 +- indimail-mta-x/fmtqfn.c | 7 +- indimail-mta-x/fmtqfn.h | 5 +- indimail-mta-x/fn_handler.c | 11 +- indimail-mta-x/fn_handler.h | 5 +- indimail-mta-x/forward.c | 10 +- indimail-mta-x/generic.c | 7 +- indimail-mta-x/getDomainToken.c | 7 +- indimail-mta-x/getDomainToken.h | 7 +- indimail-mta-x/get_uid.c | 13 +- indimail-mta-x/getconf.c | 11 +- indimail-mta-x/getconf.h | 7 +- indimail-mta-x/getqueue.c | 9 +- indimail-mta-x/getqueue.h | 5 +- indimail-mta-x/gfrom.c | 5 +- indimail-mta-x/greylist.c | 16 +- indimail-mta-x/greylist.h | 5 +- indimail-mta-x/headerbody.c | 19 +- indimail-mta-x/hfield.c | 38 ++- indimail-mta-x/hfield.h | 9 +- indimail-mta-x/hostname.c | 5 +- indimail-mta-x/ifaddr.c | 5 +- indimail-mta-x/iftocc.c | 5 +- indimail-mta-x/iftoccfrom.c | 5 +- indimail-mta-x/indimail_stub.c | 15 +- indimail-mta-x/indimail_stub.h | 7 +- indimail-mta-x/inewaliases.c | 5 +- indimail-mta-x/installer.c | 9 +- indimail-mta-x/ip.c | 21 +- indimail-mta-x/ip.h | 11 +- indimail-mta-x/ipalloc.c | 5 +- indimail-mta-x/ipme.c | 7 +- indimail-mta-x/ipmeprint.c | 5 +- indimail-mta-x/ldap-checkpwd.c | 26 +- indimail-mta-x/leapsecs.c | 5 +- indimail-mta-x/load_mysql.c | 9 +- indimail-mta-x/load_mysql.h | 5 +- indimail-mta-x/mail_acl.c | 18 +- indimail-mta-x/mail_acl.h | 5 +- indimail-mta-x/maildir.c | 9 +- indimail-mta-x/maildir2mbox.c | 5 +- indimail-mta-x/maildir_deliver.c | 7 +- indimail-mta-x/maildir_deliver.h | 5 +- indimail-mta-x/maildirdeliver.c | 5 +- indimail-mta-x/maildirserial.c | 20 +- indimail-mta-x/maildirsize.c | 5 +- indimail-mta-x/mailfilter.c | 9 +- indimail-mta-x/mailfilter.h | 7 +- indimail-mta-x/matchup.c | 19 +- indimail-mta-x/mbox2maildir.c | 15 +- indimail-mta-x/mini-smtpd.c | 31 +-- indimail-mta-x/mkfn.c | 5 +- indimail-mta-x/mlmatchup.c | 9 +- indimail-mta-x/new-inject.c | 16 +- indimail-mta-x/newfield.c | 5 +- indimail-mta-x/newinclude.c | 5 +- indimail-mta-x/nowutc.c | 5 +- indimail-mta-x/ofmipd.c | 105 ++++---- indimail-mta-x/ofmipname.c | 5 +- indimail-mta-x/parsedate.c | 5 +- indimail-mta-x/pidopen.c | 10 +- indimail-mta-x/pidopen.h | 11 +- indimail-mta-x/plugtest.c | 20 +- indimail-mta-x/predate.c | 11 +- indimail-mta-x/preline.c | 7 +- indimail-mta-x/printass.c | 7 +- indimail-mta-x/printforward.c | 11 +- indimail-mta-x/printmaillist.c | 5 +- indimail-mta-x/prioq.c | 5 +- indimail-mta-x/process_queue.c | 9 +- indimail-mta-x/process_queue.h | 5 +- indimail-mta-x/qaes.c | 15 +- indimail-mta-x/qarf.c | 27 ++- indimail-mta-x/qbase64.c | 11 +- indimail-mta-x/qcat.c | 13 +- indimail-mta-x/qcount_dir.c | 13 +- indimail-mta-x/qcount_dir.h | 5 +- indimail-mta-x/qdane.c | 11 +- indimail-mta-x/qhpsi.c | 11 +- indimail-mta-x/qmail-cdb.c | 8 +- indimail-mta-x/qmail-clean.c | 9 +- indimail-mta-x/qmail-daned.c | 62 ++--- indimail-mta-x/qmail-direct.c | 17 +- indimail-mta-x/qmail-dkim.c | 49 ++-- indimail-mta-x/qmail-getpw.c | 8 +- indimail-mta-x/qmail-greyd.c | 70 +++--- indimail-mta-x/qmail-inject.c | 38 +-- indimail-mta-x/qmail-local.c | 58 ++--- indimail-mta-x/qmail-lspawn.c | 15 +- indimail-mta-x/qmail-multi.c | 9 +- indimail-mta-x/qmail-newu.c | 5 +- indimail-mta-x/qmail-nullqueue.c | 7 +- indimail-mta-x/qmail-popbull.c | 7 +- indimail-mta-x/qmail-poppass.c | 13 +- indimail-mta-x/qmail-pw2u.c | 12 +- indimail-mta-x/qmail-qfilter.c | 8 +- indimail-mta-x/qmail-qmqpc.c | 7 +- indimail-mta-x/qmail-qmqpd.c | 12 +- indimail-mta-x/qmail-qmtpd.c | 11 +- indimail-mta-x/qmail-qread.c | 9 +- indimail-mta-x/qmail-queue.c | 27 ++- indimail-mta-x/qmail-remote.c | 82 ++++--- indimail-mta-x/qmail-rm.c | 18 +- indimail-mta-x/qmail-rspawn.c | 9 +- indimail-mta-x/qmail-send.c | 51 ++-- indimail-mta-x/qmail-showctl.c | 41 ++-- indimail-mta-x/qmail-smtpd.c | 21 +- indimail-mta-x/qmail-spamfilter.c | 10 +- indimail-mta-x/qmail-sql.c | 14 +- indimail-mta-x/qmail-start.c | 33 +-- indimail-mta-x/qmail-tcpok.c | 5 +- indimail-mta-x/qmail-tcpto.c | 5 +- indimail-mta-x/qmail.c | 17 +- indimail-mta-x/qmail.h | 15 +- indimail-mta-x/qmaildirmake.c | 5 +- indimail-mta-x/qmaildirwatch.c | 5 +- indimail-mta-x/qmonitor.c | 9 +- indimail-mta-x/qmta-send.c | 65 ++--- indimail-mta-x/qmulti.c | 12 +- indimail-mta-x/qmulti.h | 11 +- indimail-mta-x/qnotify.c | 25 +- indimail-mta-x/qquote.c | 5 +- indimail-mta-x/qr_digest_md5.c | 7 +- indimail-mta-x/qr_digest_md5.h | 7 +- indimail-mta-x/qreceipt.c | 7 +- indimail-mta-x/qregex.c | 33 +-- indimail-mta-x/qregex.h | 7 +- indimail-mta-x/qscanq-stdin.c | 6 +- indimail-mta-x/qscanq.c | 7 +- indimail-mta-x/qscheduler.c | 30 ++- indimail-mta-x/qsmhook.c | 7 +- indimail-mta-x/qsutil.c | 17 +- indimail-mta-x/qsutil.h | 15 +- indimail-mta-x/query_skt.c | 14 +- indimail-mta-x/queue-fix.c | 47 ++-- indimail-mta-x/queue_load.c | 9 +- indimail-mta-x/queue_load.h | 2 +- indimail-mta-x/quote.c | 9 +- indimail-mta-x/quote.h | 7 +- indimail-mta-x/rcpthosts.c | 20 +- indimail-mta-x/rcpthosts.h | 5 +- indimail-mta-x/rd-remote.c | 22 +- indimail-mta-x/read_assign.c | 9 +- indimail-mta-x/read_assign.h | 4 +- indimail-mta-x/readsubdir.c | 7 +- indimail-mta-x/readsubdir.h | 7 +- indimail-mta-x/received.c | 14 +- indimail-mta-x/received.h | 5 +- indimail-mta-x/recipients.c | 7 +- indimail-mta-x/relaytest.c | 8 +- indimail-mta-x/remoteinfo.c | 5 +- indimail-mta-x/replier-config.c | 18 +- indimail-mta-x/replier.c | 12 +- indimail-mta-x/report.c | 7 +- indimail-mta-x/report.h | 7 +- indimail-mta-x/rewind.c | 5 +- indimail-mta-x/rpmattr.c | 5 +- indimail-mta-x/rrforward.c | 7 +- indimail-mta-x/rrt.c | 23 +- indimail-mta-x/run-cleanq.c | 5 +- indimail-mta-x/rwhconfig.c | 7 +- indimail-mta-x/send_qload.c | 9 +- indimail-mta-x/send_qload.h | 5 +- indimail-mta-x/sendmail.c | 15 +- indimail-mta-x/serialcmd.c | 11 +- indimail-mta-x/serialqmtp.c | 7 +- indimail-mta-x/serialsmtp.c | 7 +- indimail-mta-x/set_environment.c | 9 +- indimail-mta-x/set_environment.h | 5 +- indimail-mta-x/set_queuedir.c | 9 +- indimail-mta-x/set_queuedir.h | 5 +- indimail-mta-x/setforward.c | 14 +- indimail-mta-x/setmaillist.c | 9 +- indimail-mta-x/setqload.c | 13 +- indimail-mta-x/slowq-send.c | 65 ++--- indimail-mta-x/slowq-start.c | 26 +- indimail-mta-x/slurpclose.c | 5 +- indimail-mta-x/smtp_plugin.c | 9 +- indimail-mta-x/smtp_plugin.h | 9 +- indimail-mta-x/smtpd.c | 316 +++++++++++++------------ indimail-mta-x/socket_tcp.c | 5 +- indimail-mta-x/socket_tcp6.c | 5 +- indimail-mta-x/sorted.c | 5 +- indimail-mta-x/sortedtest.c | 5 +- indimail-mta-x/spawn-filter.c | 43 ++-- indimail-mta-x/spawn.c | 13 +- indimail-mta-x/spf.c | 62 ++--- indimail-mta-x/spf.h | 5 +- indimail-mta-x/spfquery.c | 11 +- indimail-mta-x/splogger.c | 5 +- indimail-mta-x/sql-database.c | 16 +- indimail-mta-x/sqlmatch.c | 22 +- indimail-mta-x/sqlmatch.h | 9 +- indimail-mta-x/srs.c | 9 +- indimail-mta-x/srs.h | 7 +- indimail-mta-x/srsfilter.c | 8 +- indimail-mta-x/sslerator.c | 11 +- indimail-mta-x/starttls.c | 31 +-- indimail-mta-x/starttls.h | 18 +- indimail-mta-x/strsalloc.c | 5 +- indimail-mta-x/strset.c | 21 +- indimail-mta-x/strset.h | 9 +- indimail-mta-x/surblfilter.c | 23 +- indimail-mta-x/syncdir.c | 5 +- indimail-mta-x/sys-checkpwd.c | 16 +- indimail-mta-x/tablematch.c | 18 +- indimail-mta-x/tablematch.h | 7 +- indimail-mta-x/tcp-env.c | 5 +- indimail-mta-x/tcpto.c | 5 +- indimail-mta-x/tcpto_clean.c | 5 +- indimail-mta-x/test-recipients.c | 8 +- indimail-mta-x/tests/test-indimail-mta | 2 +- indimail-mta-x/testzero.c | 5 +- indimail-mta-x/timeoutconn.c | 9 +- indimail-mta-x/tlsacheck.c | 12 +- indimail-mta-x/tlsarralloc.c | 5 +- indimail-mta-x/todo-proc.c | 40 ++-- indimail-mta-x/tokenize.c | 5 +- indimail-mta-x/trigger.c | 5 +- indimail-mta-x/triggerpull.c | 5 +- indimail-mta-x/typesx.h | 5 +- indimail-mta-x/uacl.c | 7 +- indimail-mta-x/udpclient.c | 9 +- indimail-mta-x/udplogger.c | 13 +- indimail-mta-x/variables.c | 11 +- indimail-mta-x/variables.h | 10 +- indimail-mta-x/whois.c | 13 +- indimail-mta-x/wildmat.c | 6 +- indimail-mta-x/wildmat.h | 7 +- indimail-mta-x/yearcal.c | 7 +- libdkim2-x/create_rpm | 48 ++-- libdkim2-x/dkim.cpp | 43 ++-- libdkim2-x/dkim.h | 11 +- libdkim2-x/dkimfuncs.cpp | 33 +-- libdkim2-x/dkimsign.cpp | 24 +- libdkim2-x/dkimsign.h | 11 +- libdkim2-x/dkimverify.cpp | 11 +- libdkim2-x/dns.cpp | 13 +- libdkim2-x/dns.h | 5 +- libdkim2-x/doc/ChangeLog | 2 + ucspi-tcp-x/Makefile | 12 +- ucspi-tcp-x/TARGETS | 5 + ucspi-tcp-x/addcr.c | 5 +- ucspi-tcp-x/argv0.c | 5 +- ucspi-tcp-x/conf-cc-LINUX | 2 +- ucspi-tcp-x/control.c | 17 +- ucspi-tcp-x/control.h | 7 +- ucspi-tcp-x/create_rpm | 46 ++-- ucspi-tcp-x/delcr.c | 5 +- ucspi-tcp-x/dlnamespace.c | 9 +- ucspi-tcp-x/dlnamespace.h | 5 +- ucspi-tcp-x/dns.h | 37 +-- ucspi-tcp-x/dns_dfd.c | 5 +- ucspi-tcp-x/dns_domain.c | 22 +- ucspi-tcp-x/dns_dtda.c | 5 +- ucspi-tcp-x/dns_ip.c | 9 +- ucspi-tcp-x/dns_name.c | 5 +- ucspi-tcp-x/dns_packet.c | 9 +- ucspi-tcp-x/dns_rcrw.c | 11 +- ucspi-tcp-x/dns_resolve.c | 5 +- ucspi-tcp-x/dns_transmit.c | 13 +- ucspi-tcp-x/dns_txt.c | 5 +- ucspi-tcp-x/doc/ChangeLog | 2 + ucspi-tcp-x/dotls.c | 35 ++- ucspi-tcp-x/fixcrio.c | 5 +- ucspi-tcp-x/installer.c | 9 +- ucspi-tcp-x/ip4.h | 5 +- ucspi-tcp-x/ip4_bit.c | 5 +- ucspi-tcp-x/ip4_scan.c | 5 +- ucspi-tcp-x/ip6.h | 7 +- ucspi-tcp-x/ip6_expandaddr.c | 5 +- ucspi-tcp-x/ip6_scan.c | 11 +- ucspi-tcp-x/load_mysql.c | 18 +- ucspi-tcp-x/load_mysql.h | 9 +- ucspi-tcp-x/load_shared.c | 26 +- ucspi-tcp-x/rblsmtpd.c | 21 +- ucspi-tcp-x/recordio.c | 7 +- ucspi-tcp-x/rules.c | 7 +- ucspi-tcp-x/rules.h | 5 +- ucspi-tcp-x/socket.h | 37 +-- ucspi-tcp-x/socket_accept.c | 5 +- ucspi-tcp-x/socket_acceptun.c | 7 +- ucspi-tcp-x/socket_bindun.c | 6 +- ucspi-tcp-x/socket_conn_un.c | 5 +- ucspi-tcp-x/socket_getifidx.c | 5 +- ucspi-tcp-x/socket_getifname.c | 7 +- ucspi-tcp-x/socket_local.c | 5 +- ucspi-tcp-x/socket_recv6.c | 62 ----- ucspi-tcp-x/socket_send6.c | 58 ----- ucspi-tcp-x/socket_tcp.c | 4 + ucspi-tcp-x/socket_unix.c | 4 + ucspi-tcp-x/tcdlmopen.c | 5 +- ucspi-tcp-x/tcpclient.c | 31 ++- ucspi-tcp-x/tcprulescheck.c | 11 +- ucspi-tcp-x/tcpserver.c | 59 ++--- ucspi-tcp-x/tcpserver_plugin.c | 11 +- ucspi-tcp-x/timeoutconn.h | 5 +- ucspi-tcp-x/timeoutconn_un.c | 5 +- ucspi-tcp-x/trypoll.c | 3 + ucspi-tcp-x/tryshsgr.c | 3 + ucspi-tcp-x/upathexec.h | 9 +- ucspi-tcp-x/upathexec_env.c | 5 +- ucspi-tcp-x/upathexec_run.c | 7 +- 419 files changed, 3290 insertions(+), 2376 deletions(-) delete mode 100644 indimail-mta-x/estack.c delete mode 100644 ucspi-tcp-x/socket_recv6.c delete mode 100644 ucspi-tcp-x/socket_send6.c diff --git a/daemontools-x/conf-cc-LINUX b/daemontools-x/conf-cc-LINUX index dec402b529..1562c775b6 100644 --- a/daemontools-x/conf-cc-LINUX +++ b/daemontools-x/conf-cc-LINUX @@ -1 +1 @@ --Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings -Wno-discarded-qualifiers +-Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings diff --git a/daemontools-x/create_rpm b/daemontools-x/create_rpm index 790a717c07..f80f0c1b09 100755 --- a/daemontools-x/create_rpm +++ b/daemontools-x/create_rpm @@ -1,5 +1,8 @@ #!/bin/sh # $Log: create_rpm,v $ +# Revision 1.6 2024-05-09 23:04:25+05:30 Cprogrammer +# use x.y for release +# # Revision 1.5 2022-10-04 23:47:04+05:30 Cprogrammer # use rpmlintrc from .config directory # @@ -16,7 +19,7 @@ # Initial revision # # -# $Id: create_rpm,v 1.5 2022-10-04 23:47:04+05:30 Cprogrammer Exp mbhangui $ +# $Id: create_rpm,v 1.6 2024-05-09 23:04:25+05:30 Cprogrammer Exp mbhangui $ # version=$(head -1 conf-version) @@ -166,28 +169,26 @@ fi dist=`uname -r |cut -d . -f4` if [ -z "$release" ] ; then if [ -f /usr/sbin/svscan ] ; then - idist=$(rpm -qf /usr/sbin/svscan|cut -d- -f3|cut -d. -f3) - if [ " $dist" = " $idist" ] ; then - iversion=$(rpm -qf /usr/sbin/svscan|cut -d- -f2) - if [ "$iversion" = "$version" ] ; then - release=$(rpm -qf /usr/sbin/svscan | cut -d- -f3 | cut -d. -f2) - release=$(expr $release + 1) - else - release=1 - fi + #idist=$(rpm -qf /usr/sbin/svscan|cut -d- -f3|rev|cut -d. -f2|rev) + dversion=$(rpm -qf /usr/sbin/svscan|cut -d- -f2) + if [ "$dversion" = "$version" ] ; then + t1=$(rpm -qf /usr/sbin/svscan | cut -d- -f3 | cut -d. -f1) + t2=$(rpm -qf /usr/sbin/svscan | cut -d- -f3 | cut -d. -f2) + t2=$(expr $t2 + 1) + release="$t1.$t2" else - release=1 + release=0.1 fi else - release=1 + release=0.1 fi fi -echo -n "Build RPM for daemontools-"$version"-1."$release" (Y/N) - " +echo -n "Build RPM for daemontools-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then tmprel=`cat daemontools-x/conf-release 2>/dev/null` - if [ ! " $tmprel" = " 1.$release" ] ; then - echo 1.$release > daemontools-x/conf-release + if [ ! " $tmprel" = " $release" ] ; then + echo $release > daemontools-x/conf-release cd daemontools-x make SYSTEM=$SYSTEM daemontools.spec cp daemontools.spec /tmp @@ -207,21 +208,21 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then fi if [ $? -eq 0 ] ; then /bin/rm -f /tmp/daemontools.spec - rpm --addsign $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"1.$release".$dist.$build_arch.rpm - rpm --addsign $rpmbuild/SRPMS/daemontools-"$version"-"1.$release".$dist.src.rpm - echo -n "RPM lint for daemontools-"$version"-1."$release" (Y/N) - " + rpm --addsign $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"$release".$dist.$build_arch.rpm + rpm --addsign $rpmbuild/SRPMS/daemontools-"$version"-"$release".$dist.src.rpm + echo -n "RPM lint for daemontools-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then ( - echo daemontools-"$version"-"1.$release".$dist.rpm + echo daemontools-"$version"-"$release".$dist.rpm if [ -f $HOME/.config/daemontools.rpmlintrc ] ; then - rpmlint -r $HOME/.config/daemontools.rpmlintrc $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"1.$release".$dist.$build_arch.rpm + rpmlint -r $HOME/.config/daemontools.rpmlintrc $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"$release".$dist.$build_arch.rpm else - rpmlint $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"1.$release".$dist.$build_arch.rpm + rpmlint $rpmbuild/RPMS/$build_arch/daemontools-"$version"-"$release".$dist.$build_arch.rpm fi echo ------------------------ - echo daemontools-"$version"-"1.$release".$dist.src.rpm - rpmlint $rpmbuild/SRPMS/daemontools-"$version"-"1.$release".$dist.src.rpm + echo daemontools-"$version"-"$release".$dist.src.rpm + rpmlint $rpmbuild/SRPMS/daemontools-"$version"-"$release".$dist.src.rpm echo ------------------------ ) 2>&1 | less fi diff --git a/daemontools-x/deepsleep.c b/daemontools-x/deepsleep.c index b41b937cba..8f8a8ab823 100644 --- a/daemontools-x/deepsleep.c +++ b/daemontools-x/deepsleep.c @@ -1,5 +1,8 @@ /* * $Log: deepsleep.c,v $ + * Revision 1.3 2024-05-09 22:40:04+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:24:17+05:30 Cprogrammer * added RCS id * @@ -33,7 +36,7 @@ deepsleep(unsigned int s) void getversion_deepsleep_c() { - static char *x = "$Id: deepsleep.c,v 1.2 2004-10-22 20:24:17+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: deepsleep.c,v 1.3 2024-05-09 22:40:04+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/doc/ChangeLog b/daemontools-x/doc/ChangeLog index 7b6c5713a4..38259fde43 100644 --- a/daemontools-x/doc/ChangeLog +++ b/daemontools-x/doc/ChangeLog @@ -13,6 +13,8 @@ Release @version@-@release@ Start 05/02/2024 End XX/XX/XXXX - 12/04/2024 07. daemontools.spec.in, debian/preinst.in: fixed logdir permissions 08. minisvc.in: fix for missing qmail group +- 09/05/2024 +09. fix discarded-qualifier compiler warnings * Sun Mar 03 2024 12:20:15 +0000 Manvendra Bhangui 1.1.4-1.1%{?dist} Release 1.1.4-1.1 Start 09/02/2024 End 03/02/2024 diff --git a/daemontools-x/envdir.c b/daemontools-x/envdir.c index 1643de7203..e50cda69e4 100644 --- a/daemontools-x/envdir.c +++ b/daemontools-x/envdir.c @@ -1,5 +1,8 @@ /* * $Log: envdir.c,v $ + * Revision 1.8 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -38,7 +41,7 @@ static char **orig_env; no_return void -die_usage(char *str) +die_usage(const char *str) { if (str) strerr_die3x(100, FATAL, str, "\nusage: envdir [-cwi] dir child"); @@ -49,7 +52,7 @@ die_usage(char *str) int main(int argc, char **argv) { - char *fn, *err = (char *) 0; + const char *fn, *err = (char *) 0; char **e; int i, opt, warn_on_error = 0, ignore_unreadable = 0, unreadable_count = 0; @@ -100,7 +103,7 @@ main(int argc, char **argv) void getversion_envdir_main_c() { - static char *x = "$Id: envdir.c,v 1.7 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: envdir.c,v 1.8 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/envuidgid.c b/daemontools-x/envuidgid.c index 5f04d43334..a90788e131 100644 --- a/daemontools-x/envuidgid.c +++ b/daemontools-x/envuidgid.c @@ -1,5 +1,8 @@ /* * $Log: envuidgid.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -64,7 +67,7 @@ main(int argc, char **argv) void getversion_envuidgid_c() { - static char *x = "$Id: envuidgid.c,v 1.4 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: envuidgid.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/fghack.c b/daemontools-x/fghack.c index 7d1046c357..389d6d3f56 100644 --- a/daemontools-x/fghack.c +++ b/daemontools-x/fghack.c @@ -1,5 +1,5 @@ /* - * $Id: fghack.c,v 1.6 2022-12-18 12:54:03+05:30 Cprogrammer Exp mbhangui $ + * $Id: fghack.c,v 1.7 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -93,13 +93,16 @@ main(int argc, char **argv, char **envp) void getversion_fghack_c() { - static char *x = "$Id: fghack.c,v 1.6 2022-12-18 12:54:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: fghack.c,v 1.7 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: fghack.c,v $ + * Revision 1.7 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2022-12-18 12:54:03+05:30 Cprogrammer * handle wait status with details * diff --git a/daemontools-x/inotify.c b/daemontools-x/inotify.c index 25ee57d1f8..44979c872b 100644 --- a/daemontools-x/inotify.c +++ b/daemontools-x/inotify.c @@ -1,5 +1,8 @@ /* * $Log: inotify.c,v $ + * Revision 1.12 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2022-01-30 09:53:48+05:30 Cprogrammer * added missing '/' in display * @@ -56,7 +59,7 @@ #define FATAL "inotify: fatal: " #define SELECTTIMEOUT 5 -char *usage = "usage: inotify [-n] path1..path2"; +const char *usage = "usage: inotify [-n] path1..path2"; int ifd, _soptind, _sargc; typedef struct inotify_dir { @@ -66,7 +69,7 @@ typedef struct inotify_dir { INOTIFY_DIR *wd; void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -103,7 +106,7 @@ main(int argc, char **argv) struct timeval *tptr; time_t last_timeout; char buffer[EVENT_BUF_LEN], strnum[FMT_ULONG]; - char *ptr; + const char *ptr; fd_set rfds; /*- File descriptor mask for select -*/ if (argc < 2) @@ -285,7 +288,7 @@ main(int argc, char **argv) void getversion_inotify_c() { - static char *x = "$Id: inotify.c,v 1.11 2022-01-30 09:53:48+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: inotify.c,v 1.12 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/installer.c b/daemontools-x/installer.c index 2054709e01..33f9199ad0 100644 --- a/daemontools-x/installer.c +++ b/daemontools-x/installer.c @@ -1,5 +1,5 @@ /* - * $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $ + * $Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * taken from ezmlm-0.54 */ #include @@ -64,7 +64,7 @@ get_octal(mode_t mode) } void -print_info(const char *str, char *source, char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) +print_info(const char *str, const char *source, const char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) { struct passwd *pw; struct group *gr; @@ -669,7 +669,7 @@ main(int argc, char **argv) void getversion_installer_c() { - static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $"; + static const char *x = "$Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -677,6 +677,9 @@ getversion_installer_c() /* * $Log: installer.c,v $ + * Revision 1.27 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer * fixed displaying size variable * fixed allocation of zerobuf variable diff --git a/daemontools-x/logselect.c b/daemontools-x/logselect.c index aafe2a3a00..3aa2ea208f 100644 --- a/daemontools-x/logselect.c +++ b/daemontools-x/logselect.c @@ -1,5 +1,8 @@ /* * $Log: logselect.c,v $ + * Revision 1.3 2024-05-09 22:40:04+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -237,7 +240,7 @@ main(int argc, char **argv) void getversion_logselect_c() { - static char *x = "$Id: logselect.c,v 1.2 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: logselect.c,v 1.3 2024-05-09 22:40:04+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/match.c b/daemontools-x/match.c index 88e1070fb0..ebfb54e4c5 100644 --- a/daemontools-x/match.c +++ b/daemontools-x/match.c @@ -1,5 +1,8 @@ /* * $Log: match.c,v $ + * Revision 1.3 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:27:16+05:30 Cprogrammer * added RCS id * @@ -47,7 +50,7 @@ match(char *pattern, char *buf, unsigned int len) void getversion_match_c() { - static char *x = "$Id: match.c,v 1.2 2004-10-22 20:27:16+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: match.c,v 1.3 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/multilog.c b/daemontools-x/multilog.c index 2f686cdcee..fdad85a548 100644 --- a/daemontools-x/multilog.c +++ b/daemontools-x/multilog.c @@ -1,5 +1,5 @@ /* - * $Id: multilog.c,v 1.9 2024-02-18 08:42:01+05:30 Cprogrammer Exp mbhangui $ + * $Id: multilog.c,v 1.10 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -37,14 +37,14 @@ mode_t old_umask; static int f_sync; void -pause3(char *s1, char *s2, char *s3) +pause3(const char *s1, const char *s2, const char *s3) { strerr_warn4(WARNING, s1, s2, s3, &strerr_sys); deepsleep(5); } void -pause5(char *s1, char *s2, char *s3, char *s4, char *s5) +pause5(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5) { strerr_warn6(WARNING, s1, s2, s3, s4, s5, &strerr_sys); deepsleep(5); @@ -149,7 +149,7 @@ filesfit(struct cyclog *d) } void -finish(struct cyclog *d, char *file, char *code) +finish(struct cyclog *d, const char *file, const char *code) { struct stat st; #ifdef HASUNLINKAT @@ -227,8 +227,8 @@ startprocessor(struct cyclog *d) return; if (fd_move(5, fd) == -1) return; - args[0] = "sh"; - args[1] = "-c"; + args[0] = (char *) "sh"; + args[1] = (char *) "-c"; args[2] = d->processor; args[3] = 0; execve("/bin/sh", args, environ); @@ -689,13 +689,16 @@ main(int argc, char **argv) void getversion_multilog_c() { - static char *x = "$Id: multilog.c,v 1.9 2024-02-18 08:42:01+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: multilog.c,v 1.10 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: multilog.c,v $ + * Revision 1.10 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2024-02-18 08:42:01+05:30 Cprogrammer * use unlinkat() if available instead of unlink() * diff --git a/daemontools-x/multipipe.c b/daemontools-x/multipipe.c index b9f9c6094c..6f6d07ad73 100644 --- a/daemontools-x/multipipe.c +++ b/daemontools-x/multipipe.c @@ -1,5 +1,8 @@ /* * $Log: multipipe.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-10-08 12:07:42+05:30 Cprogrammer * formatted code * @@ -401,7 +404,7 @@ main(int argc, char **argv) void getversion_multipipe_c() { - static char *x = "$Id: multipipe.c,v 1.4 2020-10-08 12:07:42+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: multipipe.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/pgrphack.c b/daemontools-x/pgrphack.c index 21953eee00..5369d094a3 100644 --- a/daemontools-x/pgrphack.c +++ b/daemontools-x/pgrphack.c @@ -1,5 +1,8 @@ /* * $Log: pgrphack.c,v $ + * Revision 1.3 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:27:56+05:30 Cprogrammer * added RCS id * @@ -28,7 +31,7 @@ main(int argc, char **argv, char **envp) void getversion_pgrphack_c() { - static char *x = "$Id: pgrphack.c,v 1.2 2004-10-22 20:27:56+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: pgrphack.c,v 1.3 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/qfilelog.c b/daemontools-x/qfilelog.c index 46581d39ae..c3c615e9d6 100644 --- a/daemontools-x/qfilelog.c +++ b/daemontools-x/qfilelog.c @@ -1,5 +1,8 @@ /* * $Log: qfilelog.c,v $ + * Revision 1.6 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -161,7 +164,7 @@ main(int argc, char *argv[]) void getversion_qfilelog_c() { - static char *x = "$Id: qfilelog.c,v 1.5 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qfilelog.c,v 1.6 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/readproctitle.c b/daemontools-x/readproctitle.c index 1971dc207f..1350501b85 100644 --- a/daemontools-x/readproctitle.c +++ b/daemontools-x/readproctitle.c @@ -1,5 +1,8 @@ /* * $Log: readproctitle.c,v $ + * Revision 1.3 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:29:53+05:30 Cprogrammer * added RCS id * @@ -49,7 +52,7 @@ main(int argc, char **argv) void getversion_readproctitle_c() { - static char *x = "$Id: readproctitle.c,v 1.2 2004-10-22 20:29:53+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: readproctitle.c,v 1.3 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/run_init.c b/daemontools-x/run_init.c index a18b80152b..523125582d 100644 --- a/daemontools-x/run_init.c +++ b/daemontools-x/run_init.c @@ -1,5 +1,8 @@ /* * $Log: run_init.c,v $ + * Revision 1.8 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-03-04 13:35:55+05:30 Cprogrammer * return -1 for name too long * @@ -41,7 +44,8 @@ int run_init(char *service_dir) { - char *run_dir, *p, *s; + const char *run_dir; + char *p, *s; char buf[256], dirbuf[256]; int i; @@ -141,7 +145,7 @@ run_init(char *service_dir) void getversion_svrun_c() { - static char *x = "$Id: run_init.c,v 1.7 2023-03-04 13:35:55+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: run_init.c,v 1.8 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/setlock.c b/daemontools-x/setlock.c index e6e44fc6db..ce1e9ac396 100644 --- a/daemontools-x/setlock.c +++ b/daemontools-x/setlock.c @@ -1,5 +1,8 @@ /* * $Log: setlock.c,v $ + * Revision 1.4 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -78,7 +81,7 @@ main(int argc, char **argv, char **envp) void getversion_setlock_c() { - static char *x = "$Id: setlock.c,v 1.3 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: setlock.c,v 1.4 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/setuidgid.c b/daemontools-x/setuidgid.c index 5b228294f6..5270ec6bf7 100644 --- a/daemontools-x/setuidgid.c +++ b/daemontools-x/setuidgid.c @@ -1,5 +1,5 @@ /* - * $Id: setuidgid.c,v 1.8 2023-02-21 01:06:12+05:30 Cprogrammer Exp mbhangui $ + * $Id: setuidgid.c,v 1.9 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -25,8 +25,8 @@ main(int argc, char **argv, char **envp) struct passwd *pw; struct group *gr; gid_t *gidset = (gid_t *) NULL, g; - char *ptr, *cptr, *account, *groups = 0, - *usage = "usage: setuidgid [-s] [-g gid_list] account child"; + char *ptr, *cptr, *account, *groups = 0; + const char *usage = "usage: setuidgid [-s] [-g gid_list] account child"; char **child; int i, ngroups = 0, opt, old; @@ -102,13 +102,16 @@ main(int argc, char **argv, char **envp) void getversion_setuidgid_c() { - static char *x = "$Id: setuidgid.c,v 1.8 2023-02-21 01:06:12+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: setuidgid.c,v 1.9 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: setuidgid.c,v $ + * Revision 1.9 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2023-02-21 01:06:12+05:30 Cprogrammer * re-allocate gidset to actual size * diff --git a/daemontools-x/softlimit.c b/daemontools-x/softlimit.c index fbd809f1fe..288338f670 100644 --- a/daemontools-x/softlimit.c +++ b/daemontools-x/softlimit.c @@ -1,5 +1,8 @@ /* * $Log: softlimit.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2022-02-25 09:51:51+05:30 Cprogrammer * added option to set message queue limit * use -1 to set resource limit as unlimited @@ -164,7 +167,7 @@ main(int argc, char **argv, char **envp) void getversion_softlimit_c() { - static char *x = "$Id: softlimit.c,v 1.4 2022-02-25 09:51:51+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: softlimit.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/sorted.c b/daemontools-x/sorted.c index ac470daaa5..4384d8b061 100644 --- a/daemontools-x/sorted.c +++ b/daemontools-x/sorted.c @@ -1,5 +1,8 @@ /* * $Log: sorted.c,v $ + * Revision 1.4 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-11-23 00:17:54+05:30 Cprogrammer * removed supression of ANSI C proto for alloc() * @@ -56,7 +59,7 @@ sorted_insert(sl, sa) void getversion_sorted_c() { - static char *x = "$Id: sorted.c,v 1.3 2020-11-23 00:17:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sorted.c,v 1.4 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/spipe.c b/daemontools-x/spipe.c index 16a80130fe..bbf43dfa3a 100644 --- a/daemontools-x/spipe.c +++ b/daemontools-x/spipe.c @@ -1,5 +1,8 @@ /* * $Log: spipe.c,v $ + * Revision 1.6 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -165,7 +168,7 @@ main(int argc, char **argv) void getversion_spipe_c() { - static char *x = "$Id: spipe.c,v 1.5 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: spipe.c,v 1.6 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/supervise.c b/daemontools-x/supervise.c index fa352e923b..b64369bbfa 100644 --- a/daemontools-x/supervise.c +++ b/daemontools-x/supervise.c @@ -1,4 +1,4 @@ -/*- $Id: supervise.c,v 1.40 2024-04-01 18:21:40+05:30 Cprogrammer Exp mbhangui $ */ +/*- $Id: supervise.c,v 1.41 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $ */ #include #include #include @@ -118,7 +118,7 @@ announce(short sleep_interval) } static void -do_kill(int prgrp, int *siglist, char **signame) +do_kill(int prgrp, int *siglist, const char **signame) { int *i; int j, r; @@ -159,7 +159,7 @@ static void sigterm() { int siglist[] = {-1, -1, -1}; - char *signame[] = {0, 0}, *p; + const char *signame[] = {0, 0}, *p; static int got_term; flagexit = 1; @@ -243,9 +243,9 @@ get_wait_params(unsigned short *interval, char **sv_name) return 0; } -char *run[3] = { "./run", 0 , 0}; -char *shutdown[4] = { "./shutdown", 0, 0, 0}; /*- ./shutdown, pid, dir, parent_id, NULL */ -char *alert[6] = { "./alert", 0, 0, 0, 0, 0 }; /*- ./alert, alert pid, child_exit_value, signal_value, dir, parent_id, NULL */ +const char *run[3] = { "./run", 0 , 0}; +const char *shutdown[4] = { "./shutdown", 0, 0, 0}; /*- ./shutdown, pid, dir, parent_id, NULL */ +const char *alert[6] = { "./alert", 0, 0, 0, 0, 0 }; /*- ./alert, alert pid, child_exit_value, signal_value, dir, parent_id, NULL */ void do_wait() @@ -406,7 +406,7 @@ trystart() if (!env_put2("PPID", strnum1)) strerr_die2x(111, fatal.s, "trystart: out of memory"); run[1] = dir; - execve(*run, run, environ); + execve(*run, (char **) run, environ); strerr_die2sys(111, fatal.s, "unable to start run: "); } grandchild = 0; @@ -429,7 +429,7 @@ trystart() } void -tryaction(char **action, pid_t cpid, int wstat, int do_alert) +tryaction(const char **action, pid_t cpid, int wstat, int do_alert) { pid_t f; int t, i; @@ -476,7 +476,7 @@ tryaction(char **action, pid_t cpid, int wstat, int do_alert) action[2] = dir; action[3] = NULL; } - execve(*action, action, environ); + execve(*action, (char **) action, environ); strerr_die4sys(111, fatal.s, "unable to exec ", *action, ": "); default: wait_pid(&t, f); @@ -515,7 +515,7 @@ doit() { iopause_fd x[2]; int siglist[] = {-1, -1, -1}; - char *signame[] = {0, 0}; + const char *signame[] = {0, 0}; struct taia deadline; struct taia stamp; static int double_fork_flag; @@ -831,11 +831,11 @@ doit() #ifdef USE_RUNFS void -cleanup(char *d) +cleanup(const char *d) { - char *sv_files[] = { "control", "lock", "ok", "status", "up", 0}; - char *sv_dirs[] = {"supervise", "log/supervise", 0}; - char **p, **q; + const char *sv_files[] = { "control", "lock", "ok", "status", "up", 0}; + const char *sv_dirs[] = {"supervise", "log/supervise", 0}; + const char **p, **q; int l; stralloc tmp = {0}; @@ -860,7 +860,7 @@ cleanup(char *d) } int -qchown(char *name, uid_t uid, gid_t gid) +qchown(const char *name, uid_t uid, gid_t gid) { int fd; @@ -875,9 +875,9 @@ qchown(char *name, uid_t uid, gid_t gid) } void -initialize_run(char *service_dir, mode_t mode, uid_t own, gid_t grp) +initialize_run(const char *service_dir, mode_t mode, uid_t own, gid_t grp) { - char *run_dir, *parent_dir = (char *) 0; + const char *run_dir, *parent_dir = (char *) 0; int i; if (env_get("DISABLE_RUN")) { @@ -1135,13 +1135,16 @@ main(int argc, char **argv) void getversion_supervise_c() { - static char *x = "$Id: supervise.c,v 1.40 2024-04-01 18:21:40+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: supervise.c,v 1.41 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: supervise.c,v $ + * Revision 1.41 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.40 2024-04-01 18:21:40+05:30 Cprogrammer * set PPID env variable for child * added comments, updated variable name for flagwant, spid arg diff --git a/daemontools-x/svc.c b/daemontools-x/svc.c index d76e62c2b5..0ffea7d8f8 100644 --- a/daemontools-x/svc.c +++ b/daemontools-x/svc.c @@ -1,5 +1,8 @@ /* * $Log: svc.c,v $ + * Revision 1.11 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-03-04 14:42:52+05:30 Cprogrammer * check for supervise/ok in original service dir before run filesystem * @@ -144,7 +147,7 @@ main(int argc, char **argv) void getversion_svc_c() { - static char *x = "$Id: svc.c,v 1.10 2023-03-04 14:42:52+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: svc.c,v 1.11 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/svcfns.c b/daemontools-x/svcfns.c index 78a6dc15ae..daad72d285 100644 --- a/daemontools-x/svcfns.c +++ b/daemontools-x/svcfns.c @@ -1,5 +1,8 @@ /* * $Log: svcfns.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -129,7 +132,7 @@ stop_supervise(const char *dir, pid_t svcpid) void getversion_svcfns_c() { - static char *x = "$Id: svcfns.c,v 1.4 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: svcfns.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/svok.c b/daemontools-x/svok.c index 8edfabf021..3d1b9fd59b 100644 --- a/daemontools-x/svok.c +++ b/daemontools-x/svok.c @@ -1,5 +1,8 @@ /* * $Log: svok.c,v $ + * Revision 1.7 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2023-03-04 14:40:57+05:30 Cprogrammer * check for supervise/ok in original service dir before run filesystem * @@ -77,7 +80,7 @@ main(int argc, char **argv) void getversion_svok_c() { - static char *x = "$Id: svok.c,v 1.6 2023-03-04 14:40:57+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: svok.c,v 1.7 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/svscan.c b/daemontools-x/svscan.c index 0a74f7e39d..22cabff773 100644 --- a/daemontools-x/svscan.c +++ b/daemontools-x/svscan.c @@ -1,5 +1,5 @@ /* - * $Id: svscan.c,v 1.34 2024-03-01 15:45:09+05:30 Cprogrammer Exp mbhangui $ + * $Id: svscan.c,v 1.35 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -38,8 +38,9 @@ #define SVSCANINFO ".svscan" /* must begin with dot ('.') */ #endif -int rename(char *, const char *); +int rename(const char *, const char *); +typedef const char c_char; struct { unsigned long dev; @@ -55,7 +56,7 @@ static int numx = 0, scannow = 0, auto_scan = 0, use_run = 1, verbose = 0, silent = 0, sess_leader = 0; static char fnlog[260]; static char fntmp[260]; -static char *pidfile, *p_exe_name, *run_dir; +static c_char *pidfile, *p_exe_name, *run_dir; static stralloc tmp = {0}; #ifdef USE_RUNFS @@ -122,12 +123,13 @@ terminate(char *pidstr, time_t starttime, unsigned int w1, } void -init_cmd(char *cmmd, int shutdown) +init_cmd(const char *cmmd, int shutdown) { int child, r, wstat, did_kill = 0, do_wait, i; unsigned int w1, w2; pid_t pid; - char *cpath, *p, *terminate_session, *args[4]; + const char *cpath; + char *p, *terminate_session, *args[4]; char strnum[FMT_ULONG]; time_t starttime; @@ -146,9 +148,9 @@ init_cmd(char *cmmd, int shutdown) case 0: if (shutdown) sig_block(sig_term); - args[0] = "/bin/sh"; - args[1] = "-c"; - args[2] = cpath; + args[0] = (char *) "/bin/sh"; + args[1] = (char *) "-c"; + args[2] = (char *) cpath; args[3] = 0; if (!env_put2("PPID", strnum)) strerr_die3x(111, WARN, cpath, "init_cmd: out of memory"); @@ -221,7 +223,7 @@ init_cmd(char *cmmd, int shutdown) } int -sv_control(char *service_name, char *fn, char *command) +sv_control(const char *service_name, const char *fn, const char *command) { int fd; char bspace[1]; @@ -262,7 +264,7 @@ sv_control(char *service_name, char *fn, char *command) } void -start(char *fn, char *sdir) +start(const char *fn, const char *sdir) { unsigned int fnlen, t1, t2; struct stat st; @@ -411,8 +413,8 @@ start(char *fn, char *sdir) if (x[i].flaglog) if (fd_move(1, x[i].pi[1]) == -1) strerr_die4sys(111, WARN, "unable to set up descriptors for ", fn, ": "); - args[0] = "supervise"; - args[1] = fn; + args[0] = (char *) "supervise"; + args[1] = (char *) fn; args[2] = 0; strnum[fmt_ulong(strnum, pid)] = 0; if (!env_put2("PPID", strnum)) @@ -519,9 +521,9 @@ start(char *fn, char *sdir) strerr_die4sys(111, WARN, "unable to switch to ", fn, ": "); if (!env_put2("SV_PWD", fn)) strerr_die4x(111, WARN, "out of memory for ", fn, "/log"); - args[0] = "supervise"; - args[1] = "log"; - args[2] = fn; + args[0] = (char *) "supervise"; + args[1] = (char *) "log"; + args[2] = (char *) fn; args[3] = 0; strnum[fmt_ulong(strnum, pid)] = 0; if (!env_put2("PPID", strnum)) @@ -956,13 +958,16 @@ main(int argc, char **argv) void getversion_svscan_c() { - static char *y = "$Id: svscan.c,v 1.34 2024-03-01 15:45:09+05:30 Cprogrammer Exp mbhangui $"; + const char *y = "$Id: svscan.c,v 1.35 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; y++; } /* * $Log: svscan.c,v $ + * Revision 1.35 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.34 2024-03-01 15:45:09+05:30 Cprogrammer * send SIGTERM twice followed by SIGKILL to terminate logging and then all remaining processes * diff --git a/daemontools-x/svstat.c b/daemontools-x/svstat.c index 6fbd5ba583..527ce732f8 100644 --- a/daemontools-x/svstat.c +++ b/daemontools-x/svstat.c @@ -1,5 +1,8 @@ /* * $Log: svstat.c,v $ + * Revision 1.12 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-03-04 14:43:01+05:30 Cprogrammer * check for supervise/ok in original service dir before run filesystem * @@ -66,7 +69,7 @@ doit(char *dir, int *retval) struct stat st; int r, fd = -1; short *s; - char *x; + const char *x; struct tai when, now; *retval = 111; @@ -243,7 +246,7 @@ main(int argc, char **argv) void getversion_svstat_c() { - static char *x = "$Id: svstat.c,v 1.11 2023-03-04 14:43:01+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: svstat.c,v 1.12 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/tai2tai64n.c b/daemontools-x/tai2tai64n.c index 43eb67945f..7dd182fbfb 100644 --- a/daemontools-x/tai2tai64n.c +++ b/daemontools-x/tai2tai64n.c @@ -3,6 +3,9 @@ * Copyright (C) 2000 Bruce Guenter * * $Log: tai2tai64n.c,v $ + * Revision 1.3 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-08-30 12:04:53+05:30 Cprogrammer * define funtions as noreturn * @@ -45,14 +48,14 @@ static char sserrbuf[512]; static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof (sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -61,7 +64,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -75,7 +78,7 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s, int len) +my_puts(const char *s, int len) { if (len) { if (substdio_put(&ssout, s, len) == -1) @@ -123,7 +126,7 @@ main(int argc, char **argv) void getversion_tai2tai64n_c() { - static char *x = "$Id: tai2tai64n.c,v 1.2 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tai2tai64n.c,v 1.3 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/tai64n.c b/daemontools-x/tai64n.c index 134712d341..86eed1f31e 100644 --- a/daemontools-x/tai64n.c +++ b/daemontools-x/tai64n.c @@ -1,5 +1,8 @@ /* * $Log: tai64n.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2008-07-15 19:54:22+05:30 Cprogrammer * porting for Mac OS X * @@ -73,7 +76,7 @@ main() void getversion_tai64n_c() { - static char *x = "$Id: tai64n.c,v 1.4 2008-07-15 19:54:22+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: tai64n.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/tai64n2tai.c b/daemontools-x/tai64n2tai.c index 980382e6c9..1bf28f2a64 100644 --- a/daemontools-x/tai64n2tai.c +++ b/daemontools-x/tai64n2tai.c @@ -37,14 +37,14 @@ static char sserrbuf[512]; static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -53,7 +53,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -67,7 +67,7 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s, int len) +my_puts(const char *s, int len) { if (len) { if (substdio_put(&ssout, s, len) == -1) @@ -113,7 +113,7 @@ main(int argc, char **argv) void getversion_tai64n2tai_c() { - static char *x = "$Id: tai64n2tai.c,v 1.3 2021-08-30 12:04:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tai64n2tai.c,v 1.4 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/tai64nlocal.c b/daemontools-x/tai64nlocal.c index 3cc08c5887..b5e97a4193 100644 --- a/daemontools-x/tai64nlocal.c +++ b/daemontools-x/tai64nlocal.c @@ -1,5 +1,8 @@ /* * $Log: tai64nlocal.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2014-03-18 17:37:46+05:30 Cprogrammer * fixed SIGSEGV * @@ -37,7 +40,7 @@ get(char *ch) } void -out(char *buf, int len) +out(const char *buf, int len) { if (substdio_put(subfdout, buf, len) == -1) _exit(111); @@ -107,7 +110,7 @@ main() void getversion_tai64nlocal_c() { - static char *x = "$Id: tai64nlocal.c,v 1.4 2014-03-18 17:37:46+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: tai64nlocal.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/tai64nunix.c b/daemontools-x/tai64nunix.c index aa4f11fee9..c6cafaef1d 100644 --- a/daemontools-x/tai64nunix.c +++ b/daemontools-x/tai64nunix.c @@ -1,5 +1,8 @@ /* * $Log: tai64nunix.c,v $ + * Revision 1.5 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2014-03-18 17:37:56+05:30 Cprogrammer * fixed issue with tai timestamp with non-whitespace after 25 characters * @@ -35,7 +38,7 @@ get(char *ch) } void -out(char *buf, int len) +out(const char *buf, int len) { if (substdio_put(subfdout, buf, len) == -1) _exit(111); @@ -94,7 +97,7 @@ main() void getversion_tai64nunix_c() { - static char *x = "$Id: tai64nunix.c,v 1.4 2014-03-18 17:37:56+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: tai64nunix.c,v 1.5 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/daemontools-x/teepipe.c b/daemontools-x/teepipe.c index c9c81673bf..b41a50b4bf 100644 --- a/daemontools-x/teepipe.c +++ b/daemontools-x/teepipe.c @@ -1,5 +1,8 @@ /* * $Log: teepipe.c,v $ + * Revision 1.7 2024-05-09 22:39:36+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2022-09-03 22:24:33+05:30 Cprogrammer * refactored teepipe * @@ -103,7 +106,7 @@ main(int argc, char **argv) void getversion_teepipe_c() { - static char *x = "$Id: teepipe.c,v 1.6 2022-09-03 22:24:33+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: teepipe.c,v 1.7 2024-05-09 22:39:36+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822addr.c b/indimail-mta-x/822addr.c index 97ed4b70b0..7d1ff64400 100644 --- a/indimail-mta-x/822addr.c +++ b/indimail-mta-x/822addr.c @@ -1,5 +1,8 @@ /* * $Log: 822addr.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:19:16+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -110,7 +113,7 @@ main(int argc, char **argv) void getversion_822addr_c() { - static char *x = "$Id: 822addr.c,v 1.5 2024-01-23 01:19:16+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822addr.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822body.c b/indimail-mta-x/822body.c index ede362faef..a2389ebcc9 100644 --- a/indimail-mta-x/822body.c +++ b/indimail-mta-x/822body.c @@ -1,5 +1,8 @@ /* * $Log: 822body.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:19:48+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -71,7 +74,7 @@ main(int argc, char **argv) void getversion_822body_c() { - static char *x = "$Id: 822body.c,v 1.5 2024-01-23 01:19:48+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822body.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822bodyfilter.c b/indimail-mta-x/822bodyfilter.c index 52699d582b..04263273c8 100644 --- a/indimail-mta-x/822bodyfilter.c +++ b/indimail-mta-x/822bodyfilter.c @@ -1,5 +1,8 @@ /* * $Log: 822bodyfilter.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2024-01-23 01:19:54+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -92,7 +95,7 @@ main(int argc, char **argv, char **envp) void getversion_822bodyfilter_c() { - static char *x = "$Id: 822bodyfilter.c,v 1.4 2024-01-23 01:19:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822bodyfilter.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822date.c b/indimail-mta-x/822date.c index eb0e9c9dda..f346a08c51 100644 --- a/indimail-mta-x/822date.c +++ b/indimail-mta-x/822date.c @@ -1,5 +1,8 @@ /* * $Log: 822date.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2023-01-03 16:27:08+05:30 Cprogrammer * removed auto_sysconfdir.h dependency * @@ -129,7 +132,7 @@ main(int argc, char **argv) void getversion_822date_c() { - static char *x = "$Id: 822date.c,v 1.12 2023-01-03 16:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822date.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822field.c b/indimail-mta-x/822field.c index 6d65f689f8..5c3d1b4a9f 100644 --- a/indimail-mta-x/822field.c +++ b/indimail-mta-x/822field.c @@ -1,5 +1,8 @@ /* * $Log: 822field.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -80,7 +83,7 @@ main(int argc, char **argv) void getversion_822field_c() { - static char *x = "$Id: 822field.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822field.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822fields.c b/indimail-mta-x/822fields.c index d0abf4e499..707b46b088 100644 --- a/indimail-mta-x/822fields.c +++ b/indimail-mta-x/822fields.c @@ -1,5 +1,8 @@ /* * $Log: 822fields.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:20:03+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -110,7 +113,7 @@ main(int argc, char **argv) void getversion_822fields_c() { - static char *x = "$Id: 822fields.c,v 1.5 2024-01-23 01:20:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822fields.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822header.c b/indimail-mta-x/822header.c index 51732961bb..8a6dcdd1dc 100644 --- a/indimail-mta-x/822header.c +++ b/indimail-mta-x/822header.c @@ -1,5 +1,8 @@ /* * $Log: 822header.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2022-10-30 17:54:57+05:30 Cprogrammer * converted to ansic prototype * @@ -134,7 +137,7 @@ main(int argc, char **argv) void getversion_822header_c() { - static char *x = "$Id: 822header.c,v 1.8 2022-10-30 17:54:57+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822header.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822headerfilter.c b/indimail-mta-x/822headerfilter.c index 021fbf05ad..330be4f6d2 100644 --- a/indimail-mta-x/822headerfilter.c +++ b/indimail-mta-x/822headerfilter.c @@ -1,5 +1,8 @@ /* * $Log: 822headerfilter.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:20:09+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -104,7 +107,7 @@ main(int argc, char **argv, char **envp) void getversion_822headerfilter_c() { - static char *x = "$Id: 822headerfilter.c,v 1.5 2024-01-23 01:20:09+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822headerfilter.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822headerok.c b/indimail-mta-x/822headerok.c index 8038c23ea9..72e71720ed 100644 --- a/indimail-mta-x/822headerok.c +++ b/indimail-mta-x/822headerok.c @@ -1,5 +1,8 @@ /* * $Log: 822headerok.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:20:14+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -52,7 +55,7 @@ main(int argc, char **argv) void getversion_822headerok_c() { - static char *x = "$Id: 822headerok.c,v 1.5 2024-01-23 01:20:14+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822headerok.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822print.c b/indimail-mta-x/822print.c index 81ad9ecb2c..112283a022 100644 --- a/indimail-mta-x/822print.c +++ b/indimail-mta-x/822print.c @@ -1,5 +1,8 @@ /* * $Log: 822print.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-01-03 16:27:35+05:30 Cprogrammer * removed auto_sysconfdir.h dependency * @@ -59,7 +62,7 @@ putspaces(int len) } void -putformat(char *buf, unsigned int len) +putformat(const char *buf, unsigned int len) { while (len > 1) { switch (*buf++) @@ -78,7 +81,7 @@ putformat(char *buf, unsigned int len) } void -format(stralloc *out, char *buf, int len, char *pre, char *style1, char *style2) +format(stralloc *out, const char *buf, int len, const char *pre, const char *style1, const char *style2) { char ch; char ch2; @@ -186,7 +189,7 @@ doleftright() } void -putvalue(stralloc *a, char *pre) +putvalue(stralloc *a, const char *pre) { int j; @@ -214,7 +217,7 @@ putfields(stralloc *a) } void -putaddr(stralloc *a, char *pre, char *post, char *style) +putaddr(stralloc *a, const char *pre, const char *post, const char *style) { int i; int j; @@ -429,7 +432,7 @@ main() void getversion_822print_c() { - static char *x = "$Id: 822print.c,v 1.9 2023-01-03 16:27:35+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822print.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/822received.c b/indimail-mta-x/822received.c index 54d42dfe2e..8df57c73e4 100644 --- a/indimail-mta-x/822received.c +++ b/indimail-mta-x/822received.c @@ -1,5 +1,8 @@ /* * $Log: 822received.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-01-03 16:27:51+05:30 Cprogrammer * removed auto_sysconfdir.h dependency * @@ -220,7 +223,7 @@ main(int argc, char **argv) void getversion_822received_c() { - static char *x = "$Id: 822received.c,v 1.11 2023-01-03 16:27:51+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: 822received.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/Makefile b/indimail-mta-x/Makefile index aa3593cc1f..92267032a6 100644 --- a/indimail-mta-x/Makefile +++ b/indimail-mta-x/Makefile @@ -259,8 +259,8 @@ auto_uids.h: conf-users conf-groups echo "extern int auto_gidc; /* certs access user */" ;\ echo ""; \ echo "int uidinit(int, int);"; \ - echo "char *get_user(uid_t);"; \ - echo "char *get_group(gid_t);"; \ + echo "const char *get_user(uid_t);"; \ + echo "const char *get_group(gid_t);"; \ echo ""; \ echo "#endif"; \ ) > auto_uids.h @@ -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) diff --git a/indimail-mta-x/TARGETS b/indimail-mta-x/TARGETS index 82652284f1..ef799e17ed 100644 --- a/indimail-mta-x/TARGETS +++ b/indimail-mta-x/TARGETS @@ -700,3 +700,8 @@ authcram authcram.o authcram.1 qmail-qfilter.1 +printass.o +rd-remote.o +read_assign.o +recipient-cdb.o +valid_hname.o diff --git a/indimail-mta-x/addrlist.c b/indimail-mta-x/addrlist.c index 862414c20b..0f9063250d 100644 --- a/indimail-mta-x/addrlist.c +++ b/indimail-mta-x/addrlist.c @@ -1,5 +1,8 @@ /* * $Log: addrlist.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -111,7 +114,7 @@ main() void getversion_addrlist_c() { - static char *x = "$Id: addrlist.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: addrlist.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/atrn.c b/indimail-mta-x/atrn.c index d49f9bc145..e2f1c5a091 100644 --- a/indimail-mta-x/atrn.c +++ b/indimail-mta-x/atrn.c @@ -1,5 +1,5 @@ /* - * $Id: atrn.c,v 1.11 2024-02-08 21:41:06+05:30 Cprogrammer Exp mbhangui $ + * $Id: atrn.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -21,7 +21,7 @@ extern int err_child(); extern void die_nomem(); -extern void die_control(char *); +extern void die_control(const char *); static char *binatrnargs[5] = { 0, 0, 0, 0, (char *) 0 }; static stralloc atrn, atrndir, lockfile; @@ -124,13 +124,16 @@ atrn_queue(char *arg, char *remoteip) void getversion_atrn_c() { - static char *x = "$Id: atrn.c,v 1.11 2024-02-08 21:41:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: atrn.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: atrn.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2024-02-08 21:41:06+05:30 Cprogrammer * fixed arguments to die_control() * diff --git a/indimail-mta-x/authcram.c b/indimail-mta-x/authcram.c index 24fdbf1184..099197c878 100644 --- a/indimail-mta-x/authcram.c +++ b/indimail-mta-x/authcram.c @@ -1,5 +1,5 @@ /* - * $Id: authcram.c,v 1.1 2024-02-18 17:03:00+05:30 Cprogrammer Exp mbhangui $ + * $Id: authcram.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -31,7 +31,7 @@ die_nomem() _exit(111); } -char *usage = +const char *usage = "usage: cramresp -t AUTH_TYPE user password challenge\n" " AUTH_TYPE One of CRAM-MD5, CRAM-RIPEMD, CRAM-SHA1, CRAM-SHA224,\n" " CRAM-SHA384, CRAM-SHA512\n" @@ -142,6 +142,9 @@ main(int argc, char **argv) /* * $Log: authcram.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2024-02-18 17:03:00+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/auto-strarr.c b/indimail-mta-x/auto-strarr.c index 8aeae8b14e..9714bc6e77 100644 --- a/indimail-mta-x/auto-strarr.c +++ b/indimail-mta-x/auto-strarr.c @@ -1,5 +1,8 @@ /* * $Log: auto-strarr.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-11-24 13:43:59+05:30 Cprogrammer * removed exit.h * @@ -54,7 +57,7 @@ main(int argc, char **argv) if (!value) _exit(100); - my_puts("char *const "); + my_puts("const char *"); my_puts(name); my_puts("[] = {\n"); diff --git a/indimail-mta-x/auto-uid.c b/indimail-mta-x/auto-uid.c index 4ac3378889..c6e9792b9b 100644 --- a/indimail-mta-x/auto-uid.c +++ b/indimail-mta-x/auto-uid.c @@ -1,5 +1,8 @@ /* * $Log: auto-uid.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-07-13 02:41:56+05:30 Cprogrammer * replaced outs() with subprintf * @@ -69,6 +72,6 @@ main(int argc, char **argv) void getversion_auto_uid_c() { - static char *x = "$Id: auto-uid.c,v 1.11 2023-07-13 02:41:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: auto-uid.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/autoresponder.c b/indimail-mta-x/autoresponder.c index 7aabb6c9fd..cdab9358d0 100644 --- a/indimail-mta-x/autoresponder.c +++ b/indimail-mta-x/autoresponder.c @@ -1,5 +1,5 @@ /* - * $Id: autoresponder.c,v 1.42 2024-02-08 19:36:51+05:30 Cprogrammer Exp mbhangui $ + * $Id: autoresponder.c,v 1.43 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * This is a simple program to automatically respond to emails. * @@ -69,8 +69,8 @@ static int opt_quiet, opt_copyinput, opt_nosend, opt_nolinks, msgfilefd, fi static int liphostok, dtline_len, opt_laxmode; unsigned long opt_maxmsgs = 1; time_t when, opt_timelimit = 86400 * 7; /*- RFC 3834 */ -static char *opt_subject_prefix = "Autoreply: Re: "; -static char *argv0, *dtline, *recipient, *from_addr = 0; +static const char *opt_subject_prefix = "Autoreply: Re: "; +static const char *argv0, *dtline, *recipient, *from_addr = 0; static char ssinbuf[BUFSIZE_IN], ssoutbuf[BUFSIZE_OUT]; static char strnum[FMT_ULONG]; substdio ssin, ssout; @@ -86,12 +86,12 @@ struct header stralloc resent_to; stralloc resent_cc; stralloc resent_bcc; - char *date; - char *bogosity; - char *mailer; - char *subject; - char *messageid; - char *importance; + const char *date; + const char *bogosity; + const char *mailer; + const char *subject; + const char *messageid; + const char *importance; }; struct header header = { @@ -110,11 +110,11 @@ struct header header = { 0, 0 }; -char *daytab[7] = { +const char *daytab[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -char *usage_str = +const char *usage_str = " [OPTIONS] MSGFILE DIR\n" "\n" "OPTIONS\n" @@ -142,7 +142,7 @@ char *usage_str = /*- Ignore message and do not respond */ no_return void -ignore(char *msg) +ignore(const char *msg) { if (opt_quiet) _exit(0); @@ -157,12 +157,12 @@ ignore(char *msg) } void -store_addr(stralloc *addrlist, char *line) +store_addr(stralloc *addrlist, const char *line) { char *start, *ptr; - for(start = line;*start && isspace((int) *start);start++); - for (ptr = start;*ptr;ptr++) { + for(start = (char *) line;*start && isspace((int) *start);start++); + for (ptr = start; *ptr; ptr++) { if (*ptr == ',' || *ptr == ';') { *ptr = 0; if (!stralloc_cats(addrlist, start) || @@ -184,8 +184,7 @@ stralloc addr = { 0 }; /*- will be 0-terminated, if addrparse returns 1 * * modified */ int -addrparse(arg) - char *arg; +addrparse(const char *arg) { int i, flagesc, flagquoted; ip_addr ip; @@ -266,7 +265,7 @@ addrparse(arg) } int -match_addr(stralloc *addrlist, char *email_addr) +match_addr(stralloc *addrlist, const char *email_addr) { char *ptr; int len; @@ -294,7 +293,7 @@ match_addr(stralloc *addrlist, char *email_addr) } no_return void -usage(char *msg) +usage(const char *msg) { if (msg) { substdio_puts(subfderr, argv0); @@ -457,7 +456,7 @@ void check_sender(stralloc *sender) { int i; - char *errStr = 0; + const char *errStr = 0; /*- Ignore messages with an empty SENDER (sent from system) */ if (str_equal(sender->s, "mailer-daemon")) @@ -501,11 +500,11 @@ check_sender(stralloc *sender) } void -parse_header(char *str, unsigned length) +parse_header(const char *str, unsigned length) { int pos, len; - char **ptr; - char *headertab[] = { + const char **ptr; + const char *headertab[] = { "Return-Path:", /*- 0 */ "From:", /*- 1 */ "To:", /*- 2 */ @@ -540,8 +539,8 @@ parse_header(char *str, unsigned length) ignore("Message already has my Delivered-To line"); else if (!strncasecmp(str, "Auto-Submitted:", 15)) /*- RFC 3834 */ { - char *start = str + 15; - char *end; + const char *start = str + 15; + const char *end; while (start < str + length && isspace((int) *start)) ++start; @@ -555,8 +554,8 @@ parse_header(char *str, unsigned length) ignore("Message does not haveAuto-Submitted header as \"no\""); } else if (!strncasecmp(str, "Precedence:", 11)) { - char *start = str + 11; - char *end; + const char *start = str + 11; + const char *end; while (start < str + length && isspace((int) *start)) ++start; @@ -567,11 +566,11 @@ parse_header(char *str, unsigned length) !strncasecmp(start, "list", end - start)) ignore("Message has a junk, bulk, or list precedence header"); } else - for(pos = 0, ptr = headertab;*ptr;ptr++,pos++) { + for(pos = 0, ptr = headertab; *ptr; ptr++, pos++) { len = str_len(*ptr); if (!strncasecmp(str, *ptr, len)) { - char *start = str + len; - char *end = str + length - 1; + const char *start = str + len; + const char *end = str + length - 1; char *cptr1, *cptr2; int i = 0; @@ -583,7 +582,7 @@ parse_header(char *str, unsigned length) } if (!(cptr1 = alloc(length - (start - str) - i + 1))) strerr_die2x(111, FATAL, "out of memory"); - for(cptr2 = cptr1;start != end + 1;start++) + for(cptr2 = cptr1; start != end + 1; start++) *cptr2++ = *start; *cptr2 = 0; switch (pos) @@ -640,7 +639,7 @@ parse_header(char *str, unsigned length) } int -popen_inject(char *sender) +popen_inject(const char *sender) { char *(args[6]); stralloc bin = {0}; @@ -662,10 +661,10 @@ popen_inject(char *sender) !stralloc_0(&bin)) strerr_die2x(111, FATAL, "out of memory"); args[0] = bin.s; - args[1] = "-a"; - args[2] = "-f"; - args[3] = ""; - args[4] = sender; + args[1] = (char *) "-a"; + args[2] = (char *) "-f"; + args[3] = (char *) ""; + args[4] = (char *) sender; args[5] = 0; close(fds[1]); if (!env_unset("QMAILNAME")) @@ -726,7 +725,7 @@ pclose_inject(int fdout) } void -parseMessage_file(stralloc *line, struct datetime *dt, char *ldbuf) +parseMessage_file(stralloc *line, struct datetime *dt, const char *ldbuf) { static int saw_percent = 0; ssize_t todo, incr; @@ -859,7 +858,7 @@ parseMessage_file(stralloc *line, struct datetime *dt, char *ldbuf) } int -count_history(char *sender, unsigned max) +count_history(const char *sender, unsigned max) { DIR *dir = opendir("."); struct dirent *entry; @@ -946,7 +945,7 @@ main(int argc, char *argv[]) #ifdef HAVESRS int len, do_srs = 0, at; #endif - char *sender, *dtrecip, *host, *ptr; + const char *sender, *dtrecip, *host, *ptr; char dbuf[DATE822FMT]; #ifdef MIME char num[FMT_ULONG]; @@ -1251,7 +1250,7 @@ main(int argc, char *argv[]) void getversion_qmail_autoresponder_c() { - static char *x = "$Id: autoresponder.c,v 1.42 2024-02-08 19:36:51+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: autoresponder.c,v 1.43 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; x = sccsidmktempfileh; @@ -1260,6 +1259,9 @@ getversion_qmail_autoresponder_c() /* * $Log: autoresponder.c,v $ + * Revision 1.43 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.42 2024-02-08 19:36:51+05:30 Cprogrammer * fixed compiler warnings if libsrs2 is missing * diff --git a/indimail-mta-x/batv.c b/indimail-mta-x/batv.c index 7ac71fa7e5..b32fea2979 100644 --- a/indimail-mta-x/batv.c +++ b/indimail-mta-x/batv.c @@ -1,5 +1,8 @@ /* * $Log: batv.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2022-10-13 23:58:43+05:30 Cprogrammer * added link to batv draft used by indimail-mta * @@ -114,7 +117,7 @@ checkbatv(char *sender, int *days) char kdate[] = "0000"; #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_MD_CTX *mdctx; - const EVP_MD *md = 0; + EVP_MD *md = 0; unsigned char md5digest[EVP_MAX_MD_SIZE]; unsigned int md_len; #else @@ -208,7 +211,7 @@ signbatv(char *sender) static char hex[] = "0123456789abcdef"; #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_MD_CTX *mdctx; - const EVP_MD *md = 0; + EVP_MD *md = 0; unsigned char md5digest[EVP_MAX_MD_SIZE]; unsigned int md_len; #else @@ -265,7 +268,7 @@ signbatv(char *sender) return newsender.s; } -char *usage = +const char *usage = "usage: batv -k key [-t stale ] -s sender | -v recipient\n" " -k key (signing key)\n" " -t stale (key validity period in days default 7)\n" @@ -348,7 +351,7 @@ main(argc, argv) void getversion_batv_c() { - static char *x = "$Id: batv.c,v 1.10 2022-10-13 23:58:43+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: batv.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/bodycheck.c b/indimail-mta-x/bodycheck.c index cfbcf0a8f4..7a238d360e 100644 --- a/indimail-mta-x/bodycheck.c +++ b/indimail-mta-x/bodycheck.c @@ -1,5 +1,8 @@ /* * $Log: bodycheck.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2009-01-06 20:43:56+05:30 Cprogrammer * added bodycheck_free() * corrected logic for -header and -body @@ -36,7 +39,7 @@ static stralloc Desc = { 0 }; void die_nomem(void); /*- defined in qmail-smtpd.c */ int -bodycheck(stralloc *body, stralloc *line, char **desc, int in_header) +bodycheck(stralloc *body, stralloc *line, const char **desc, int in_header) { char errbuf[512]; int len, tmp_len, count, retval, header_check, body_check; @@ -210,7 +213,7 @@ bodycheck_free() void getversion_bodycheck_c() { - static char *x = "$Id: bodycheck.c,v 1.5 2009-01-06 20:43:56+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: bodycheck.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/bodycheck.h b/indimail-mta-x/bodycheck.h index 1a04a70a74..3b6ec077c2 100644 --- a/indimail-mta-x/bodycheck.h +++ b/indimail-mta-x/bodycheck.h @@ -1,5 +1,8 @@ /* * $Log: bodycheck.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2008-12-23 11:29:12+05:30 Cprogrammer * added bodycheck_free() * @@ -9,6 +12,6 @@ */ #ifndef _BODY_CHECK_H #define _BODY_CHECK_H -int bodycheck(stralloc *, stralloc *, char **, int); +int bodycheck(stralloc *, stralloc *, const char **, int); void bodycheck_free(void); #endif diff --git a/indimail-mta-x/bouncesaying.c b/indimail-mta-x/bouncesaying.c index 2c05e1cc20..86e6e6f31d 100644 --- a/indimail-mta-x/bouncesaying.c +++ b/indimail-mta-x/bouncesaying.c @@ -1,5 +1,8 @@ /* * $Log: bouncesaying.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2020-11-24 13:44:08+05:30 Cprogrammer * removed exit.h * @@ -62,7 +65,7 @@ main(argc, argv) void getversion_bouncesaying_c() { - static char *x = "$Id: bouncesaying.c,v 1.7 2020-11-24 13:44:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: bouncesaying.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cdb-database.c b/indimail-mta-x/cdb-database.c index 95402f9526..0fd59fce78 100644 --- a/indimail-mta-x/cdb-database.c +++ b/indimail-mta-x/cdb-database.c @@ -1,5 +1,8 @@ /* * $Log: cdb-database.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2023-09-11 09:04:29+05:30 Cprogrammer * allow comments in input file * @@ -123,7 +126,7 @@ main(int argc, char **argv) void getversion_cdb_database_c() { - static char *x = "$Id: cdb-database.c,v 1.4 2023-09-11 09:04:29+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdb-database.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cdb_match.c b/indimail-mta-x/cdb_match.c index 284026fca4..c85004d4ba 100644 --- a/indimail-mta-x/cdb_match.c +++ b/indimail-mta-x/cdb_match.c @@ -1,5 +1,5 @@ /* - * $Id: cdb_match.c,v 1.1 2022-10-30 22:14:47+05:30 Cprogrammer Exp mbhangui $ + * $Id: cdb_match.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -14,7 +14,7 @@ #include "cdb_match.h" int -cdb_matchaddr(char *fn, char *addr, int len) +cdb_matchaddr(const char *fn, const char *addr, int len) { static stralloc controlfile = {0}; static stralloc temp = { 0 }; @@ -50,7 +50,7 @@ cdb_matchaddr(char *fn, char *addr, int len) } int -cdb_match(char *fn, char *addr, int len, char **result) +cdb_match(const char *fn, const char *addr, int len, char **result) { static stralloc controlfile = {0}, wildchars = {0}, lower = {0}, tmpbuf = {0}; @@ -129,7 +129,7 @@ cdb_match(char *fn, char *addr, int len, char **result) void getversion_cdb_match_c() { - static char *x = "$Id: cdb_match.c,v 1.1 2022-10-30 22:14:47+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdb_match.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } @@ -137,6 +137,9 @@ getversion_cdb_match_c() /* * $Log: cdb_match.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-10-30 22:14:47+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/cdb_match.h b/indimail-mta-x/cdb_match.h index 7f0702d5f5..9340d7f72a 100644 --- a/indimail-mta-x/cdb_match.h +++ b/indimail-mta-x/cdb_match.h @@ -1,10 +1,13 @@ /* * $Log: cdb_match.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-10-30 20:17:42+05:30 Cprogrammer * Initial revision * * - * $Id: cdb_match.h,v 1.1 2022-10-30 20:17:42+05:30 Cprogrammer Exp mbhangui $ + * $Id: cdb_match.h,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef _CDB_MATCHADDR_H #define _CDB_MATCHADDR_H @@ -16,7 +19,7 @@ #define CDB_NOMATCH 0 #define CDB_FOUND 1 -int cdb_match(char *, char *, int, char **); -int cdb_matchaddr(char *, char *, int); +int cdb_match(const char *, const char *, int, char **); +int cdb_matchaddr(const char *, const char *, int); #endif diff --git a/indimail-mta-x/cdbdump.c b/indimail-mta-x/cdbdump.c index 4058fc3d53..01897fe147 100644 --- a/indimail-mta-x/cdbdump.c +++ b/indimail-mta-x/cdbdump.c @@ -1,5 +1,8 @@ /* * $Log: cdbdump.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -26,7 +29,7 @@ die_write(void) } void -put(char *buf, unsigned int len) +put(const char *buf, unsigned int len) { if (substdio_put(subfdout, buf, len) == -1) die_write(); @@ -116,7 +119,7 @@ main() void getversion_cdbdump_c() { - static char *x = "$Id: cdbdump.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdbdump.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cdbget.c b/indimail-mta-x/cdbget.c index e49d5b7f43..a8234687ed 100644 --- a/indimail-mta-x/cdbget.c +++ b/indimail-mta-x/cdbget.c @@ -1,5 +1,8 @@ /* * $Log: cdbget.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2023-02-12 13:29:59+05:30 Cprogrammer * added -n option for searching cdb created by cdb-database * @@ -118,7 +121,7 @@ main(int argc, char **argv) void getversion_cdbget_c() { - static char *x = "$Id: cdbget.c,v 1.6 2023-02-12 13:29:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdbget.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/indimail-mta-x/cdbmake.c b/indimail-mta-x/cdbmake.c index 5b9ce14974..d7b267fe2d 100644 --- a/indimail-mta-x/cdbmake.c +++ b/indimail-mta-x/cdbmake.c @@ -1,5 +1,8 @@ /* * $Log: cdbmake.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2008-09-16 08:25:00+05:30 Cprogrammer * prototype for rename added * @@ -153,7 +156,7 @@ main(int argc, char **argv) void getversion_cdbmake_c() { - static char *x = "$Id: cdbmake.c,v 1.2 2008-09-16 08:25:00+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: cdbmake.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cdbstats.c b/indimail-mta-x/cdbstats.c index e526291c05..7bd9221ad9 100644 --- a/indimail-mta-x/cdbstats.c +++ b/indimail-mta-x/cdbstats.c @@ -1,5 +1,8 @@ /* * $Log: cdbstats.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -44,7 +47,7 @@ die_write(void) } void -put(char *buf, unsigned int len) +put(const char *buf, unsigned int len) { if (substdio_put(subfdoutsmall, buf, len) == -1) die_write(); @@ -76,7 +79,7 @@ get(char *buf, unsigned int len) } void -getnum(uint32 * num) +getnum(uint32 *num) { char buf[4]; get(buf, 4); @@ -86,7 +89,7 @@ getnum(uint32 * num) char strnum[FMT_ULONG]; void -putnum(char *label, unsigned long count) +putnum(const char *label, unsigned long count) { unsigned int i; put(label, str_len(label)); @@ -169,7 +172,7 @@ main() void getversion_cdbstats_c() { - static char *x = "$Id: cdbstats.c,v 1.4 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdbstats.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cdbtest.c b/indimail-mta-x/cdbtest.c index aca5798a6d..d031402990 100644 --- a/indimail-mta-x/cdbtest.c +++ b/indimail-mta-x/cdbtest.c @@ -1,5 +1,8 @@ /* * $Log: cdbtest.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -38,7 +41,7 @@ die_write(void) } void -put(char *buf, unsigned int len) +put(const char *buf, unsigned int len) { if (substdio_put(subfdoutsmall, buf, len) == -1) die_write(); @@ -70,7 +73,7 @@ get(char *buf, unsigned int len) } void -getnum(uint32 * num) +getnum(uint32 *num) { char buf[4]; get(buf, 4); @@ -80,7 +83,7 @@ getnum(uint32 * num) char strnum[FMT_ULONG]; void -putnum(char *label, unsigned long count) +putnum(const char *label, unsigned long count) { put(label, str_len(label)); put(strnum, fmt_ulong(strnum, count)); @@ -158,7 +161,7 @@ main() void getversion_cdbtest_c() { - static char *x = "$Id: cdbtest.c,v 1.4 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cdbtest.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/checkaddr.c b/indimail-mta-x/checkaddr.c index f1f80782df..4bb0b8006c 100644 --- a/indimail-mta-x/checkaddr.c +++ b/indimail-mta-x/checkaddr.c @@ -1,5 +1,8 @@ /* * $Log: checkaddr.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:24:00+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -78,7 +81,7 @@ main(int argc, char **argv) void getversion_checkaddr_c() { - static char *x = "$Id: checkaddr.c,v 1.5 2024-01-23 01:24:00+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: checkaddr.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/checkdomain.c b/indimail-mta-x/checkdomain.c index 6e5d0d34ff..e0a75d98d0 100644 --- a/indimail-mta-x/checkdomain.c +++ b/indimail-mta-x/checkdomain.c @@ -1,5 +1,8 @@ /* * $Log: checkdomain.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:20:40+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -86,7 +89,7 @@ main(int argc, char **argv) void getversion_checkdomain_c() { - static char *x = "$Id: checkdomain.c,v 1.5 2024-01-23 01:20:40+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: checkdomain.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/chkspawn.c b/indimail-mta-x/chkspawn.c index a114461cfb..98f1d85430 100644 --- a/indimail-mta-x/chkspawn.c +++ b/indimail-mta-x/chkspawn.c @@ -1,5 +1,8 @@ /* * $Log: chkspawn.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2020-11-24 13:44:31+05:30 Cprogrammer * removed exit.h * @@ -66,7 +69,7 @@ limit in conf-spawn be at most "); void getversion_chkspawn_c() { - static char *x = "$Id: chkspawn.c,v 1.6 2020-11-24 13:44:31+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: chkspawn.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/cidr.c b/indimail-mta-x/cidr.c index ba53b9b6d3..94fc8906df 100644 --- a/indimail-mta-x/cidr.c +++ b/indimail-mta-x/cidr.c @@ -1,5 +1,8 @@ /* * $Log: cidr.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2018-05-07 17:06:36+05:30 Cprogrammer * removed compilation warnings * @@ -190,7 +193,7 @@ main(int argc, char **argv) void getversion_cidr_c() { - static char *x = "$Id: cidr.c,v 1.2 2018-05-07 17:06:36+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cidr.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/indimail-mta-x/cleanq.c b/indimail-mta-x/cleanq.c index 46e925d91a..e9fd7fdb80 100644 --- a/indimail-mta-x/cleanq.c +++ b/indimail-mta-x/cleanq.c @@ -1,5 +1,5 @@ /* - * $Id: cleanq.c,v 1.14 2024-02-12 20:55:59+05:30 Cprogrammer Exp mbhangui $ + * $Id: cleanq.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -33,7 +33,7 @@ die_usage(void) } void -my_puts(char *s) /*- was named puts, but Solaris pwd.h includes stdio.h. dorks. */ +my_puts(const char *s) /*- was named puts, but Solaris pwd.h includes stdio.h. dorks. */ { if (substdio_puts(subfdout, s) == -1) _exit(111); @@ -256,13 +256,16 @@ main(int argc, char **argv) void getversion_cleanq_c() { - static char *x = "$Id: cleanq.c,v 1.14 2024-02-12 20:55:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: cleanq.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: cleanq.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2024-02-12 20:55:59+05:30 Cprogrammer * use unlinkat() if available instead of unlink() * diff --git a/indimail-mta-x/columnt.c b/indimail-mta-x/columnt.c index 1c560ee9ce..0990b72368 100644 --- a/indimail-mta-x/columnt.c +++ b/indimail-mta-x/columnt.c @@ -1,5 +1,8 @@ /* * $Log: columnt.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -175,7 +178,7 @@ main() void getversion_columnt_c() { - static char *x = "$Id: columnt.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: columnt.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/condredirect.c b/indimail-mta-x/condredirect.c index b06220f6ba..0433b4ff93 100644 --- a/indimail-mta-x/condredirect.c +++ b/indimail-mta-x/condredirect.c @@ -1,5 +1,5 @@ /* - * $Id: condredirect.c,v 1.18 2023-07-11 11:29:46+05:30 Cprogrammer Exp mbhangui $ + * $Id: condredirect.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include "sig.h" @@ -39,7 +39,7 @@ main(int argc, char **argv) { char *sender, *dtline, *qqeh; int pid, wstat, i, reverse = 0; - char *qqx; + const char *qqx; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { @@ -133,13 +133,16 @@ main(int argc, char **argv) void getversion_condredirect_c() { - static char *x = "$Id: condredirect.c,v 1.18 2023-07-11 11:29:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: condredirect.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: condredirect.c,v $ + * Revision 1.19 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.18 2023-07-11 11:29:46+05:30 Cprogrammer * added -r reverse option to forward when program fails instead of when program succeeds. * diff --git a/indimail-mta-x/condtomaildir.c b/indimail-mta-x/condtomaildir.c index 1b64492cef..cf7e4d06ea 100644 --- a/indimail-mta-x/condtomaildir.c +++ b/indimail-mta-x/condtomaildir.c @@ -1,5 +1,5 @@ /*- - * $Id: condtomaildir.c,v 1.8 2023-07-11 12:57:16+05:30 Cprogrammer Exp mbhangui $ + * $Id: condtomaildir.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -102,13 +102,16 @@ main(int argc, char **argv) void getversion_condtomaildir_c() { - static char *x = "$Id: condtomaildir.c,v 1.8 2023-07-11 12:57:16+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: condtomaildir.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: condtomaildir.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2023-07-11 12:57:16+05:30 Cprogrammer * added -r reverse option to write to maildir when program fails instead of when program succeeds. * diff --git a/indimail-mta-x/conf-cc-LINUX b/indimail-mta-x/conf-cc-LINUX index 857307ec62..daee0645eb 100644 --- a/indimail-mta-x/conf-cc-LINUX +++ b/indimail-mta-x/conf-cc-LINUX @@ -1 +1 @@ --Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings -Wno-discarded-qualifiers -Wformat=2 -Wformat-security -Wformat-signedness -Wformat-overflow -Wsuggest-attribute=format -Wmissing-format-attribute +-Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wformat-signedness -Wformat-overflow -Wsuggest-attribute=format -Wmissing-format-attribute diff --git a/indimail-mta-x/control.c b/indimail-mta-x/control.c index 8bfbac4b7c..4409ac77e4 100644 --- a/indimail-mta-x/control.c +++ b/indimail-mta-x/control.c @@ -1,5 +1,5 @@ /* - * $Id: control.c,v 1.23 2022-10-12 16:44:09+05:30 Cprogrammer Exp mbhangui $ + * $Id: control.c,v 1.24 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -66,7 +66,7 @@ control_init() */ int -control_rldef(stralloc *sa, char *fn, int flagme, char *def) +control_rldef(stralloc *sa, const char *fn, int flagme, const char *def) { int r; @@ -85,7 +85,7 @@ control_rldef(stralloc *sa, char *fn, int flagme, char *def) * WARNING!!! sa is not null terminalted */ int -control_readline(stralloc *sa, char *fn) +control_readline(stralloc *sa, const char *fn) { substdio ss; int fd, match; @@ -126,7 +126,7 @@ control_readline(stralloc *sa, char *fn) */ int -control_readint(int *i, char *fn) +control_readint(int *i, const char *fn) { int u; @@ -151,7 +151,7 @@ control_readint(int *i, char *fn) */ int -control_readulong(unsigned long *i, char *fn) +control_readulong(unsigned long *i, const char *fn) { unsigned long u; @@ -178,7 +178,7 @@ control_readulong(unsigned long *i, char *fn) * skip */ int -control_readnativefile(stralloc *sa, char *fn, int mode) +control_readnativefile(stralloc *sa, const char *fn, int mode) { substdio ss; int fd, match; @@ -241,7 +241,7 @@ control_readnativefile(stralloc *sa, char *fn, int mode) * -1 - system error */ int -control_readfile(stralloc *sa, char *fn, int flagme) +control_readfile(stralloc *sa, const char *fn, int flagme) { substdio ss; int fd, match; @@ -300,7 +300,7 @@ control_readfile(stralloc *sa, char *fn, int flagme) * pick a random line from fn and copy it to sa */ int -control_readrandom(stralloc *sa, char *fn) +control_readrandom(stralloc *sa, const char *fn) { substdio ss; char *ptr; @@ -365,7 +365,7 @@ extern int rename (const char *, const char *); * newlines */ int -control_writefile(stralloc *sa, char *fn) +control_writefile(stralloc *sa, const char *fn) { int i, wfd; static stralloc controlfileold = {0}, controlfilenew = {0}; @@ -415,7 +415,7 @@ control_writefile(stralloc *sa, char *fn) * write an int value to control file fn */ int -control_writeint(int val, char *fn) +control_writeint(int val, const char *fn) { int i, wfd; static stralloc controlfileold = {0}, controlfilenew = {0}; @@ -473,7 +473,7 @@ control_writeint(int val, char *fn) * 3. Store the output in sa */ int -control_readcmd(stralloc *sa, char *fn) +control_readcmd(stralloc *sa, const char *fn) { substdio ss, ssin; int fd, match, child, wstat; @@ -545,7 +545,7 @@ control_readcmd(stralloc *sa, char *fn) void getversion_control_c() { - static char *x = "$Id: control.c,v 1.23 2022-10-12 16:44:09+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: control.c,v 1.24 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; x = sccsidmakeargsh; @@ -555,6 +555,9 @@ getversion_control_c() /* * $Log: control.c,v $ + * Revision 1.24 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.23 2022-10-12 16:44:09+05:30 Cprogrammer * enabled control_readcmd() which translates output of command as a control file * diff --git a/indimail-mta-x/control.h b/indimail-mta-x/control.h index 7cdbf1854a..168deb048b 100644 --- a/indimail-mta-x/control.h +++ b/indimail-mta-x/control.h @@ -1,5 +1,8 @@ /* * $Log: control.h,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2022-04-20 23:11:13+05:30 Cprogrammer * added control_writefile(), control_readint() functions * @@ -31,14 +34,15 @@ #include "stralloc.h" int control_init(void); -int control_readline(stralloc *, char *); -int control_rldef(stralloc *, char *, int, char *); -int control_readint(int *, char *); -int control_writeint(int, char *); -int control_readulong(unsigned long *, char *); -int control_readnativefile(stralloc *, char *, int); -int control_readfile(stralloc *, char *, int); -int control_writefile(stralloc *, char *); -int control_readrandom(stralloc *, char *); +int control_readline(stralloc *, const char *); +int control_rldef(stralloc *, const char *, int, const char *); +int control_readint(int *, const char *); +int control_writeint(int, const char *); +int control_readulong(unsigned long *, const char *); +int control_readnativefile(stralloc *, const char *, int); +int control_readfile(stralloc *, const char *, int); +int control_writefile(stralloc *, const char *); +int control_readrandom(stralloc *, const char *); +int control_readcmd(stralloc *, const char *); void striptrailingwhitespace(stralloc *); #endif diff --git a/indimail-mta-x/create_rpm b/indimail-mta-x/create_rpm index e7b78e1ca9..902bbf9153 100755 --- a/indimail-mta-x/create_rpm +++ b/indimail-mta-x/create_rpm @@ -1,5 +1,8 @@ #!/bin/sh # $Log: create_rpm,v $ +# Revision 1.19 2024-05-09 23:03:54+05:30 Cprogrammer +# use x.y for release +# # Revision 1.18 2022-10-04 23:40:14+05:30 Cprogrammer # use rpmlintrc from $HOME/.config # @@ -55,7 +58,7 @@ # Initial revision # # -# $Id: create_rpm,v 1.18 2022-10-04 23:40:14+05:30 Cprogrammer Exp mbhangui $ +# $Id: create_rpm,v 1.19 2024-05-09 23:03:54+05:30 Cprogrammer Exp mbhangui $ # version=$(head -1 conf-version) @@ -206,28 +209,25 @@ fi dist=`uname -r |cut -d . -f4` if [ -z "$release" ] ; then if [ -f /usr/sbin/qmail-smtpd ] ; then - idist=$(rpm -qf /usr/sbin/qmail-smtpd|cut -d- -f4|cut -d. -f3) - if [ " $dist" = " $idist" ] ; then - iversion=$(rpm -qf /usr/sbin/qmail-smtpd|cut -d- -f3) - if [ "$iversion" = "$version" ] ; then - release=$(rpm -qf /usr/sbin/qmail-smtpd | cut -d- -f4 | cut -d. -f2) - release=$(expr $release + 1) - else - release=1 - fi + iversion=$(rpm -qf /usr/sbin/qmail-smtpd|cut -d- -f3) + if [ "$iversion" = "$version" ] ; then + t1=$(rpm -qf /usr/sbin/qmail-smtpd | cut -d- -f4 | cut -d. -f1) + t2=$(rpm -qf /usr/sbin/qmail-smtpd | cut -d- -f4 | cut -d. -f2) + t2=$(expr $t2 + 1) + release="$t1.$t2" else - release=1 + release=0.1 fi else - release=1 + release=0.1 fi fi -echo -n "Build RPM for indimail-mta-"$version"-1."$release" (Y/N) - " +echo -n "Build RPM for indimail-mta-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then tmprel=`cat indimail-mta-x/conf-release 2>/dev/null` - if [ ! " $tmprel" = " 1.$release" ] ; then - echo 1.$release > indimail-mta-x/conf-release + if [ ! " $tmprel" = " $release" ] ; then + echo $release > indimail-mta-x/conf-release cd indimail-mta-x make SYSTEM=$SYSTEM indimail-mta.spec cp indimail-mta.spec /tmp @@ -249,10 +249,10 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then /bin/rm -f /tmp/indimail-mta.spec for i in indimail-mta indimail-mini qmta do - rpm --addsign $rpmbuild/RPMS/$build_arch/$i-"$version"-"1.$release".$dist.$build_arch.rpm + rpm --addsign $rpmbuild/RPMS/$build_arch/$i-"$version"-"$release".$dist.$build_arch.rpm done - rpm --addsign $rpmbuild/SRPMS/indimail-mta-"$version"-"1.$release".$dist.src.rpm - echo -n "RPM lint for indimail-mta-"$version"-1."$release" (Y/N) - " + rpm --addsign $rpmbuild/SRPMS/indimail-mta-"$version"-"$release".$dist.src.rpm + echo -n "RPM lint for indimail-mta-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then ( @@ -260,14 +260,14 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then do echo $i if [ -f $HOME/.config/$i.rpmlintrc ] ; then - rpmlint -r $HOME/.config/$i.rpmlintrc $rpmbuild/RPMS/$build_arch/$i-"$version"-"1.$release".$dist.$build_arch.rpm + rpmlint -r $HOME/.config/$i.rpmlintrc $rpmbuild/RPMS/$build_arch/$i-"$version"-"$release".$dist.$build_arch.rpm else - rpmlint $rpmbuild/RPMS/$build_arch/$i-"$version"-"1.$release".$dist.$build_arch.rpm + rpmlint $rpmbuild/RPMS/$build_arch/$i-"$version"-"$release".$dist.$build_arch.rpm fi echo ------------------------ done - echo indimail-mta-"$version"-"1.$release".$dist.src.rpm - rpmlint $rpmbuild/SRPMS/indimail-mta-"$version"-"1.$release".$dist.src.rpm + echo indimail-mta-"$version"-"$release".$dist.src.rpm + rpmlint $rpmbuild/SRPMS/indimail-mta-"$version"-"$release".$dist.src.rpm echo ------------------------ ) 2>&1 | less fi diff --git a/indimail-mta-x/ctrlenv.c b/indimail-mta-x/ctrlenv.c index 4126bbac4f..e1aabbb663 100644 --- a/indimail-mta-x/ctrlenv.c +++ b/indimail-mta-x/ctrlenv.c @@ -1,5 +1,8 @@ /* * $Log: ctrlenv.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2022-10-31 09:09:26+05:30 Cprogrammer * look at last colon when parsing data from plain text files * @@ -98,7 +101,7 @@ parse_env(char *envStrings) #ifdef HAS_MYSQL int -match_in_db(MYSQL *conn, char *table_name, char *addr, char **envStr, char **errStr) +match_in_db(MYSQL *conn, const char *table_name, const char *addr, char **envStr, const char *errStr[]) { MYSQL_RES *res; @@ -174,12 +177,13 @@ match_in_db(MYSQL *conn, char *table_name, char *addr, char **envStr, char **err } int -sql_match(char *fn, char *addr, int len, char **result) +sql_match(const char *fn, const char *addr, int len, char **result) { static stralloc controlfile = { 0 }; int cntrl_ok; MYSQL *conn; - char *errStr = (char *) 0, *table_name = (char *) 0; + const char *errStr = (char *) 0; + char *table_name = (char *) 0; if (!len || !*addr || !fn) return (0); @@ -306,7 +310,7 @@ main(int argc, char **argv) void getversion_ctrlenv_c() { - static char *x = "$Id: ctrlenv.c,v 1.5 2022-10-31 09:09:26+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ctrlenv.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/custom_error.c b/indimail-mta-x/custom_error.c index add4f98874..aa7250b541 100644 --- a/indimail-mta-x/custom_error.c +++ b/indimail-mta-x/custom_error.c @@ -1,5 +1,8 @@ /* * $Log: custom_error.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2023-04-25 22:41:34+05:30 Cprogrammer * removed use of static variables as function is noreturn * @@ -16,9 +19,9 @@ #include "qmail.h" no_return void -custom_error(char *program, char *type, char *message, char *extra, char *code) +custom_error(const char *program, const char *type, const char *message, const char *extra, const char *code) { - char *c; + const char *c; char errbuf[256]; int errfd; struct substdio sserr; diff --git a/indimail-mta-x/custom_error.h b/indimail-mta-x/custom_error.h index 43957e1321..440feb9aab 100644 --- a/indimail-mta-x/custom_error.h +++ b/indimail-mta-x/custom_error.h @@ -1,5 +1,8 @@ /* * $Log: custom_error.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2022-03-27 20:07:33+05:30 Cprogrammer * include extended error from errno if EXTENDED_ERROR env variable is defined * @@ -11,7 +14,7 @@ #define _CUSTOM_ERROR_H #include -no_return void custom_error(char *, char *, char *, char *, char *); -char *extended_err(char *, char *); +no_return void custom_error(const char *, const char *, const char *, const char *, const char *); +char *extended_err(const char *, const char *); #endif diff --git a/indimail-mta-x/delivery_rate.c b/indimail-mta-x/delivery_rate.c index ac67789fa0..fb73b1ae18 100644 --- a/indimail-mta-x/delivery_rate.c +++ b/indimail-mta-x/delivery_rate.c @@ -1,5 +1,8 @@ /* * $Log: delivery_rate.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-01-15 12:20:12+05:30 Cprogrammer * use slog() with varargs for logging errors * @@ -56,7 +59,7 @@ extern char *queuedesc; */ int delivery_rate(char *_domain, unsigned long id, datetime_sec *time_needed, - int *do_ratelimit, char *argv0) + int *do_ratelimit, const char *argv0) { char *rate_dir, *rate_exp, *domain; int i, s, at; @@ -207,7 +210,7 @@ delivery_rate(char *_domain, unsigned long id, datetime_sec *time_needed, void getversion_delivery_rate_c() { - static char *x = "$Id: delivery_rate.c,v 1.9 2023-01-15 12:20:12+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: delivery_rate.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidgetdomainth; x = sccsidgetrateh; diff --git a/indimail-mta-x/delivery_rate.h b/indimail-mta-x/delivery_rate.h index 37226466c2..98265cf8ac 100644 --- a/indimail-mta-x/delivery_rate.h +++ b/indimail-mta-x/delivery_rate.h @@ -1,5 +1,8 @@ /* * $Log: delivery_rate.h,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2022-01-30 08:31:17+05:30 Cprogrammer * added additional argument in delivery_rate() * @@ -17,12 +20,12 @@ #define _DELIVERY_RATE_H #ifndef lint -static char sccsiddelivery_rateh[] = "$Id: delivery_rate.h,v 1.4 2022-01-30 08:31:17+05:30 Cprogrammer Exp mbhangui $"; +static const char sccsiddelivery_rateh[] = "$Id: delivery_rate.h,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif #include -int delivery_rate(char *domain, unsigned long id, datetime_sec *, int *, char *); +int delivery_rate(char *domain, unsigned long id, datetime_sec *, int *, const char *); #endif diff --git a/indimail-mta-x/dns.c b/indimail-mta-x/dns.c index 6ee3668476..e2318d3d9d 100644 --- a/indimail-mta-x/dns.c +++ b/indimail-mta-x/dns.c @@ -1,5 +1,5 @@ /* - * $Id: dns.c,v 1.39 2022-12-21 12:21:46+05:30 Cprogrammer Exp mbhangui $ + * $Id: dns.c,v 1.40 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * RCS log at bottom */ #include @@ -104,7 +104,7 @@ static stralloc tmpsa = { 0 }; static int (*lookup) () = res_query; #ifdef IPV6 -static int iaafmt6(char *, ip6_addr *, char *); +static int iaafmt6(char *, ip6_addr *, const char *); #endif #ifdef HASTLSA static tlsarr tlsaRR; @@ -533,7 +533,7 @@ dns_ptr(stralloc *sa, ip_addr *ip4) #ifdef IPV6 static int -iaafmt6(char *s, ip6_addr *i6, char *dom) +iaafmt6(char *s, ip6_addr *i6, const char *dom) { int j; static char data[] = "0123456789abcdef"; @@ -1024,7 +1024,7 @@ dns_tlsarrplus(tlsarralloc *ta, stralloc *sa) { int r, i = 0; uint32_t ttl; - char *cp; + const char *cp; switch (resolve(sa, T_TLSA)) { case DNS_MEM: @@ -1067,13 +1067,16 @@ dns_tlsarr(tlsarralloc *ta, stralloc *sa) void getversion_dns_c() { - static char *x = "$Id: dns.c,v 1.39 2022-12-21 12:21:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dns.c,v 1.40 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: dns.c,v $ + * Revision 1.40 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.39 2022-12-21 12:21:46+05:30 Cprogrammer * renamed dns_txtplus(), dns_ptrplus() as dns_txt(), dns_ptr() * diff --git a/indimail-mta-x/dns_text.c b/indimail-mta-x/dns_text.c index 896a80afc8..51321ee460 100644 --- a/indimail-mta-x/dns_text.c +++ b/indimail-mta-x/dns_text.c @@ -1,5 +1,8 @@ /* * $Log: dns_text.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2023-09-23 21:22:02+05:30 Cprogrammer * use ansic proto for functions * @@ -229,7 +232,7 @@ dns_text(char *dn) void getversion_dns_text_c() { - static char *x = "$Id: dns_text.c,v 1.12 2023-09-23 21:22:02+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dns_text.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsbl.c b/indimail-mta-x/dnsbl.c index 28edd30cda..3bca80b3a2 100644 --- a/indimail-mta-x/dnsbl.c +++ b/indimail-mta-x/dnsbl.c @@ -1,5 +1,8 @@ /* * $Log: dnsbl.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2022-06-01 13:00:54+05:30 Cprogrammer * skip loopback address from dnsbl check * @@ -32,12 +35,12 @@ int dnsblok, skipdnsbl = 0; stralloc dnsblhost = { 0 }, dnsbl_mesg = { 0 }, dnsbllist = { 0 }; -char *dnsblFn; +const char *dnsblFn; void out_of_mem(char **mesg) { - *mesg = "451 Requested action aborted: out of memory (#4.3.0)\r\n"; + *mesg = (char *) "451 Requested action aborted: out of memory (#4.3.0)\r\n"; return; } @@ -65,9 +68,9 @@ die_dnsbl(char **mesg) */ int -dnsblcheck(char **mesg, char *remoteip) +dnsblcheck(char **mesg, const char *remoteip) { - char *ch; + const char *ch; static stralloc dnsblbyte = { 0 }, dnsblrev = { 0 }; static ipalloc dnsblip = { 0 }; char x[IPFMT]; @@ -135,7 +138,7 @@ dnsblcheck(char **mesg, char *remoteip) } static int -mailfrom_hook(char *remoteip, char *from, char **mesg) +mailfrom_hook(const char *remoteip, const char *from, char **mesg) { char *x, *_relayclient; int _authenticated; @@ -150,7 +153,7 @@ mailfrom_hook(char *remoteip, char *from, char **mesg) return (0); if ((dnsblok = control_readfile(&dnsbllist, dnsblFn = ((x = env_get("DNSBLLIST")) && *x ? x : "dnsbllist"), 0)) == -1) { - *mesg = "451 Requested action aborted: unable to read controls (#4.3.0)\r\n"; + *mesg = (char *) "451 Requested action aborted: unable to read controls (#4.3.0)\r\n"; return (1); } _relayclient = env_get("RELAYCLIENT"); @@ -185,6 +188,6 @@ plugin_init() void getversion_dnsbl_c() { - static char *x = "$Id: dnsbl.c,v 1.7 2022-06-01 13:00:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsbl.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsblcheck.c b/indimail-mta-x/dnsblcheck.c index 8ed202c614..9c8a6c1058 100644 --- a/indimail-mta-x/dnsblcheck.c +++ b/indimail-mta-x/dnsblcheck.c @@ -1,5 +1,8 @@ /* * $Log: dnsblcheck.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-06-01 13:02:09+05:30 Cprogrammer * Initial revision * @@ -144,7 +147,7 @@ main(int argc, char **argv) void getversion_dnsblcheck_c() { - static char *x = "$Id: dnsblcheck.c,v 1.1 2022-06-01 13:02:09+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsblcheck.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnscname.c b/indimail-mta-x/dnscname.c index 3d4d9ade98..1087d08783 100644 --- a/indimail-mta-x/dnscname.c +++ b/indimail-mta-x/dnscname.c @@ -1,5 +1,8 @@ /* * $Log: dnscname.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2023-09-23 21:21:03+05:30 Cprogrammer * use ansic proto for functions * @@ -45,7 +48,7 @@ main(int argc, char **argv) void getversion_dnscname_c() { - static char *x = "$Id: dnscname.c,v 1.8 2023-09-23 21:21:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnscname.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsdoe.c b/indimail-mta-x/dnsdoe.c index 04a174c6fe..dbe60cc4fc 100644 --- a/indimail-mta-x/dnsdoe.c +++ b/indimail-mta-x/dnsdoe.c @@ -1,5 +1,8 @@ /* * $Log: dnsdoe.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-09-23 21:21:38+05:30 Cprogrammer * use ansic proto for functions * @@ -39,7 +42,7 @@ dnsdoe(int r) void getversion_dnsdoe_c() { - static char *x = "$Id: dnsdoe.c,v 1.5 2023-09-23 21:21:38+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsdoe.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsfq.c b/indimail-mta-x/dnsfq.c index 018de2f92a..c853580c99 100644 --- a/indimail-mta-x/dnsfq.c +++ b/indimail-mta-x/dnsfq.c @@ -1,5 +1,8 @@ /* * $Log: dnsfq.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-09-23 21:21:42+05:30 Cprogrammer * use ansic proto for functions * @@ -85,7 +88,7 @@ main(int argc, char **argv) void getversion_dnsfq_c() { - static char *x = "$Id: dnsfq.c,v 1.10 2023-09-23 21:21:42+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsfq.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsip.c b/indimail-mta-x/dnsip.c index b390ffb983..4cd34b3085 100644 --- a/indimail-mta-x/dnsip.c +++ b/indimail-mta-x/dnsip.c @@ -1,5 +1,8 @@ /* * $Log: dnsip.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-09-23 21:21:46+05:30 Cprogrammer * use ansic proto for functions. * @@ -73,7 +76,7 @@ main(int argc, char **argv) void getversion_dnsip_c() { - static char *x = "$Id: dnsip.c,v 1.9 2023-09-23 21:21:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsip.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsmxip.c b/indimail-mta-x/dnsmxip.c index 7e9c970809..2e6f85905c 100644 --- a/indimail-mta-x/dnsmxip.c +++ b/indimail-mta-x/dnsmxip.c @@ -1,5 +1,8 @@ /* * $Log: dnsmxip.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-09-23 21:21:52+05:30 Cprogrammer * use ansic proto for functions * @@ -88,7 +91,7 @@ main(int argc, char **argv) void getversion_dnsmxip_c() { - static char *x = "$Id: dnsmxip.c,v 1.11 2023-09-23 21:21:52+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsmxip.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnsptr.c b/indimail-mta-x/dnsptr.c index d587a2adaf..4625e85c2e 100644 --- a/indimail-mta-x/dnsptr.c +++ b/indimail-mta-x/dnsptr.c @@ -1,5 +1,8 @@ /* * $Log: dnsptr.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-09-23 21:21:55+05:30 Cprogrammer * use ansic proto for functions * @@ -67,7 +70,7 @@ main(int argc, char **argv) void getversion_dnsptr_c() { - static char *x = "$Id: dnsptr.c,v 1.10 2023-09-23 21:21:55+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnsptr.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/dnstlsarr.c b/indimail-mta-x/dnstlsarr.c index 66c21468e5..644cc7b0bc 100644 --- a/indimail-mta-x/dnstlsarr.c +++ b/indimail-mta-x/dnstlsarr.c @@ -1,5 +1,5 @@ /* - * $Id: dnstlsarr.c,v 1.18 2023-07-13 02:39:46+05:30 Cprogrammer Exp mbhangui $ + * $Id: dnstlsarr.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "substdio.h" #include "subfd.h" @@ -25,7 +25,7 @@ int timeoutdata = 300; int timeoutconn = 60; int verbose; stralloc helohost = { 0 }; -static char *usage_str = +static const char *usage_str = "usage: dnstlsarr [-p port] [-c timeoutc] [-t timeoutd] [host\n" " -p port - port to connect to\n" " -c timoutconn - Timeout for connection to remote\n" @@ -37,7 +37,7 @@ int main(int argc, char **argv) { int opt, k, j, i, query_mx = 0, verify = 0; - char *port = "25", *host = (char *) 0; + const char *port = "25", *host = (char *) 0; char hex[2]; unsigned long r; @@ -228,7 +228,7 @@ main() void getversion_dnstlsarr_c() { - static char *x = "$Id: dnstlsarr.c,v 1.18 2023-07-13 02:39:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnstlsarr.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #if defined(HASTLSA) && defined(TLS) x = sccsidstarttlsh; @@ -238,6 +238,9 @@ getversion_dnstlsarr_c() /* * $Log: dnstlsarr.c,v $ + * Revision 1.19 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.18 2023-07-13 02:39:46+05:30 Cprogrammer * refactored code to reduce loc * diff --git a/indimail-mta-x/dnstxt.c b/indimail-mta-x/dnstxt.c index ea99e58c99..49d0d44f73 100644 --- a/indimail-mta-x/dnstxt.c +++ b/indimail-mta-x/dnstxt.c @@ -1,5 +1,8 @@ /* * $Log: dnstxt.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-09-23 21:22:06+05:30 Cprogrammer * use ansic proto for functions * @@ -70,7 +73,7 @@ main(int argc, char **argv) void getversion_dnstxt_c() { - static char *x = "$Id: dnstxt.c,v 1.9 2023-09-23 21:22:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dnstxt.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/do_cleanq.c b/indimail-mta-x/do_cleanq.c index 926a6db2c3..10feb8aadc 100644 --- a/indimail-mta-x/do_cleanq.c +++ b/indimail-mta-x/do_cleanq.c @@ -1,5 +1,8 @@ /* * $Log: do_cleanq.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:24:35+05:30 Cprogrammer * added RCS id * @@ -41,7 +44,7 @@ do_cleanq() void getversion_do_cleanq_c() { - static char *x = "$Id: do_cleanq.c,v 1.2 2004-10-22 20:24:35+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: do_cleanq.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/do_match.c b/indimail-mta-x/do_match.c index 4a349eb0c3..a93a3147e1 100644 --- a/indimail-mta-x/do_match.c +++ b/indimail-mta-x/do_match.c @@ -1,5 +1,5 @@ /* - * $Id: do_match.c,v 1.1 2024-02-19 20:27:34+05:30 Cprogrammer Exp mbhangui $ + * $Id: do_match.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include @@ -7,14 +7,15 @@ #include "do_match.h" #include "wildmat.h" #include +#include int -do_match(int use_regex, char *text, char *regex, char **errStr) +do_match(int use_regex, const char *text, const char *regex, const char *errStr[]) { int i; if (errStr) - *errStr = 0; + *errStr = NULL; if (use_regex) return (matchregex(text, regex, errStr)); else @@ -40,7 +41,7 @@ do_match(int use_regex, char *text, char *regex, char **errStr) void getversion_do_match_c() { - static char *x = "$Id: do_match.c,v 1.1 2024-02-19 20:27:34+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: do_match.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidwildmath; x++; } diff --git a/indimail-mta-x/do_match.h b/indimail-mta-x/do_match.h index 1e197fbac4..0ec1d9ff0e 100644 --- a/indimail-mta-x/do_match.h +++ b/indimail-mta-x/do_match.h @@ -1,8 +1,8 @@ /* - * $Id: do_match.h,v 1.1 2024-02-19 20:27:29+05:30 Cprogrammer Exp mbhangui $ + * $Id: do_match.h,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef _DO_MATCH_H #define _DO_MATCH_H -int do_match(int, char *, char *, char **); +int do_match(int, const char *, const char *, const char *err[]); #endif diff --git a/indimail-mta-x/do_rate.c b/indimail-mta-x/do_rate.c index 639a8be519..f9b8ad5a25 100644 --- a/indimail-mta-x/do_rate.c +++ b/indimail-mta-x/do_rate.c @@ -1,5 +1,8 @@ /* * $Log: do_rate.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2022-04-13 07:48:09+05:30 Cprogrammer * return 2 if rate definition is missing or is invalid * @@ -31,7 +34,7 @@ static stralloc fline = { 0 }, _rate_expr = { 0 }; int -get_rate(char *expression, double *rate) +get_rate(const char *expression, double *rate) { struct val result; struct vartable *vt; @@ -72,7 +75,7 @@ get_rate(char *expression, double *rate) * 2 if no rate control definition exists */ int -is_rate_ok(char *_file, char *_rate_exp, unsigned long *e, double *c, +is_rate_ok(const char *_file, const char *_rate_exp, unsigned long *e, double *c, double *r, datetime_sec *time_needed) { int at, wfd, rfd, match, line_no = -1, rate_int, @@ -81,7 +84,7 @@ is_rate_ok(char *_file, char *_rate_exp, unsigned long *e, double *c, char stime[FMT_ULONG], etime[FMT_ULONG], ecount[FMT_ULONG]; double conf_rate, cur_rate = 0.0; char inbuf[2048], outbuf[1024]; - char *ptr, *rate_exp, *file; + const char *ptr, *rate_exp, *file; struct substdio ssin, ssout; datetime_sec starttime, endtime; struct stat statbuf; @@ -221,7 +224,7 @@ is_rate_ok(char *_file, char *_rate_exp, unsigned long *e, double *c, void getversion_do_rate_c() { - static char *x = "$Id: do_rate.c,v 1.3 2022-04-13 07:48:09+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: do_rate.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidevalh; x = sccsidgetrateh; diff --git a/indimail-mta-x/do_rate.h b/indimail-mta-x/do_rate.h index 64edfee226..4c7e60978a 100644 --- a/indimail-mta-x/do_rate.h +++ b/indimail-mta-x/do_rate.h @@ -1,5 +1,8 @@ /* * $Log: do_rate.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-06-05 12:45:57+05:30 Cprogrammer * return time_needed in seconds to reach configured rate in time_needed argument * @@ -11,12 +14,12 @@ #define _GET_RATE_H #ifndef lint -static char sccsidgetrateh[] = "$Id: do_rate.h,v 1.2 2021-06-05 12:45:57+05:30 Cprogrammer Exp mbhangui $"; +static const char sccsidgetrateh[] = "$Id: do_rate.h,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif #define DELIMITER "\0" -int get_rate(char *expression, double *rate); -int is_rate_ok(char *file, char *rate_exp, unsigned long *e, double *c, double *r, datetime_sec *); +int get_rate(const char *expression, double *rate); +int is_rate_ok(const char *file, const char *rate_exp, unsigned long *e, double *c, double *r, datetime_sec *); #endif diff --git a/indimail-mta-x/do_ripmime.c b/indimail-mta-x/do_ripmime.c index 804b18cf48..5439b5bf54 100644 --- a/indimail-mta-x/do_ripmime.c +++ b/indimail-mta-x/do_ripmime.c @@ -1,5 +1,8 @@ /* * $Log: do_ripmime.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-08-30 01:07:47+05:30 Cprogrammer * renamed pid as cmd_pid * @@ -56,7 +59,7 @@ do_ripmime() void getversion_do_ripmime_c() { - static char *x = "$Id: do_ripmime.c,v 1.2 2021-08-30 01:07:47+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: do_ripmime.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/do_scan.c b/indimail-mta-x/do_scan.c index 8c33d24ba5..09ad4eb4e9 100644 --- a/indimail-mta-x/do_scan.c +++ b/indimail-mta-x/do_scan.c @@ -1,5 +1,5 @@ /* - * $Id: do_scan.c,v 1.20 2023-10-27 16:10:57+05:30 Cprogrammer Exp mbhangui $ + * $Id: do_scan.c,v 1.21 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -49,7 +49,7 @@ die(int e) } int -scan_badattachments(char *dir_name) +scan_badattachments(const char *dir_name) { DIR *dir; struct dirent *dp; @@ -146,7 +146,7 @@ do_scan() _exit(QQ_OUT_OF_MEMORY); for (i = 1;scancmd[i];i++) { if (!str_diffn(scancmd[i], "%s", 2)) - scancmd[i] = "."; + scancmd[i] = (char *) "."; } } else scancmd = auto_scancmd; @@ -179,7 +179,7 @@ do_scan() void getversion_do_scan_c() { - static char *x = "$Id: do_scan.c,v 1.20 2023-10-27 16:10:57+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: do_scan.c,v 1.21 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; @@ -188,6 +188,9 @@ getversion_do_scan_c() /* * $Log: do_scan.c,v $ + * Revision 1.21 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.20 2023-10-27 16:10:57+05:30 Cprogrammer * replace hard-coded exit values with constants from qmail.h * diff --git a/indimail-mta-x/doc/ChangeLog b/indimail-mta-x/doc/ChangeLog index 6e8f1b1cc2..41bac847a8 100644 --- a/indimail-mta-x/doc/ChangeLog +++ b/indimail-mta-x/doc/ChangeLog @@ -15,6 +15,8 @@ Release @version@-@release@ Start 05/02/2024 End XX/XX/XXXX 05. test-indimail-mta: updated test script 06. svctool: fixed setting of mysqld options and variables 07. svctool: removed log-error and mysql-native-password +- 09/05/2024 +08. fix discarded-qualifier compiler warnings * Sun Mar 03 2024 12:20:15 +0000 Manvendra Bhangui 3.0.7-1.1%{?dist} Release 3.0.7-1.1 Start 02/01/2024 End 03/02/2024 diff --git a/indimail-mta-x/dossl.c b/indimail-mta-x/dossl.c index cebda21bd8..b4004f63b5 100644 --- a/indimail-mta-x/dossl.c +++ b/indimail-mta-x/dossl.c @@ -1,5 +1,5 @@ /* - * $Id: dossl.c,v 1.5 2023-08-28 22:24:25+05:30 Cprogrammer Exp mbhangui $ + * $Id: dossl.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "hastlsa.h" #if defined(TLS) || defined(TLSA) @@ -31,7 +31,6 @@ extern unsigned long smtpcode(); static SSL_CTX *ctx; static stralloc saciphers, tlsFilename, clientcert, certdir_s; -extern char *certdir; extern int timeoutconn; extern int timeoutdata; extern substdio smtpto; @@ -46,7 +45,7 @@ verify_cb(int preverify_ok, X509_STORE_CTX *ctx_dummy) } int -match_partner(char *s, int len, char *fqdn) +match_partner(char *s, int len, const char *fqdn) { if (!case_diffb(fqdn, len, (char *) s) && !fqdn[len]) return 1; @@ -60,8 +59,8 @@ match_partner(char *s, int len, char *fqdn) } void -do_pkix(SSL *ssl, char *servercert, char *fqdn, - void(*tlsquit)(const char *s1, char *s2, char *s3, char *s4, char *s5, stralloc *s), +do_pkix(SSL *ssl, const char *servercert, const char *fqdn, + void(*tlsquit)(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, stralloc *s), void(*mem_err)(), stralloc *stext) { @@ -158,13 +157,13 @@ do_pkix(SSL *ssl, char *servercert, char *fqdn, */ int do_tls(SSL **ssl, int pkix, int smtps, int smtpfd, int *needtlsauth, - char **scert, char *fqdn, char *_host, int hostlen, - void(*tlsquit)(const char *s1, char *s2, char *s3, char *s4, char *s5, stralloc *s), + char **scert, const char *fqdn, const char *_host, int hostlen, + void(*tlsquit)(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, stralloc *s), void(*mem_err)(), void(*ctrl_err)(), void(*write_err)(), #ifdef HAVE_STDARG_H - void(*quit)(int code, int e, char *p, ...), + void(*quit)(int code, int e, const char *p, ...), #else void(*quit)(), #endif @@ -175,7 +174,7 @@ do_tls(SSL **ssl, int pkix, int smtps, int smtpfd, int *needtlsauth, int code, i = 0, _needtlsauth = 0, method; static char ssl_initialized; const char *ciphers = NULL; - char *t, *servercert = NULL, *certfile; + const char *t, *servercert = NULL, *certfile; static SSL *myssl; stralloc ssl_option = { 0 }; int method_fail; @@ -501,8 +500,8 @@ stralloc certData = { 0 }; stralloc hextmp = { 0 }; int tlsa_vrfy_records(SSL *ssl, char *certDataField, int usage, int selector, - int match_type, char *fqdn, - void(*tlsquit)(const char *s1, char *s2, char *s3, char *s4, char *s5, stralloc *s), + int match_type, const char *fqdn, + void(*tlsquit)(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, stralloc *s), void(*mem_err)(), stralloc *stext, void(*out)(), @@ -731,13 +730,16 @@ tlsa_vrfy_records(SSL *ssl, char *certDataField, int usage, int selector, void getversion_dossl_c() { - static char *x = "$Id: dossl.c,v 1.5 2023-08-28 22:24:25+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dossl.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: dossl.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-08-28 22:24:25+05:30 Cprogrammer * return 2 for tls connection failure * diff --git a/indimail-mta-x/dossl.h b/indimail-mta-x/dossl.h index 39c5130cdb..f2f51e7a20 100644 --- a/indimail-mta-x/dossl.h +++ b/indimail-mta-x/dossl.h @@ -1,5 +1,5 @@ /* - * $Id: dossl.h,v 1.2 2023-01-15 12:27:37+05:30 Cprogrammer Exp mbhangui $ + * $Id: dossl.h,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef _DOSSL_H_ #define _DOSSL_H_ @@ -12,19 +12,19 @@ GEN_ALLOC_typedef(saa, stralloc, sa, len, a) #ifdef TLS -void do_pkix(SSL *, char *, char *, - void (*tlsquit)(const char *, char *, char *, char *, char *, stralloc *), +void do_pkix(SSL *, const char *, const char *, + void (*tlsquit)(const char *, const char *, const char *, const char *, const char *, stralloc *), void (*mem_err)(), stralloc *); #ifdef HAVE_STDARG_H -int do_tls(SSL **, int, int, int, int *, char **, char *, char *, int, - void (*tlsquit)(const char *, char *, char *, char *, char *, stralloc *), +int do_tls(SSL **, int, int, int, int *, char **, const char *, const char *, int, + void (*tlsquit)(const char *, const char *, const char *, const char *, const char *, stralloc *), void (*mem_err)(), void (*ctrl_err)(), void (*write_err)(), - void (*quit)(int, int, char *, ...), + void (*quit)(int, int, const char *, ...), stralloc *, saa * _ehlokw, int); #else int do_tls(SSL **, int, int, int, int *, char **, char *, char *, int, - void (*tlsquit)(const char *, char *, char *, char *, char *, stralloc *), + void (*tlsquit)(const char *, const char *, const char *, const char *, const char *, stralloc *), void (*mem_err)(), void (*ctrl_err)(), void (*write_err)(), void (*quit)(), stralloc *, saa * _ehlokw, int); @@ -32,8 +32,8 @@ int do_tls(SSL **, int, int, int, int *, char **, char *, char *, in #endif #ifdef HASTLSA int - tlsa_vrfy_records(SSL *, char *, int, int, int, char *, - void (*tlsquit)(const char *, char *, char *, char *, char *, stralloc *), + tlsa_vrfy_records(SSL *, char *, int, int, int, const char *, + void (*tlsquit)(const char *, const char *, const char *, const char *, const char *, stralloc *), void(*mem_err)(), stralloc *, void(*out)(), void(*flush)(), char **, int); #endif #endif /*- _DOSSL_H_ */ diff --git a/indimail-mta-x/dot-forward.c b/indimail-mta-x/dot-forward.c index 77479364f5..eb0e617ff8 100644 --- a/indimail-mta-x/dot-forward.c +++ b/indimail-mta-x/dot-forward.c @@ -1,5 +1,8 @@ /* * $Log: dot-forward.c,v $ + * Revision 1.18 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.17 2024-01-23 01:24:06+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -87,13 +90,8 @@ stralloc line = { 0 }; int flagdoit = 1; int flagacted; int flagdirect; -char *ufline; -char *rpline; -char *dtline; -char *sender; -char *user; +const char *ufline, *rpline, *dtline, *sender, *user, *host; int userlen; -char *host; int hostlen; char messbuf[1024]; substdio ssmess; @@ -110,7 +108,7 @@ token822_alloc tokaddr = { 0 }; stralloc address = { 0 }; struct qmail qq; unsigned long qp; -char *qqx; +const char *qqx; char strnum[FMT_ULONG]; char qqbuf[BUFSIZE_OUT]; substdio ssqq = SUBSTDIO_FDBUF(mywrite, -1, qqbuf, sizeof qqbuf); @@ -160,8 +158,7 @@ blindwrite(fd, buf, len) } void -run(cmd) - char *cmd; +run(char *cmd) { int child; int pi[2]; @@ -183,8 +180,8 @@ run(cmd) close(pi[1]); if (fd_move(0, pi[0]) == -1) strerr_die2sys(111, FATAL, "unable to set fd: "); - args[0] = "/bin/sh"; - args[1] = "-c"; + args[0] = (char *) "/bin/sh"; + args[1] = (char *) "-c"; args[2] = cmd; args[3] = 0; sig_pipedefault(); @@ -525,7 +522,7 @@ main(argc, argv) void getversion_dot_forward_c() { - static char *x = "$Id: dot-forward.c,v 1.17 2024-01-23 01:24:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dot-forward.c,v 1.18 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/drate.c b/indimail-mta-x/drate.c index f8aeed1f2e..70f0d1bc5b 100644 --- a/indimail-mta-x/drate.c +++ b/indimail-mta-x/drate.c @@ -1,5 +1,8 @@ /* * $Log: drate.c,v $ + * Revision 1.24 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.23 2024-02-12 19:37:46+05:30 Cprogrammer * replace chown with fchown * @@ -112,23 +115,23 @@ static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static char sserrbuf[512]; static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); static stralloc qdir = { 0 }; -static char *usage = "usage: drate [-sulcR] [-t -C count] -d domain -r deliveryRate [-D ratelimit_dir]\n"; -static char *daytab[7] = { +const char *usage = "usage: drate [-sulcR] [-t -C count] -d domain -r deliveryRate [-D ratelimit_dir]\n"; +const char *daytab[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -static char *montab[12] = { +const char *montab[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -137,7 +140,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, int exit_val) +my_error(const char *s1, int exit_val) { logerr(s1); logerrf("\n"); @@ -145,7 +148,7 @@ my_error(char *s1, int exit_val) } no_return void -cleanup(char *file, char *str, int e) +cleanup(const char *file, const char *str, int e) { if (e == error_noent) (void) unlink(file); @@ -185,7 +188,7 @@ qtime_mess822(datetime_sec t) stralloc line = { 0 }, rexpr = { 0 }; void -do_display(char *domain) +do_display(const char *domain) { int rfd, match, line_no; unsigned long email_count = 0; @@ -321,7 +324,7 @@ do_list(int display) } void -update_mode(char *domain, char *rate_expr, int reset_mode, int consolidate, int incr) +update_mode(const char *domain, const char *rate_expr, int reset_mode, int consolidate, int incr) { int rfd, wfd, match, line_no, t; unsigned long email_count; @@ -445,7 +448,7 @@ update_mode(char *domain, char *rate_expr, int reset_mode, int consolidate, int } void -do_test(char *domain, int force) +do_test(const char *domain, int force) { int i = -1; char *rate_expr = 0; @@ -516,7 +519,7 @@ main(int argc, char **argv) int i, ch, display = 0, listing = 0, incr = 0, count = 1, consolidate = 0, reset_mode = 0, test_mode = 0, force = 0; - char *qbase, *domain = 0, *rate_expr = 0, + const char *qbase, *domain = 0, *rate_expr = 0, *ptr, *ratelimit_dir = "ratelimit"; while ((ch = getopt(argc, argv, "flutscRd:r:D:C:")) != sgoptdone) { @@ -636,7 +639,7 @@ main(int argc, char **argv) void getversion_drate_c() { - static char *x = "$Id: drate.c,v 1.23 2024-02-12 19:37:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: drate.c,v 1.24 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidgetdomainth; x = sccsidevalh; diff --git a/indimail-mta-x/envrules.c b/indimail-mta-x/envrules.c index f54108c890..28bac12d6d 100644 --- a/indimail-mta-x/envrules.c +++ b/indimail-mta-x/envrules.c @@ -1,5 +1,5 @@ /* - * $Id: envrules.c,v 1.24 2023-12-05 22:06:08+05:30 Cprogrammer Exp mbhangui $ + * $Id: envrules.c,v 1.25 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -12,10 +12,11 @@ #include "do_match.h" int -envrules(char *email, char *envrules_f, char *rulesfile, char **errStr) +envrules(const char *email, const char *envrules_f, const char *rulesfile, const char *errStr[]) { int len, count, lcount, nullflag, use_regex = 0; - char *ptr, *cptr; + const char *ptr; + char *cptr; static stralloc rules = { 0 }; if (errStr) @@ -33,7 +34,7 @@ envrules(char *email, char *envrules_f, char *rulesfile, char **errStr) scan_int(ptr, &use_regex); for (count = lcount = len = 0, ptr = rules.s; len < rules.len;) { len += (str_len(ptr) + 1); - for (cptr = ptr;*cptr && *cptr != ':';cptr++); + for (cptr = (char *) ptr; *cptr && *cptr != ':'; cptr++); if (*cptr == ':') *cptr = 0; else { @@ -56,10 +57,11 @@ envrules(char *email, char *envrules_f, char *rulesfile, char **errStr) } int -domainqueue(char *email, char *domainqueue_f, char *domainqueue, char **errStr) +domainqueue(const char *email, const char *domainqueue_f, const char *domainqueue, const char *errStr[]) { int len, lcount, count; - char *ptr, *cptr, *domain; + const char *ptr, *domain; + char *cptr; static stralloc rules = { 0 }; if (errStr) @@ -80,7 +82,7 @@ domainqueue(char *email, char *domainqueue_f, char *domainqueue, char **errStr) domain++; for (count = lcount = len = 0, ptr = rules.s; len < rules.len;) { len += (str_len(ptr) + 1); - for (cptr = ptr;*cptr && *cptr != ':';cptr++); + for (cptr = (char *) ptr; *cptr && *cptr != ':'; cptr++); if (*cptr == ':') *cptr = 0; else { @@ -101,13 +103,16 @@ domainqueue(char *email, char *domainqueue_f, char *domainqueue, char **errStr) void getversion_envrules_c() { - static char *x = "$Id: envrules.c,v 1.24 2023-12-05 22:06:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: envrules.c,v 1.25 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: envrules.c,v $ + * Revision 1.25 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.24 2023-12-05 22:06:08+05:30 Cprogrammer * fix for invalid rules * diff --git a/indimail-mta-x/envrules.h b/indimail-mta-x/envrules.h index 8903bc737f..3d0a1b3870 100644 --- a/indimail-mta-x/envrules.h +++ b/indimail-mta-x/envrules.h @@ -1,5 +1,8 @@ /* * $Log: envrules.h,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2014-01-29 14:06:10+05:30 Cprogrammer * made domainqueue file configurable through env variable DOMAINQUEUE * @@ -24,8 +27,8 @@ */ #ifndef _ENVRULES_H #define _ENVRULES_H -int envrules(char *, char *, char *, char **); -int domainqueue(char *, char *, char *, char **); +int envrules(const char *, const char *, const char *, const char *err[]); +int domainqueue(const char *, const char *, const char *, const char *err[]); #ifndef AM_MEMORY_ERR #define AM_MEMORY_ERR -1 diff --git a/indimail-mta-x/estack.c b/indimail-mta-x/estack.c deleted file mode 100644 index 5ebdf6da1c..0000000000 --- a/indimail-mta-x/estack.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * $Log: estack.c,v $ - * Revision 1.3 2008-08-12 10:16:38+05:30 Cprogrammer - * added comments - * - * Revision 1.2 2008-08-07 13:20:48+05:30 Cprogrammer - * fixed bug with allocation - * - * Revision 1.1 2008-08-02 14:20:00+05:30 Cprogrammer - * Initial revision - * - */ -#include "substdio.h" -#include "str.h" -#include "error.h" -#include -#include -#include - -char *estack(int, const char *errorst); - -void -discard_stack(void) -{ - estack(0, 0); - return; -} - -void -free_stack(void) -{ - estack(2, 0); - return; -} - -char * -estack(int fderr, const char *errorstr) -{ - unsigned int len, i, tmperrno; - static int mylen; - char *ptr, *cptr; - static char *error_store; - static char sserrbuf[512]; - substdio sserr; - - substdio_fdbuf(&sserr, write, fderr, sserrbuf, sizeof(sserrbuf)); - if (errorstr && *errorstr) { - len = str_len((char *) errorstr) + 1; /* string + 1 null byte */ - if (!(error_store = realloc(error_store, mylen + len + 1))) { /*- The man page is wierd on Mac OS */ - tmperrno = errno; - if (substdio_puts(&sserr, (char *) errorstr)) - return((char *) 0); - if (substdio_puts(&sserr, "estack: realloc: ")); - return((char *) 0); - if (substdio_puts(&sserr, error_str(tmperrno))) - return((char *) 0); - if (substdio_puts(&sserr, "\n") == -1) - return((char *) 0); - if (substdio_flush(&sserr) == -1) - return((char *) 0); - return ((char *) 0); - } - if (!mylen && atexit(free_stack)) { - if (substdio_puts(&sserr, "atexit: ") == -1) - return((char *) 0); - if (substdio_puts(&sserr, error_str(errno))) - return((char *) 0); - if (substdio_puts(&sserr, "\n") == -1) - return((char *) 0); - if (substdio_flush(&sserr) == -1) - return((char *) 0); - } - for (ptr = (char *) errorstr, cptr = error_store + mylen;*ptr;*cptr++ = *ptr++); - error_store[mylen + len - 1] = 0; - mylen += len; - return (error_store); - } else { - if (!error_store) - return ((char *) 0); - if (!sserr) { /*- discard all error messages stored */ - free(error_store); - error_store = 0; - mylen = 0; - substdio_flush(&sserr); - return((char *) 0); - } - for (ptr = error_store, i = len = 0; len < mylen; len++, ptr++) { - if (*ptr == 0) { - if (substdio_puts(&sserr, error_store + i)) - return((char *) 0); - i = len + 1; - } - } - free(error_store); - error_store = 0; - mylen = 0; - if (substdio_flush(&sserr) == -1) - return((char *) 0); - return (""); - } -} - -void -getversion_estack_qc() -{ - static char *x = "$Id: estack.c,v 1.3 2008-08-12 10:16:38+05:30 Cprogrammer Stab mbhangui $"; - x++; /*- No dollar for OSS/FS */ -} diff --git a/indimail-mta-x/etrn.c b/indimail-mta-x/etrn.c index b46d12bbee..9b63daf8ec 100644 --- a/indimail-mta-x/etrn.c +++ b/indimail-mta-x/etrn.c @@ -1,5 +1,5 @@ /* - * $Id: etrn.c,v 1.21 2024-02-08 20:37:08+05:30 Cprogrammer Exp mbhangui $ + * $Id: etrn.c,v 1.22 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -25,13 +25,13 @@ extern int err_child(); extern void die_nomem(); -extern void die_control(char *); -static stralloc etrn, etrndir, lockfile; +extern void die_control(const char *); +static stralloc etrn, etrndir, lockfile, t; static char *binetrnargs[5] = { 0, 0, 0, 0, (char *) 0 }; int -etrn_queue(char *arg, char *remoteip) +etrn_queue(const char *arg, const char *remoteip) { int child, flagetrn, len, exitcode, wstat, fd; size_t mailcount; @@ -49,16 +49,20 @@ etrn_queue(char *arg, char *remoteip) return -2; if (!constmap_init(&mapetrn, etrn.s, etrn.len, 0)) die_nomem(); - case_lowerb(arg, len = str_len(arg)); /*- convert into lower case */ - if (!constmap(&mapetrn, arg, len)) + if (!stralloc_copys(&t, arg) || + !stralloc_0(&t)) + die_nomem(); + t.len--; + case_lowerb(t.s, len = t.len); /*- convert into lower case */ + if (!constmap(&mapetrn, t.s, t.len)) return -2; - if (rcpthosts(arg, len, 1) != 1) + if (rcpthosts(t.s, t.len, 1) != 1) return -2; if (!(dir = read_assign("autoturn", NULL, NULL, NULL))) return -2; if (!stralloc_copys(&etrndir, dir) || !stralloc_append(&etrndir, "/") || - !stralloc_cats(&etrndir, arg) || + !stralloc_catb(&etrndir, t.s, t.len) || !stralloc_0(&etrndir)) die_nomem(); mailcount = 0; @@ -114,7 +118,7 @@ etrn_queue(char *arg, char *remoteip) !stralloc_0(&bin)) strerr_die1x(111, "etrn: fatal: out of memory"); binetrnargs[0] = bin.s; - binetrnargs[1] = arg; + binetrnargs[1] = t.s; binetrnargs[2] = dir; binetrnargs[3] = etrndir.s; execv(*binetrnargs, binetrnargs); @@ -138,7 +142,7 @@ etrn_queue(char *arg, char *remoteip) void getversion_etrn_c() { - static char *x = "$Id: etrn.c,v 1.21 2024-02-08 20:37:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: etrn.c,v 1.22 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -146,6 +150,9 @@ getversion_etrn_c() /* * $Log: etrn.c,v $ + * Revision 1.22 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.21 2024-02-08 20:37:08+05:30 Cprogrammer * fixed arguments to die_control() * diff --git a/indimail-mta-x/etrn.h b/indimail-mta-x/etrn.h index 2d46e0bee3..d5f38b664b 100644 --- a/indimail-mta-x/etrn.h +++ b/indimail-mta-x/etrn.h @@ -1,5 +1,8 @@ /* * $Log: etrn.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2023-12-03 12:22:48+05:30 Cprogrammer * moved hostname validation to valid_hname.c * @@ -10,6 +13,6 @@ #ifndef ETRN_H #define ETRN_H -int etrn_queue(char *, char *); +int etrn_queue(const char *, const char *); #endif diff --git a/indimail-mta-x/except.c b/indimail-mta-x/except.c index 750366cc6d..97466d46ed 100644 --- a/indimail-mta-x/except.c +++ b/indimail-mta-x/except.c @@ -1,5 +1,8 @@ /* * $Log: except.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2020-11-24 13:45:11+05:30 Cprogrammer * removed exit.h * @@ -57,7 +60,7 @@ main(argc, argv) void getversion_except_c() { - static char *x = "$Id: except.c,v 1.7 2020-11-24 13:45:11+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: except.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/fastforward.c b/indimail-mta-x/fastforward.c index 4ef8594102..82fad4663d 100644 --- a/indimail-mta-x/fastforward.c +++ b/indimail-mta-x/fastforward.c @@ -1,5 +1,5 @@ /* - * $Id: fastforward.c,v 1.14 2024-01-23 01:26:53+05:30 Cprogrammer Exp mbhangui $ + * $Id: fastforward.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -40,7 +40,7 @@ char qp[FMT_ULONG], qqbuf[1], messbuf[BUFSIZE_REMOTE]; substdio ssqq = SUBSTDIO_FDBUF(qqwrite, -1, qqbuf, sizeof qqbuf); substdio ssmess = SUBSTDIO_FDBUF(read, 0, messbuf, sizeof messbuf); int flagdeliver = 1, flagpassthrough = 0, fdcdb, flagdefault = 0; -char *dtline, *fncdb; +const char *dtline, *fncdb; stralloc sender, programs, forward, todo, mailinglist, key, data, recipient; strset done; uint32 dlen; @@ -58,7 +58,7 @@ nomem() } void -print(char *s) +print(const char *s) { char ch; @@ -67,7 +67,7 @@ print(char *s) } void -printsafe(char *s) +printsafe(const char *s) { char ch; @@ -86,7 +86,7 @@ qqwrite(int fd, char *buf, int len) } void -dofile(char *fn) +dofile(const char *fn) { int fd, i, j; struct stat st; @@ -125,7 +125,7 @@ cdbreaderror() } int -findtarget(int flagwild, char *prepend, char *addr) +findtarget(int flagwild, const char *prepend, const char *addr) { int r, at; @@ -162,7 +162,7 @@ findtarget(int flagwild, char *prepend, char *addr) } int -gettarget(int flagwild, char *prepend, char *addr) +gettarget(int flagwild, const char *prepend, const char *addr) { if (!findtarget(flagwild, prepend, addr)) return 0; @@ -175,7 +175,7 @@ gettarget(int flagwild, char *prepend, char *addr) } void -doprogram(char *arg) +doprogram(const char *arg) { char *args[5]; int child, wstat; @@ -188,15 +188,15 @@ doprogram(char *arg) return; } if (*arg == '!') { - args[0] = "preline"; - args[1] = "sh"; - args[2] = "-c"; - args[3] = arg + 1; + args[0] = (char *) "preline"; + args[1] = (char *) "sh"; + args[2] = (char *) "-c"; + args[3] = (char *) (arg + 1); args[4] = 0; } else { - args[0] = "sh"; - args[1] = "-c"; - args[2] = arg + 1; + args[0] = (char *) "sh"; + args[1] = (char *) "-c"; + args[2] = (char *) (arg + 1); args[3] = 0; } switch (child = vfork()) @@ -258,7 +258,7 @@ dodata() } void -dorecip(char *addr) +dorecip(const char *addr) { if (!findtarget(0, "?", addr) && gettarget(0, ":", addr)) { @@ -271,7 +271,7 @@ dorecip(char *addr) } void -doorigrecip(char *addr) +doorigrecip(const char *addr) { if (sender.len) { if ((sender.len != 4) || byte_diff(sender.s, 4, "#@[]")) { @@ -293,12 +293,13 @@ main(int argc, char **argv) { int opt, i; char *x; + const char *qqx; sig_pipeignore(); if (!(dtline = env_get("DTLINE"))) dtline = ""; if (!(x = env_get("SENDER"))) - x = "original envelope sender"; + x = (char *) "original envelope sender"; if (!stralloc_copys(&sender, x) || !stralloc_copys(&forward, "") || !strset_init(&done)) @@ -416,9 +417,9 @@ main(int argc, char **argv) forward.len = i; qmail_to(&qq, forward.s + i); } - x = qmail_close(&qq); - if (*x) - strerr_die2x(*x == 'D' ? 100 : 111, FATAL, x + 1); + qqx = qmail_close(&qq); + if (*qqx) + strerr_die2x(*qqx == 'D' ? 100 : 111, FATAL, qqx + 1); strerr_die2x(flagpassthrough ? 99 : 0, "fastforward: qp ", qp); /*- Not reached */ return(0); @@ -427,13 +428,16 @@ main(int argc, char **argv) void getversion_fastforward_c() { - static char *x = "$Id: fastforward.c,v 1.14 2024-01-23 01:26:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: fastforward.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: fastforward.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2024-01-23 01:26:53+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/filterit.h b/indimail-mta-x/filterit.h index 275fabdbdb..a9774cdc42 100644 --- a/indimail-mta-x/filterit.h +++ b/indimail-mta-x/filterit.h @@ -1,5 +1,5 @@ /* - * $Id: filterit.h,v 1.1 2023-09-19 01:09:48+05:30 Cprogrammer Exp mbhangui $ + * $Id: filterit.h,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef _FILTERIT_H_ #define _FILTERIT_H_ @@ -8,11 +8,14 @@ #define WARN "filterit: warn: " int filterit_sub1(int, char **); -int filterit_sub2(char *); +int filterit_sub2(const char *); #endif /* * $Log: filterit.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-09-19 01:09:48+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/filterit_sub.c b/indimail-mta-x/filterit_sub.c index 9da66382e1..0d690096f9 100644 --- a/indimail-mta-x/filterit_sub.c +++ b/indimail-mta-x/filterit_sub.c @@ -1,5 +1,5 @@ /* - * $Id: filterit_sub.c,v 1.7 2024-01-23 01:20:57+05:30 Cprogrammer Exp mbhangui $ + * $Id: filterit_sub.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -73,9 +73,9 @@ usage() } static int -logical_exp(char *data, char *expression) +logical_exp(const char *data, const char *expression) { - char *ptr; + const char *ptr; int i; static stralloc buf = {0}; struct val result; @@ -203,9 +203,10 @@ mywrite(int fd, char *buf, int len) } no_return static int -forward(substdio *ssin, char *faddr, int matched, int argc, char **argv) +forward(substdio *ssin, const char *faddr, int matched, int argc, char **argv) { - char *sender, *dt, *ptr, *qqx; + char *sender, *dt, *ptr; + const char *qqx; char outbuf[512], num[FMT_ULONG]; substdio qsout; @@ -270,16 +271,16 @@ forward(substdio *ssin, char *faddr, int matched, int argc, char **argv) } static int -take_action(substdio *ssin, substdio *ssout, char *header, int act_type, - char *act_val, int matched, char *bounce_message, int argc, char **argv) +take_action(substdio *ssin, substdio *ssout, const char *header, int act_type, + const char *act_val, int matched, const char *bounce_message, int argc, char **argv) { int i, wstat; pid_t child; uid_t uid; gid_t gid; char *home, *ptr; - char *MailDirNames[] = { "cur", "new", "tmp", }; - char *overquota = "Recipient's mailbox is full, message returned to sender. (#5.2.2)"; + const char *MailDirNames[] = { "cur", "new", "tmp", }; + const char *overquota = "Recipient's mailbox is full, message returned to sender. (#5.2.2)"; if (!doit && subprintf(ssout, matched ? "Matched Header=[%s], " : "Unmatched Header=[%s], ", header) == -1) @@ -393,15 +394,15 @@ take_action(substdio *ssin, substdio *ssout, char *header, int act_type, int filterit_sub1(int argc, char **argv) { - char *local, *domain, *header, *keyword, + const char *local, *domain, *header, *keyword, *action, *action_val, *d_action, *d_action_val, *comparision, *bounce_message, *ptr; - char *comp[] = { + const char *comp[] = { "Equals", "Contains", "Starts with", "Ends with", "Numerical Logical Expression", "RegExp", 0 }; - char *act[] = {"exit", "forward", "maildir", 0}; + const char *act[] = {"exit", "forward", "maildir", 0}; char ssinbuf[BUFSIZE_IN], ssoutbuf[BUFSIZE_OUT]; int opt, i, match, negate = 0, keep_continue = 0, c_opt = 0, a_opt = 0, default_a_opt = 0, in_header; @@ -574,10 +575,13 @@ filterit_sub1(int argc, char **argv) 1, bounce_message, argc, argv); break; case 1: /*- Contains */ - i = str_len(keyword); + if (!stralloc_copys(&tmp, keyword) || + !stralloc_0(&tmp)) + strerr_die2x(111, FATAL, "out of memory"); + tmp.len--; case_lowers(matched_header.s); - case_lowers(keyword); - match = str_str(matched_header.s + i, keyword) ? 1 : 0; + case_lowers(tmp.s); + match = str_str(matched_header.s + tmp.len, tmp.s) ? 1 : 0; if (negate) match = !match; if (match) @@ -631,7 +635,7 @@ filterit_sub1(int argc, char **argv) } int -filterit_sub2(char *cmd) +filterit_sub2(const char *cmd) { char **argv; int i; @@ -647,7 +651,7 @@ filterit_sub2(char *cmd) void getversion_filterit_c() { - char *x = sccsidevalh; + const char *x = sccsidevalh; x++; x = sccsidmakeargsh; x++; @@ -655,6 +659,9 @@ getversion_filterit_c() /* * $Log: filterit_sub.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2024-01-23 01:20:57+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/filterto.c b/indimail-mta-x/filterto.c index 1bbe6b3c64..90339dbbbc 100644 --- a/indimail-mta-x/filterto.c +++ b/indimail-mta-x/filterto.c @@ -1,5 +1,8 @@ /* * $Log: filterto.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2024-01-23 01:21:12+05:30 Cprogrammer * convert mywrite to ansic prototype * @@ -85,7 +88,7 @@ main(int argc, char **argv, char **envp) { char *sender, *dtline; int pid, wstat; - char *qqx; + const char *qqx; int pf[2]; if (!argv[1] || !argv[2]) @@ -146,7 +149,7 @@ main(int argc, char **argv, char **envp) void getversion_filterto_c() { - static char *x = "$Id: filterto.c,v 1.13 2024-01-23 01:21:12+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: filterto.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/fmt_xpid.c b/indimail-mta-x/fmt_xpid.c index 1b123b1f6c..1512d6abea 100644 --- a/indimail-mta-x/fmt_xpid.c +++ b/indimail-mta-x/fmt_xpid.c @@ -1,5 +1,8 @@ /* * $Log: fmt_xpid.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:25:26+05:30 Cprogrammer * added RCS id * @@ -43,7 +46,7 @@ fmt_xpid(register char *s, register pid_t u, const int n) void getversion_fmt_xpid_c() { - static char *x = "$Id: fmt_xpid.c,v 1.2 2004-10-22 20:25:26+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: fmt_xpid.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/fmtqfn.c b/indimail-mta-x/fmtqfn.c index 49f558d77c..ce5a984359 100644 --- a/indimail-mta-x/fmtqfn.c +++ b/indimail-mta-x/fmtqfn.c @@ -1,5 +1,8 @@ /* * $Log: fmtqfn.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-07-09 13:21:18+05:30 Cprogrammer * initialize conf_split variable * @@ -23,7 +26,7 @@ int conf_split; unsigned int -fmtqfn(char *s, char *dirslash, unsigned long id, int flagsplit) +fmtqfn(char *s, const char *dirslash, unsigned long id, int flagsplit) { unsigned int len; unsigned int i; @@ -58,7 +61,7 @@ fmtqfn(char *s, char *dirslash, unsigned long id, int flagsplit) void getversion_fmtqfn_c() { - static char *x = "$Id: fmtqfn.c,v 1.6 2021-07-09 13:21:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: fmtqfn.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/fmtqfn.h b/indimail-mta-x/fmtqfn.h index 57426c51d8..74545d1b72 100644 --- a/indimail-mta-x/fmtqfn.h +++ b/indimail-mta-x/fmtqfn.h @@ -1,5 +1,8 @@ /* * $Log: fmtqfn.h,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-06-27 10:44:51+05:30 Cprogrammer * moved conf_split variable to fmtqfn.c * @@ -15,7 +18,7 @@ #define FMTQFN 40 /*- maximum space needed, if len(dirslash) <= 10 */ -unsigned int fmtqfn(char *, char *, unsigned long, int); +unsigned int fmtqfn(char *, const char *, unsigned long, int); extern int conf_split; diff --git a/indimail-mta-x/fn_handler.c b/indimail-mta-x/fn_handler.c index 0121f2dcbf..aba4ea6c35 100644 --- a/indimail-mta-x/fn_handler.c +++ b/indimail-mta-x/fn_handler.c @@ -1,16 +1,15 @@ /* * $Log: fn_handler.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2018-04-25 21:36:33+05:30 Cprogrammer * Initial revision * */ int -fn_handler(errfn, timeoutfn, option, arg) - void (*errfn)(); - void (*timeoutfn)(); - int option; - char *arg; +fn_handler(void (*errfn)(), void (*timeoutfn)(), int option, const char *arg) { if (!option) (*errfn)(arg); @@ -22,7 +21,7 @@ fn_handler(errfn, timeoutfn, option, arg) void getversion_fn_handler_c() { - static char *x = "$Id: fn_handler.c,v 1.1 2018-04-25 21:36:33+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: fn_handler.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/fn_handler.h b/indimail-mta-x/fn_handler.h index a9742f238c..fc0059de7a 100644 --- a/indimail-mta-x/fn_handler.h +++ b/indimail-mta-x/fn_handler.h @@ -1,5 +1,8 @@ /* * $Log: fn_handler.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2018-04-25 21:37:00+05:30 Cprogrammer * Initial revision * @@ -7,6 +10,6 @@ #ifndef FN_HANDLER_H #define FN_HANDLER_H -int fn_handler(void (*)(), void (*)(), int, char *); +int fn_handler(void (*)(), void (*)(), int, const char *); #endif diff --git a/indimail-mta-x/forward.c b/indimail-mta-x/forward.c index 53e857e9e2..73fd46cbf7 100644 --- a/indimail-mta-x/forward.c +++ b/indimail-mta-x/forward.c @@ -1,5 +1,5 @@ /* - * $Id: forward.c,v 1.16 2023-09-19 22:29:56+05:30 Cprogrammer Exp mbhangui $ + * $Id: forward.c,v 1.17 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -44,7 +44,8 @@ static stralloc forwarded_for, forwarded_to; int main(int argc, char **argv) { - char *sender, *dtline, *qqeh, *qqx; + char *sender, *dtline, *qqeh; + const char *qqx; char **a; int x; @@ -113,13 +114,16 @@ main(int argc, char **argv) void getversion_forward_c() { - static char *x = "$Id: forward.c,v 1.16 2023-09-19 22:29:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: forward.c,v 1.17 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: forward.c,v $ + * Revision 1.17 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.16 2023-09-19 22:29:56+05:30 Cprogrammer * added X-Forwarded-To, X-Forwarded-For headers * include hassrs.h to enable SRS diff --git a/indimail-mta-x/generic.c b/indimail-mta-x/generic.c index 00e779c3f2..5ef09ad6ae 100644 --- a/indimail-mta-x/generic.c +++ b/indimail-mta-x/generic.c @@ -1,5 +1,5 @@ /* - * $Id: generic.c,v 1.7 2023-10-27 16:11:04+05:30 Cprogrammer Exp mbhangui $ + * $Id: generic.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -56,7 +56,7 @@ virusscan(char *messfn) void getversion_generic_c() { - static char *x = "$Id: generic.c,v 1.7 2023-10-27 16:11:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: generic.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; @@ -65,6 +65,9 @@ getversion_generic_c() /* * $Log: generic.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-10-27 16:11:04+05:30 Cprogrammer * replace hard-coded exit values with constants from qmail.h * diff --git a/indimail-mta-x/getDomainToken.c b/indimail-mta-x/getDomainToken.c index 2541289faa..950aaaee52 100644 --- a/indimail-mta-x/getDomainToken.c +++ b/indimail-mta-x/getDomainToken.c @@ -1,5 +1,8 @@ /* * $Log: getDomainToken.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2024-02-09 15:56:26+05:30 Cprogrammer * fix match for entries without local/remote directive * @@ -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; @@ -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 $"; + const char *x = "$Id: getDomainToken.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidwildmath; x = sccsidgetdomainth; diff --git a/indimail-mta-x/getDomainToken.h b/indimail-mta-x/getDomainToken.h index 27c79fca8c..415d3d635b 100644 --- a/indimail-mta-x/getDomainToken.h +++ b/indimail-mta-x/getDomainToken.h @@ -1,5 +1,8 @@ /* * $Log: getDomainToken.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-08-28 23:03:41+05:30 Cprogrammer * added dtype enum from variables.h * @@ -12,7 +15,7 @@ #include #ifndef lint -static char sccsidgetdomainth[] = "$Id: getDomainToken.h,v 1.2 2021-08-28 23:03:41+05:30 Cprogrammer Exp mbhangui $"; +static const char sccsidgetdomainth[] = "$Id: getDomainToken.h,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif typedef enum { @@ -22,6 +25,6 @@ typedef enum { local_or_remote, } dtype; -char *getDomainToken(char *, stralloc *); +char *getDomainToken(const char *, stralloc *); #endif diff --git a/indimail-mta-x/get_uid.c b/indimail-mta-x/get_uid.c index 1d06c7af1e..e83a6be7fc 100644 --- a/indimail-mta-x/get_uid.c +++ b/indimail-mta-x/get_uid.c @@ -1,5 +1,8 @@ /* * $Log: get_uid.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-02-14 07:49:06+05:30 Cprogrammer * added qcerts group ID for certificate group permission * renamed auto_uidc, auto_gidc to auto_uidv, auto_gidv @@ -66,7 +69,7 @@ GIDARRAY gid_a[] = {{QMAILG,-1,-1}, {NOFILESG,-1,-1}, {INDIGROUP,-1,-1}, {QSCANDG,-1,-1}, {QCERTSG, -1, -1}, {0}}; static int -get_uid(char *user, int exit_on_error) +get_uid(const char *user, int exit_on_error) { struct passwd *pw; int i, len; @@ -107,7 +110,7 @@ get_uid(char *user, int exit_on_error) } static int -get_gid(char *group, int exit_on_error) +get_gid(const char *group, int exit_on_error) { struct group *gr; int i, len; @@ -193,7 +196,7 @@ uidinit(int closeflag, int exit_on_error) return (0); } -char * +const char * get_user(uid_t uid) { struct passwd *pw; @@ -217,7 +220,7 @@ get_user(uid_t uid) return(pw->pw_name); } -char * +const char * get_group(gid_t gid) { struct group *gr; @@ -240,7 +243,7 @@ get_group(gid_t gid) void getversion_get_uid_c() { - static char *x = "$Id: get_uid.c,v 1.5 2023-02-14 07:49:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: get_uid.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/getconf.c b/indimail-mta-x/getconf.c index 473a82b877..79b75c6279 100644 --- a/indimail-mta-x/getconf.c +++ b/indimail-mta-x/getconf.c @@ -1,5 +1,8 @@ /* * $Log: getconf.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:25:33+05:30 Cprogrammer * added RCS id * @@ -16,13 +19,13 @@ static stralloc data = { 0 }; static void -nomem(char *fatal) +nomem(const char *fatal) { strerr_die2x(111, fatal, "out of memory"); } int -getconf(stralloc * sa, char *fn, int flagrequired, char *fatal, char *dir) +getconf(stralloc * sa, const char *fn, int flagrequired, const char *fatal, const char *dir) { int i; int j; @@ -63,7 +66,7 @@ getconf(stralloc * sa, char *fn, int flagrequired, char *fatal, char *dir) } int -getconf_line(stralloc * sa, char *fn, int flagrequired, char *fatal, char *dir) +getconf_line(stralloc * sa, const char *fn, int flagrequired, const char *fatal, const char *dir) { if (!getconf(sa, fn, flagrequired, fatal, dir)) return 0; @@ -74,7 +77,7 @@ getconf_line(stralloc * sa, char *fn, int flagrequired, char *fatal, char *dir) void getversion_getconf_c() { - static char *x = "$Id: getconf.c,v 1.2 2004-10-22 20:25:33+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: getconf.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/getconf.h b/indimail-mta-x/getconf.h index 3187711343..3bdc26af57 100644 --- a/indimail-mta-x/getconf.h +++ b/indimail-mta-x/getconf.h @@ -1,5 +1,8 @@ /* * $Log: getconf.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-11 13:54:04+05:30 Cprogrammer * added function prototypes * @@ -10,7 +13,7 @@ #ifndef GETCONF_H #define GETCONF_H -int getconf(stralloc *, char *, int, char *, char *); -int getconf_line(stralloc *, char *, int, char *, char *); +int getconf(stralloc *, const char *, int, const char *, const char *); +int getconf_line(stralloc *, const char *, int, const char *, const char *); #endif diff --git a/indimail-mta-x/getqueue.c b/indimail-mta-x/getqueue.c index 38ce34ff85..a430e0558e 100644 --- a/indimail-mta-x/getqueue.c +++ b/indimail-mta-x/getqueue.c @@ -1,5 +1,5 @@ /* - * $Id: getqueue.c,v 1.5 2023-10-27 16:22:13+05:30 Cprogrammer Exp mbhangui $ + * $Id: getqueue.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -21,7 +21,7 @@ #ifdef HASLIBRT int -queueNo_from_shm(char *ident) +queueNo_from_shm(const char *ident) { int shm, i, j, x, y, min, n = 1, qcount; int q[5]; @@ -127,7 +127,7 @@ queueNo_from_env() void getversion_getqueue_c() { - static char *x = "$Id: getqueue.c,v 1.5 2023-10-27 16:22:13+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: getqueue.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } @@ -135,6 +135,9 @@ getversion_getqueue_c() /* * $Log: getqueue.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-10-27 16:22:13+05:30 Cprogrammer * replace hard-coded exit values with constants from qmail.h * diff --git a/indimail-mta-x/getqueue.h b/indimail-mta-x/getqueue.h index d9af28d15c..b56e98ac40 100644 --- a/indimail-mta-x/getqueue.h +++ b/indimail-mta-x/getqueue.h @@ -1,5 +1,8 @@ /* * $Log: getqueue.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2022-03-30 21:08:56+05:30 Cprogrammer * removed time argument * @@ -13,7 +16,7 @@ #include "haslibrt.h" #ifdef HASLIBRT -int queueNo_from_shm(char *); +int queueNo_from_shm(const char *); #endif int queueNo_from_env(); diff --git a/indimail-mta-x/gfrom.c b/indimail-mta-x/gfrom.c index 8a586aec8f..04d92390c4 100644 --- a/indimail-mta-x/gfrom.c +++ b/indimail-mta-x/gfrom.c @@ -1,5 +1,8 @@ /* * $Log: gfrom.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-22 20:25:40+05:30 Cprogrammer * added RCS id * @@ -26,7 +29,7 @@ gfrom(s, len) void getversion_gfrom_c() { - static char *x = "$Id: gfrom.c,v 1.3 2004-10-22 20:25:40+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: gfrom.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/greylist.c b/indimail-mta-x/greylist.c index 572181c101..011a80f2c1 100644 --- a/indimail-mta-x/greylist.c +++ b/indimail-mta-x/greylist.c @@ -1,5 +1,8 @@ /* * $Log: greylist.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2018-05-30 23:25:31+05:30 Cprogrammer * moved noipv6 variable to variables.c * @@ -80,7 +83,8 @@ scan_ip_port(gip, defaultip, defaultport, ipp, portp) int n; unsigned long port; /* long because of scan_ulong */ #ifdef IPV6 - char *ptr, *ip_a; + char *ptr; + const char *ip_a; #endif #ifdef IPV6 @@ -93,7 +97,7 @@ scan_ip_port(gip, defaultip, defaultport, ipp, portp) port = defaultport; } else { ip_a = (*gip == '@' && !*(gip + 1)) ? defaultip : gip; - for (ptr = ip_a;*ptr;ptr++) { + for (ptr = (char *) ip_a; *ptr; ptr++) { if (*ptr == '@' && scan_ulong(ptr + 1, &port)) { *portp = port; break; @@ -201,10 +205,8 @@ stralloc chkpacket = {0}; stralloc ipbuf = {0}; int -greylist(gip, connectingip, from, tolist, tolen, timeoutfn, errfn) - char *gip, *connectingip, *from, *tolist; - int tolen; - void (*timeoutfn) (), (*errfn) (); /*- errfn must _exit */ +greylist(const char *gip, const char *connectingip, const char *from, + const char *tolist, int tolen, void (*timeoutfn) (), void (*errfn) ()) /*- errfn must _exit */ { int r, len = 0; char strnum[FMT_ULONG]; @@ -281,7 +283,7 @@ greylist(gip, connectingip, from, tolist, tolen, timeoutfn, errfn) void getversion_greylist_c() { - static char *x = "$Id: greylist.c,v 1.13 2018-05-30 23:25:31+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: greylist.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/greylist.h b/indimail-mta-x/greylist.h index dfec72009d..58a5457371 100644 --- a/indimail-mta-x/greylist.h +++ b/indimail-mta-x/greylist.h @@ -1,5 +1,8 @@ /* * $Log: greylist.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2009-08-22 19:00:29+05:30 Cprogrammer * Initial revision based on code by Richard Andrews * @@ -12,6 +15,6 @@ #define DEFAULTGREYIP "127.0.0.1" #define GREYTIMEOUT 3 -int greylist(char *, char *, char *, char *, int, void (*)(), void (*)()); +int greylist(const char *, const char *, const char *, const char *, int, void (*)(), void (*)()); #endif diff --git a/indimail-mta-x/headerbody.c b/indimail-mta-x/headerbody.c index c4dbc14de8..e20c3f704a 100644 --- a/indimail-mta-x/headerbody.c +++ b/indimail-mta-x/headerbody.c @@ -1,5 +1,8 @@ /* * $Log: headerbody.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-22 20:25:42+05:30 Cprogrammer * added RCS id * @@ -14,10 +17,7 @@ #include "headerbody.h" static int -getsa(ss, sa, match) - substdio *ss; - stralloc *sa; - int *match; +getsa(substdio *ss, stralloc *sa, int *match) { if (!*match) return 0; @@ -36,14 +36,9 @@ static stralloc line = { 0 }; static stralloc nextline = { 0 }; int -headerbody(ss, dohf, hdone, dobl) - substdio *ss; - void (*dohf) (); - void (*hdone) (); - void (*dobl) (); +headerbody(substdio *ss, void (*dohf) (), void (*hdone) (), void (*dobl) ()) { - int match; - int flaglineok; + int match, flaglineok; match = 1; flaglineok = 0; @@ -115,7 +110,7 @@ headerbody(ss, dohf, hdone, dobl) void getversion_headerbody_c() { - static char *x = "$Id: headerbody.c,v 1.3 2004-10-22 20:25:42+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: headerbody.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/hfield.c b/indimail-mta-x/hfield.c index dbaabdcbef..33bd8a69b0 100644 --- a/indimail-mta-x/hfield.c +++ b/indimail-mta-x/hfield.c @@ -1,5 +1,8 @@ /* * $Log: hfield.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2004-10-22 20:25:43+05:30 Cprogrammer * added RCS id * @@ -9,7 +12,7 @@ */ #include "hfield.h" -static char *(hname[]) = +const char *(hname[]) = { "unknown-header", "sender", @@ -44,28 +47,22 @@ static char *(hname[]) = }; static int -hmatch(s, len, t) - char *s; - int len; - char *t; +hmatch(const char *s, int len, const char *t) { int i; char ch; - for (i = 0; (ch = t[i]); ++i) - { + for (i = 0; (ch = t[i]); ++i) { if (i >= len) return 0; - if (ch != s[i]) - { + if (ch != s[i]) { if (ch == '-') return 0; if (ch - 32 != s[i]) return 0; } } - for (;;) - { + for (;;) { if (i >= len) return 0; ch = s[i]; @@ -78,12 +75,10 @@ hmatch(s, len, t) } int -hfield_known(s, len) - char *s; - int len; +hfield_known(const char *s, int len) { int i; - char *t; + const char *t; for (i = 1; (t = hname[i]); ++i) if (hmatch(s, len, t)) @@ -92,12 +87,9 @@ hfield_known(s, len) } int -hfield_valid(s, len) - char *s; - int len; +hfield_valid(const char *s, int len) { - int i; - int j; + int i, j; char ch; for (j = 0; j < len; ++j) @@ -126,9 +118,7 @@ hfield_valid(s, len) } unsigned int -hfield_skipname(s, len) - char *s; - int len; +hfield_skipname(const char *s, int len) { int i; char ch; @@ -151,7 +141,7 @@ hfield_skipname(s, len) void getversion_hfield_c() { - static char *x = "$Id: hfield.c,v 1.4 2004-10-22 20:25:43+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: hfield.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/hfield.h b/indimail-mta-x/hfield.h index 17ebfe7501..0427eae57e 100644 --- a/indimail-mta-x/hfield.h +++ b/indimail-mta-x/hfield.h @@ -1,5 +1,8 @@ /* * $Log: hfield.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-11 13:54:20+05:30 Cprogrammer * added function prototypes * @@ -40,8 +43,8 @@ #define H_MAILFOLLOWUPTO 28 #define H_NUM 29 -unsigned int hfield_skipname(char *, int); -int hfield_known(char *, int); -int hfield_valid(char *, int); +unsigned int hfield_skipname(const char *, int); +int hfield_known(const char *, int); +int hfield_valid(const char *, int); #endif diff --git a/indimail-mta-x/hostname.c b/indimail-mta-x/hostname.c index 03a5377ed8..59a5f3245c 100644 --- a/indimail-mta-x/hostname.c +++ b/indimail-mta-x/hostname.c @@ -1,5 +1,8 @@ /* * $Log: hostname.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2020-11-24 13:45:23+05:30 Cprogrammer * removed exit.h * @@ -34,7 +37,7 @@ main() void getversion_hostname_c() { - static char *x = "$Id: hostname.c,v 1.7 2020-11-24 13:45:23+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: hostname.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ifaddr.c b/indimail-mta-x/ifaddr.c index 05329ce044..37e5283a01 100644 --- a/indimail-mta-x/ifaddr.c +++ b/indimail-mta-x/ifaddr.c @@ -1,5 +1,8 @@ /* * $Log: ifaddr.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:21:26+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -155,7 +158,7 @@ main(int argc, char **argv) void getversion_ifaddr_c() { - static char *x = "$Id: ifaddr.c,v 1.5 2024-01-23 01:21:26+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ifaddr.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/iftocc.c b/indimail-mta-x/iftocc.c index 4222db78e7..ecf0807686 100644 --- a/indimail-mta-x/iftocc.c +++ b/indimail-mta-x/iftocc.c @@ -1,5 +1,8 @@ /* * $Log: iftocc.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -105,7 +108,7 @@ main(int argc, char **argv) void getversion_iftocc_c() { - static char *x = "$Id: iftocc.c,v 1.4 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: iftocc.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/iftoccfrom.c b/indimail-mta-x/iftoccfrom.c index e7d014bd1f..704963379b 100644 --- a/indimail-mta-x/iftoccfrom.c +++ b/indimail-mta-x/iftoccfrom.c @@ -1,5 +1,8 @@ /* * $Log: iftoccfrom.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-01-23 01:24:13+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -101,7 +104,7 @@ main(int argc, char **argv) void getversion_iftoccfrom_c() { - static char *x = "$Id: iftoccfrom.c,v 1.5 2024-01-23 01:24:13+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: iftoccfrom.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/indimail_stub.c b/indimail-mta-x/indimail_stub.c index 9a43131e93..89ac3d66ed 100644 --- a/indimail-mta-x/indimail_stub.c +++ b/indimail-mta-x/indimail_stub.c @@ -1,5 +1,8 @@ /* * $Log: indimail_stub.c,v $ + * Revision 1.18 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.17 2023-04-01 19:26:44+05:30 Cprogrammer * refactored getlibObject function * @@ -100,7 +103,7 @@ static char ctlerr[] = "unable to read controls"; static stralloc errbuf = { 0 }; void * -loadLibrary(void **handle, char *libenv, int *errflag, char **errstr) +loadLibrary(void **handle, const char *libenv, int *errflag, const char *errstr[]) { char *ptr; int i; @@ -204,7 +207,7 @@ closeLibrary(void **handle) } void * -getlibObject(char *libenv, void **handle, char *plugin_symb, char **errstr) +getlibObject(const char *libenv, void **handle, const char *plugin_symb, const char *errstr[]) { void *i; char *ptr; @@ -230,7 +233,7 @@ getlibObject(char *libenv, void **handle, char *plugin_symb, char **errstr) } static void -getEnvConfigStr(char **source, char *envname, char *defaultValue) +getEnvConfigStr(const char **source, const char *envname, const char *defaultValue) { if (!(*source = env_get(envname))) *source = defaultValue; @@ -247,9 +250,9 @@ getEnvConfigStr(char **source, char *envname, char *defaultValue) * -1 if either user or domain was truncated due to buff_size being reached */ int -parse_email(char *email, stralloc *user, stralloc *domain) +parse_email(const char *email, stralloc *user, stralloc *domain) { - char *ptr; + const char *ptr; int i, len; for (len = 0, ptr = email; *ptr; ptr++, len++) { @@ -279,7 +282,7 @@ parse_email(char *email, stralloc *user, stralloc *domain) void getversion_indimail_stub_c() { - static char *x = "$Id: indimail_stub.c,v 1.17 2023-04-01 19:26:44+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: indimail_stub.c,v 1.18 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/indimail-mta-x/indimail_stub.h b/indimail-mta-x/indimail_stub.h index a604a9cb3e..5c1e6d8444 100644 --- a/indimail-mta-x/indimail_stub.h +++ b/indimail-mta-x/indimail_stub.h @@ -1,5 +1,8 @@ /* * $Log: indimail_stub.h,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-02-07 23:12:58+05:30 Cprogrammer * use inquery(), parse_email() from libindimail * @@ -48,6 +51,6 @@ #define MASTER_HOST "localhost" #define MYSQL_HOST "localhost" -void *loadLibrary(void **, char *, int *, char **); -void *getlibObject(char *, void **, char *, char **); +void *loadLibrary(void **, const char *, int *, const char *err[]); +void *getlibObject(const char *, void **, const char *, const char *err[]); void closeLibrary(void **); diff --git a/indimail-mta-x/inewaliases.c b/indimail-mta-x/inewaliases.c index effe74b2f3..0ff91fbf5f 100644 --- a/indimail-mta-x/inewaliases.c +++ b/indimail-mta-x/inewaliases.c @@ -1,5 +1,8 @@ /* * $Log: inewaliases.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -380,7 +383,7 @@ main() void getversion_newaliases_c() { - static char *x = "$Id: inewaliases.c,v 1.7 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: inewaliases.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/installer.c b/indimail-mta-x/installer.c index 2054709e01..33f9199ad0 100644 --- a/indimail-mta-x/installer.c +++ b/indimail-mta-x/installer.c @@ -1,5 +1,5 @@ /* - * $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $ + * $Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * taken from ezmlm-0.54 */ #include @@ -64,7 +64,7 @@ get_octal(mode_t mode) } void -print_info(const char *str, char *source, char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) +print_info(const char *str, const char *source, const char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) { struct passwd *pw; struct group *gr; @@ -669,7 +669,7 @@ main(int argc, char **argv) void getversion_installer_c() { - static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $"; + static const char *x = "$Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -677,6 +677,9 @@ getversion_installer_c() /* * $Log: installer.c,v $ + * Revision 1.27 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer * fixed displaying size variable * fixed allocation of zerobuf variable diff --git a/indimail-mta-x/ip.c b/indimail-mta-x/ip.c index 457c1e2a67..1aeab879f3 100644 --- a/indimail-mta-x/ip.c +++ b/indimail-mta-x/ip.c @@ -1,5 +1,8 @@ /* * $Log: ip.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2020-07-04 16:51:06+05:30 Cprogrammer * removed extra inclusion of fmt.h * @@ -78,9 +81,7 @@ ip4_fmt(s, ip) } unsigned int -ip4_scan(s, ip) - char *s; - ip_addr *ip; +ip4_scan(const char *s, ip_addr *ip) { unsigned int i; unsigned int len; @@ -131,9 +132,7 @@ ip4_scan(s, ip) } unsigned int -ip4_scanbracket(s, ip) - char *s; - ip_addr *ip; +ip4_scanbracket(const char *s, ip_addr *ip) { unsigned int len; @@ -250,9 +249,7 @@ ip6_fmt(s, ip6) } unsigned int -ip6_scan(s, ip6) - char *s; - ip6_addr *ip6; +ip6_scan(const char *s, ip6_addr *ip6) { char suffix[16]; unsigned int i, x, len = 0; @@ -344,9 +341,7 @@ ip6_scan(s, ip6) } unsigned int -ip6_scanbracket(s, ip6) - char *s; - ip6_addr *ip6; +ip6_scanbracket(const char *s, ip6_addr *ip6) { unsigned int len; @@ -364,7 +359,7 @@ ip6_scanbracket(s, ip6) void getversion_ip_c() { - static char *x = "$Id: ip.c,v 1.11 2020-07-04 16:51:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ip.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ip.h b/indimail-mta-x/ip.h index 84c0de6590..d23ec70871 100644 --- a/indimail-mta-x/ip.h +++ b/indimail-mta-x/ip.h @@ -1,5 +1,8 @@ /* * $Log: ip.h,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2015-08-27 00:29:09+05:30 Cprogrammer * added ip6_fmt_flat(), ip6_fmt_exp() functions * @@ -77,11 +80,11 @@ union v46addr unsigned int ip6_fmt(char *, ip6_addr *); unsigned int ip6_fmt_exp(char *, ip6_addr *); unsigned int ip6_fmt_flat(char *, ip6_addr *); -unsigned int ip6_scan(char *, ip6_addr *); -unsigned int ip6_scanbracket(char *, ip6_addr *); +unsigned int ip6_scan(const char *, ip6_addr *); +unsigned int ip6_scanbracket(const char *, ip6_addr *); #endif unsigned int ip4_fmt(char *, ip_addr *); -unsigned int ip4_scan(char *, ip_addr *); -unsigned int ip4_scanbracket(char *, ip_addr *); +unsigned int ip4_scan(const char *, ip_addr *); +unsigned int ip4_scanbracket(const char *, ip_addr *); #endif diff --git a/indimail-mta-x/ipalloc.c b/indimail-mta-x/ipalloc.c index 4fb8ebd6fa..211538ecbf 100644 --- a/indimail-mta-x/ipalloc.c +++ b/indimail-mta-x/ipalloc.c @@ -1,5 +1,8 @@ /* * $Log: ipalloc.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2020-11-22 23:11:05+05:30 Cprogrammer * removed supression of ANSI C proto * @@ -36,7 +39,7 @@ GEN_ALLOC_append(ipalloc, struct ip_mx, ix, len, a, 10, ipalloc_readyplus, ipall void getversion_ipalloc_c() { - static char *x = "$Id: ipalloc.c,v 1.9 2020-11-22 23:11:05+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ipalloc.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ipme.c b/indimail-mta-x/ipme.c index 4ccfff2594..2a02a54202 100644 --- a/indimail-mta-x/ipme.c +++ b/indimail-mta-x/ipme.c @@ -1,5 +1,8 @@ /* * $Log: ipme.c,v $ + * Revision 1.26 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.25 2021-06-14 00:47:17+05:30 Cprogrammer * converted to ansic prototypes * @@ -149,7 +152,7 @@ static stralloc buf = { 0 }; #ifdef MOREIPME int -ipme_readipfile(ipalloc *ipa, char *fn) +ipme_readipfile(ipalloc *ipa, const char *fn) { int ret = 1; int fd, match; @@ -475,7 +478,7 @@ ipme_init() void getversion_ipme_c() { - static char *x = "$Id: ipme.c,v 1.25 2021-06-14 00:47:17+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ipme.c,v 1.26 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ipmeprint.c b/indimail-mta-x/ipmeprint.c index 8efaba0c6b..9e7f350c4e 100644 --- a/indimail-mta-x/ipmeprint.c +++ b/indimail-mta-x/ipmeprint.c @@ -1,5 +1,8 @@ /* * $Log: ipmeprint.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2021-06-12 17:58:05+05:30 Cprogrammer * removed chdir(auto_qmail) * @@ -80,7 +83,7 @@ main() void getversion_ipmeprint_c() { - static char *x = "$Id: ipmeprint.c,v 1.13 2021-06-12 17:58:05+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ipmeprint.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ldap-checkpwd.c b/indimail-mta-x/ldap-checkpwd.c index 5873208563..19a4c710f7 100644 --- a/indimail-mta-x/ldap-checkpwd.c +++ b/indimail-mta-x/ldap-checkpwd.c @@ -1,5 +1,8 @@ /*- * $Log: ldap-checkpwd.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2023-07-13 02:43:28+05:30 Cprogrammer * replaced out() with subprintf() * @@ -116,14 +119,14 @@ flush() } void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(subfderr, s) == -1) _exit(111); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(subfderr, s) == -1) _exit(111); @@ -134,7 +137,7 @@ logerrf(char *s) static int debug; no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); if (s2) { @@ -156,12 +159,13 @@ static stralloc homedir = {0}; #endif extern int snprintf(char *, size_t, const char *, /*args*/ ...); -int ldap_lookup(char *, char *, char **, uid_t *, gid_t *); +int ldap_lookup(const char *, const char *, const char *error[], uid_t *, gid_t *); int main(int argc, char *argv[]) { - char *login, *password, *ptr, *error = 0; + char *login, *password, *ptr; + const char *error = NULL; int uplen, i, r, native_checkpassword; uid_t uid; gid_t gid; @@ -248,14 +252,14 @@ main(int argc, char *argv[]) } int -ldap_lookup(char *login, char *password, char **error, uid_t *userId, gid_t *groupId) +ldap_lookup(const char *login, const char *password, const char *error[], uid_t *userId, gid_t *groupId) { char *attrs[] = { NULL }; - char *host, *dn, *port, *ptr; - char *ldap_host, *ldap_bind_dn, *ldap_bind_passwd = 0, *ldap_filter, + const char *host, *dn, *port, *ptr; + const char *ldap_host, *ldap_bind_dn, *ldap_bind_passwd = 0, *ldap_filter, *ldap_base, *ldap_scope; #ifdef EXTENDED_ATTRIBUTES - char *ldap_field; + const char *ldap_field; char **values; #endif static stralloc filter = {0}, errbuf = {0}; @@ -490,7 +494,7 @@ ldap_lookup(char *login, char *password, char **error, uid_t *userId, gid_t *gro *error = errbuf.s; return -1; } - ldap_memfree(dn); + ldap_memfree((char *) dn); #ifdef EXTENDED_ATTRIBUTES for (i = 0; environ[i]; ++i) { if (str_diffn(environ[i], "LDAP_FIELD_", 11)) @@ -564,7 +568,7 @@ main(argc, argv) void getversion_ldap_checkpwd_c() { - static char *x = "$Id: ldap-checkpwd.c,v 1.13 2023-07-13 02:43:28+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ldap-checkpwd.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/leapsecs.c b/indimail-mta-x/leapsecs.c index 97d1effcc7..9da1a98dfe 100644 --- a/indimail-mta-x/leapsecs.c +++ b/indimail-mta-x/leapsecs.c @@ -1,5 +1,8 @@ /* * $Log: leapsecs.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2016-01-28 15:06:55+05:30 Cprogrammer * removed dependency on home directory * @@ -62,7 +65,7 @@ main() void getversion_leapsecs_c() { - static char *x = "$Id: leapsecs.c,v 1.3 2016-01-28 15:06:55+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: leapsecs.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/load_mysql.c b/indimail-mta-x/load_mysql.c index 059297f59d..c5b836980c 100644 --- a/indimail-mta-x/load_mysql.c +++ b/indimail-mta-x/load_mysql.c @@ -1,5 +1,8 @@ /* * $Log: load_mysql.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2022-11-23 15:05:30+05:30 Cprogrammer * renamed mysql_lib to libmysql * @@ -61,10 +64,10 @@ int use_sql = 0; static stralloc libfn = { 0 }; int -initMySQLlibrary(char **errstr) +initMySQLlibrary(const char *errstr[]) { static void *phandle = (void *) 0; - char *ptr; + const char *ptr; int i; if (phandle) @@ -148,7 +151,7 @@ initMySQLlibrary(char **errstr) void getversion_load_mysql_c() { - static char *x = "$Id: load_mysql.c,v 1.10 2022-11-23 15:05:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: load_mysql.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/indimail-mta-x/load_mysql.h b/indimail-mta-x/load_mysql.h index 3b05bbdb90..a94f139b6d 100644 --- a/indimail-mta-x/load_mysql.h +++ b/indimail-mta-x/load_mysql.h @@ -1,5 +1,8 @@ /* * $Log: load_mysql.h,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-06-16 13:59:40+05:30 Cprogrammer * use MYSQL_RES for non-libmariadb setup * @@ -47,6 +50,6 @@ extern my_ulonglong (*in_mysql_num_rows)(MYSQL_RES *); extern my_ulonglong (*in_mysql_affected_rows) (MYSQL *); extern void (*in_mysql_free_result) (MYSQL_RES *); -extern int initMySQLlibrary(char **); +extern int initMySQLlibrary(const char *errstr[]); #endif diff --git a/indimail-mta-x/mail_acl.c b/indimail-mta-x/mail_acl.c index 2949d05b9e..6ed562c856 100644 --- a/indimail-mta-x/mail_acl.c +++ b/indimail-mta-x/mail_acl.c @@ -1,5 +1,5 @@ /* - * $Id: mail_acl.c,v 1.9 2023-12-05 22:07:19+05:30 Cprogrammer Exp mbhangui $ + * $Id: mail_acl.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -8,20 +8,21 @@ #include "do_match.h" #include "varargs.h" -extern void die_regex(char *); +extern void die_regex(const char *); #ifdef HAVE_STDARG_H -extern void out(char *s1, ...); +extern void out(const char *s1, ...); #else -extern void out(char *); +extern void out(const char *); #endif extern void flush(); int -mail_acl(stralloc *acclist, int qregex, char *sender, char *recipient, char verb) +mail_acl(stralloc *acclist, int qregex, const char *sender, const char *recipient, char verb) { int err, len, count, from_reject, rcpt_reject, rcpt_found, from_found; - char *ptr, *cptr, *rcpt_match, *from_match, *err_str; + char *ptr, *cptr, *rcpt_match, *from_match; + const char *err_str; char count_buf[FMT_ULONG]; /*- Cannot reject bounces */ @@ -207,13 +208,16 @@ mail_acl(stralloc *acclist, int qregex, char *sender, char *recipient, char verb void getversion_mail_acl_c() { - static char *x = "$Id: mail_acl.c,v 1.9 2023-12-05 22:07:19+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: mail_acl.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: mail_acl.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-12-05 22:07:19+05:30 Cprogrammer * fix for invalid rules * diff --git a/indimail-mta-x/mail_acl.h b/indimail-mta-x/mail_acl.h index 721e01cccc..3775198e61 100644 --- a/indimail-mta-x/mail_acl.h +++ b/indimail-mta-x/mail_acl.h @@ -1,5 +1,8 @@ /* * $Log: mail_acl.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2010-11-05 01:06:24+05:30 Cprogrammer * Initial revision * @@ -7,6 +10,6 @@ #ifndef _MAIL_ACL_H_ #define _MAIL_ACL_H_ -int mail_acl(stralloc *, int, char *, char *, char); +int mail_acl(stralloc *, int, const char *, const char *, char); #endif diff --git a/indimail-mta-x/maildir.c b/indimail-mta-x/maildir.c index 292d8ac181..352c436a6a 100644 --- a/indimail-mta-x/maildir.c +++ b/indimail-mta-x/maildir.c @@ -1,5 +1,5 @@ /* - * $Id: maildir.c,v 1.8 2023-12-23 09:13:28+05:30 Cprogrammer Exp mbhangui $ + * $Id: maildir.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -55,7 +55,7 @@ maildir_clean(stralloc *tmpname) } static int -append(prioq *pq, stralloc *filenames, char *subdir, datetime_sec my_time) +append(prioq *pq, stralloc *filenames, const char *subdir, datetime_sec my_time) { DIR *dir; direntry *d; @@ -120,13 +120,16 @@ maildir_scan(prioq *pq, stralloc *filenames, int flagnew, int flagcur) void getversion_maildir_c() { - static char *x = "$Id: maildir.c,v 1.8 2023-12-23 09:13:28+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildir.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: maildir.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2023-12-23 09:13:28+05:30 Cprogrammer * skip non-regular to prevent breaking maildirserial * diff --git a/indimail-mta-x/maildir2mbox.c b/indimail-mta-x/maildir2mbox.c index 2d76017378..2b3f925b8d 100644 --- a/indimail-mta-x/maildir2mbox.c +++ b/indimail-mta-x/maildir2mbox.c @@ -1,5 +1,8 @@ /* * $Log: maildir2mbox.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -174,7 +177,7 @@ main() void getversion_maildir2mbox_c() { - static char *x = "$Id: maildir2mbox.c,v 1.9 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildir2mbox.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmyctimeh; x++; diff --git a/indimail-mta-x/maildir_deliver.c b/indimail-mta-x/maildir_deliver.c index 92659da094..f15c1ae2c0 100644 --- a/indimail-mta-x/maildir_deliver.c +++ b/indimail-mta-x/maildir_deliver.c @@ -1,5 +1,8 @@ /* * $Log: maildir_deliver.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2022-09-18 23:01:36+05:30 Cprogrammer * added comments * @@ -86,7 +89,7 @@ sigalrm() */ int -maildir_deliver(char *dir, stralloc *rpline, stralloc *dtline, char *qqeh) +maildir_deliver(const char *dir, stralloc *rpline, stralloc *dtline, const char *qqeh) { char strnum[FMT_ULONG], host_a[64]; char inbuf[1024], outbuf[1024]; @@ -248,7 +251,7 @@ maildir_deliver(char *dir, stralloc *rpline, stralloc *dtline, char *qqeh) void getversion_maildir_deliver_c() { - static char *x = "$Id: maildir_deliver.c,v 1.5 2022-09-18 23:01:36+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildir_deliver.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/maildir_deliver.h b/indimail-mta-x/maildir_deliver.h index 3efea4e938..7da482041f 100644 --- a/indimail-mta-x/maildir_deliver.h +++ b/indimail-mta-x/maildir_deliver.h @@ -1,5 +1,8 @@ /* * $Log: maildir_deliver.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2021-05-16 22:43:17+05:30 Cprogrammer * Initial revision * @@ -8,6 +11,6 @@ #define MAILDIR_CHILD_H #include -int maildir_deliver(char *, stralloc *, stralloc *, char *); +int maildir_deliver(const char *, stralloc *, stralloc *, const char *); #endif diff --git a/indimail-mta-x/maildirdeliver.c b/indimail-mta-x/maildirdeliver.c index 01aa27829c..5c2b911253 100644 --- a/indimail-mta-x/maildirdeliver.c +++ b/indimail-mta-x/maildirdeliver.c @@ -1,5 +1,8 @@ /* * $Log: maildirdeliver.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2023-09-13 19:36:53+05:30 Cprogrammer * BUG. Remove NULL character appended to rpline, dtline * @@ -79,7 +82,7 @@ main(int argc, char **argv) void getversion_maildirdeliver_c() { - static char *x = "$Id: maildirdeliver.c,v 1.3 2023-09-13 19:36:53+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildirdeliver.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/maildirserial.c b/indimail-mta-x/maildirserial.c index 9a3210466f..95f7c28884 100644 --- a/indimail-mta-x/maildirserial.c +++ b/indimail-mta-x/maildirserial.c @@ -1,5 +1,8 @@ /* * $Log: maildirserial.c,v $ + * Revision 1.22 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.21 2023-12-08 13:16:37+05:30 Cprogrammer * removed use of my_puts(), put() functions * @@ -45,7 +48,6 @@ #define INFO "maildirserial: info: " static char *prefix; -static char *qqx; static char **client; static char messbuf[256]; static char buf[1024]; @@ -67,6 +69,7 @@ static stralloc datestr = { 0 }; static stralloc sender = { 0 }; static stralloc quoted = { 0 }; static stralloc filenames = { 0 }; +const char *qqx; static stralloc err = { 0 }; #ifdef MIME static stralloc boundary = { 0 }; @@ -112,7 +115,7 @@ die_qq() */ static void -my_config_readline(config_str *c, char *fname) +my_config_readline(config_str *c, const char *fname) { if (!controldir) { if (!(controldir = env_get("CONTROLDIR"))) @@ -156,7 +159,7 @@ int bounce(int fd, stralloc *why, int _flagtimeout) /*- why must end with \n; must not contain \n\n */ { int match, n; - char *bouncesender, *bouncerecip, *x; + const char *bouncesender, *bouncerecip, *x; substdio_fdbuf(&ssmess, read, fd, messbuf, sizeof messbuf); @@ -313,7 +316,7 @@ hasprefix(int fd) } int -usable(char *filename) +usable(const char *filename) { int i; int fd; @@ -388,7 +391,7 @@ scanner() /* PARENT */ void -info(char *result) +info(const char *result) { substdio_puts(subfderr, INFO); substdio_puts(subfderr, fn.s); @@ -401,7 +404,7 @@ int main(int argc, char **argv) { int opt, r, progress, match; - char *dir; + const char *dir; char status; struct stat st; @@ -546,13 +549,16 @@ main(int argc, char **argv) void getversion_maildirserial_c() { - static char *x = "$Id: maildirserial.c,v 1.21 2023-12-08 13:16:37+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildirserial.c,v 1.22 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: maildirserial.c,v $ + * Revision 1.22 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.21 2023-12-08 13:16:37+05:30 Cprogrammer * removed use of my_puts(), put() functions * diff --git a/indimail-mta-x/maildirsize.c b/indimail-mta-x/maildirsize.c index 064812391b..5c6806a3d7 100644 --- a/indimail-mta-x/maildirsize.c +++ b/indimail-mta-x/maildirsize.c @@ -1,5 +1,8 @@ /* * $Log: maildirsize.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2020-09-16 19:00:57+05:30 Cprogrammer * freeBSD fix * @@ -159,7 +162,7 @@ main(int argc, char **argv) void getversion_maildirsize_c() { - static char *x = "$Id: maildirsize.c,v 1.12 2020-09-16 19:00:57+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: maildirsize.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/mailfilter.c b/indimail-mta-x/mailfilter.c index 1d6e843daf..6d27cdfcc5 100644 --- a/indimail-mta-x/mailfilter.c +++ b/indimail-mta-x/mailfilter.c @@ -1,5 +1,5 @@ /* - * $Id: mailfilter.c,v 1.5 2024-02-20 22:18:10+05:30 Cprogrammer Exp mbhangui $ + * $Id: mailfilter.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -82,17 +82,18 @@ mailfilter(int argc, char **argv, char *filterargs) void getversion_mailfilter_c() { - static char *x = "$Id: mailfilter.c,v 1.5 2024-02-20 22:18:10+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: mailfilter.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidmailfilterh; x = sccsidmktempfileh; - x = sccsidqmultih; x++; } #endif /* * $Log: mailfilter.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2024-02-20 22:18:10+05:30 Cprogrammer * added exit code 99 for compatibility with qmail-qfilter blackhole * diff --git a/indimail-mta-x/mailfilter.h b/indimail-mta-x/mailfilter.h index 75969b32af..b1eead9b5d 100644 --- a/indimail-mta-x/mailfilter.h +++ b/indimail-mta-x/mailfilter.h @@ -1,5 +1,8 @@ /* * $Log: mailfilter.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2021-06-09 19:32:44+05:30 Cprogrammer * Initial revision * @@ -7,10 +10,6 @@ #ifndef MAILFILTER_H #define MAILFILTER_H -#ifndef lint -static char sccsidmailfilterh[] = "$Id: mailfilter.h,v 1.1 2021-06-09 19:32:44+05:30 Cprogrammer Exp mbhangui $"; -#endif - int mailfilter(int argc, char **, char *); #endif diff --git a/indimail-mta-x/matchup.c b/indimail-mta-x/matchup.c index 89dc8e56df..39561b750e 100644 --- a/indimail-mta-x/matchup.c +++ b/indimail-mta-x/matchup.c @@ -1,5 +1,8 @@ /* * $Log: matchup.c,v $ + * Revision 1.17 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.16 2022-04-24 19:10:11+05:30 Cprogrammer * fixed field position of 'exiting' for slowq-send, qmta-send logs * @@ -122,28 +125,28 @@ die_write5() } void -out(char *buf, int len) +out(const char *buf, int len) { if (substdio_put(subfdout, buf, len) == -1) die_write(); } void -outs(char *buf) +outs(const char *buf) { if (substdio_puts(subfdout, buf) == -1) die_write(); } void -out5(char *buf, int len) +out5(const char *buf, int len) { if (substdio_put(&ss5, buf, len) == -1) die_write5(); } void -outs5(char *buf) +outs5(const char *buf) { if (substdio_puts(&ss5, buf) == -1) die_write5(); @@ -297,8 +300,8 @@ garbage() * dates without @ are left alone */ -char * -tai64nunix(char *s) +const char * +tai64nunix(const char *s) { int c; int len; @@ -375,7 +378,7 @@ delivery() { unsigned long d, m, _qid; int dpos, mpos, i; - char *result = "?", *reason = ""; + const char *result = "?", *reason = ""; /* ts delivery 1.5: success: did_1+0+1/ queue5 */ i = scan_ulong(line.s + field[2], &d); @@ -722,7 +725,7 @@ main() void getversion_matchup_c() { - static char *x = "$Id: matchup.c,v 1.16 2022-04-24 19:10:11+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: matchup.c,v 1.17 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/mbox2maildir.c b/indimail-mta-x/mbox2maildir.c index 9a5215eaa0..54911dac1c 100644 --- a/indimail-mta-x/mbox2maildir.c +++ b/indimail-mta-x/mbox2maildir.c @@ -1,5 +1,8 @@ /* * $Log: mbox2maildir.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -59,20 +62,20 @@ die_clean() } void -w2(char *s) +w2(const char *s) { substdio_put(&buf_1, s, strlen(s)); } void -w2nl(char *s) +w2nl(const char *s) { w2(s); w2("\n"); } void -put(char *s, int i) +put(const char *s, int i) { substdio_put(&buf_f, s, i); } @@ -125,8 +128,8 @@ void blast(char *ch, int r) { int i; - char *prefix = ">From "; - char *from = prefix + 1; + const char *prefix = ">From "; + const char *from = prefix + 1; for (i = 0; i < r; i++, ch++) { switch (state) @@ -356,7 +359,7 @@ main(int argc, char **argv) void getversion_mbox2maildir_c() { - static char *x = "$Id: mbox2maildir.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: mbox2maildir.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/mini-smtpd.c b/indimail-mta-x/mini-smtpd.c index 8861e8395c..01f05078d7 100644 --- a/indimail-mta-x/mini-smtpd.c +++ b/indimail-mta-x/mini-smtpd.c @@ -1,5 +1,5 @@ /* - * $Id: mini-smtpd.c,v 1.9 2024-01-23 01:21:56+05:30 Cprogrammer Exp mbhangui $ + * $Id: mini-smtpd.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -41,11 +41,11 @@ static stralloc addr = { 0 }; /* will be 0-terminated, if addrparse returns 1 */ static stralloc mailfrom = { 0 }; static stralloc rcptto = { 0 }; static stralloc mfparms = { 0 }; -static char *remoteip; -static char *remotehost; -static char *remoteinfo; -static char *local; -static char *relayclient; +const char *remoteip; +const char *remotehost; +const char *remoteinfo; +const char *local; +const char *relayclient; static char *fakehelo; /* pointer into helohost, or 0 */ static char ssinbuf[BUFSIZE_IN]; static char ssoutbuf[BUFSIZE_OUT]; @@ -164,15 +164,13 @@ err_wantrcpt() } void -err_noop(arg) - char *arg; +err_noop(char *arg) { out("250 ok\r\n"); } void -err_vrfy(arg) - char *arg; +err_vrfy(char *arg) { out("252 send some mail, i'll try my best\r\n"); } @@ -184,7 +182,7 @@ err_qqt() } void -smtp_greet(char *code) +smtp_greet(const char *code) { substdio_puts(&ssout, code); substdio_put(&ssout, greeting.s, greeting.len); @@ -206,7 +204,7 @@ smtp_quit(char *arg) } void -dohelo(char *arg) +dohelo(const char *arg) { if (!stralloc_copys(&helohost, arg) || !stralloc_0(&helohost)) @@ -474,7 +472,7 @@ saferead(int fd, char *buf, size_t len) } void -put(char *ch) +put(const char *ch) { if (bytestooverflow && !--bytestooverflow) qmail_fail(&qqt); @@ -620,7 +618,7 @@ smtp_data(char *arg) { int hops; unsigned long qp; - char *qqx; + const char *qqx; if (!seenmail) { err_wantmail(); @@ -718,13 +716,16 @@ main(int argc, char **argv) void getversion_mini_smtpd() { - static char *x = "$Id: mini-smtpd.c,v 1.9 2024-01-23 01:21:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: mini-smtpd.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: mini-smtpd.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2024-01-23 01:21:56+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/mkfn.c b/indimail-mta-x/mkfn.c index 682ca8f39e..2f9b708332 100644 --- a/indimail-mta-x/mkfn.c +++ b/indimail-mta-x/mkfn.c @@ -1,5 +1,8 @@ /* * $Log: mkfn.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2004-10-22 20:27:33+05:30 Cprogrammer * added RCS id * @@ -30,7 +33,7 @@ mkfn(char *const buf, const unsigned short count) void getversion_mkfn_c() { - static char *x = "$Id: mkfn.c,v 1.2 2004-10-22 20:27:33+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: mkfn.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/mlmatchup.c b/indimail-mta-x/mlmatchup.c index 20228dca2a..d05583e993 100644 --- a/indimail-mta-x/mlmatchup.c +++ b/indimail-mta-x/mlmatchup.c @@ -1,5 +1,8 @@ /* * $Log: mlmatchup.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -387,8 +390,8 @@ delivery() unsigned long m; int dpos; int mpos; - char *result = "?"; - char *reason = ""; + const char *result = "?"; + const char *reason = ""; scan_ulong(line.s + field[2], &d); @@ -732,7 +735,7 @@ main() void getversion_mlmatchup_c() { - static char *x = "$Id: mlmatchup.c,v 1.5 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: mlmatchup.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/new-inject.c b/indimail-mta-x/new-inject.c index 757ca187be..79f5fe16f9 100644 --- a/indimail-mta-x/new-inject.c +++ b/indimail-mta-x/new-inject.c @@ -1,5 +1,8 @@ /* * $Log: new-inject.c,v $ + * Revision 1.19 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.18 2023-01-03 16:36:02+05:30 Cprogrammer * removed auto_sysconfdir.h dependency * @@ -218,7 +221,7 @@ sender_get(stralloc *list) } void -myput(char *buf, int len) +myput(const char *buf, int len) { if (flagqueue) qmail_put(&qq, buf, len); @@ -227,13 +230,13 @@ myput(char *buf, int len) } void -myputs(char *buf) +myputs(const char *buf) { myput(buf, str_len(buf)); } void -putlist(char *name_t, stralloc *list) +putlist(const char *name_t, stralloc *list) { if (!list->len) return; @@ -417,9 +420,8 @@ finishheader() no_return void finishmessage() { - char *qqx; - int i; - int j; + const char *qqx; + int i, j; if (!flagqueue) substdio_flush(subfdoutsmall); @@ -628,7 +630,7 @@ main(int argc, char **argv) void getversion_new_inject_c() { - static char *x = "$Id: new-inject.c,v 1.18 2023-01-03 16:36:02+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: new-inject.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/newfield.c b/indimail-mta-x/newfield.c index 165ecc3c85..25872578a5 100644 --- a/indimail-mta-x/newfield.c +++ b/indimail-mta-x/newfield.c @@ -1,5 +1,8 @@ /* * $Log: newfield.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2011-02-11 23:44:27+05:30 Cprogrammer * added blank lines for code readability * @@ -141,7 +144,7 @@ newfield_msgidmake(idhost, idhostlen, when) void getversion_newfield_c() { - static char *x = "$Id: newfield.c,v 1.6 2011-02-11 23:44:27+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: newfield.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/newinclude.c b/indimail-mta-x/newinclude.c index 11e1012e87..d83e3816aa 100644 --- a/indimail-mta-x/newinclude.c +++ b/indimail-mta-x/newinclude.c @@ -1,5 +1,8 @@ /* * $Log: newinclude.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -362,7 +365,7 @@ main(int argc, char **argv) void getversion_newinclude_c() { - static char *x = "$Id: newinclude.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: newinclude.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/nowutc.c b/indimail-mta-x/nowutc.c index 27626385be..7f66673bc4 100644 --- a/indimail-mta-x/nowutc.c +++ b/indimail-mta-x/nowutc.c @@ -1,5 +1,8 @@ /* * $Log: nowutc.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-02-08 11:19:07+05:30 Cprogrammer * fixed format string for subprintf * @@ -73,7 +76,7 @@ main() void getversion_nowutc_c() { - static char *z = "$Id: nowutc.c,v 1.10 2023-02-08 11:19:07+05:30 Cprogrammer Exp mbhangui $"; + const char *z = "$Id: nowutc.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; z++; } diff --git a/indimail-mta-x/ofmipd.c b/indimail-mta-x/ofmipd.c index 47233361d0..d9846d45ce 100644 --- a/indimail-mta-x/ofmipd.c +++ b/indimail-mta-x/ofmipd.c @@ -1,5 +1,8 @@ /* * $Log: ofmipd.c,v $ + * Revision 1.26 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.25 2024-01-23 01:22:02+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -110,12 +113,12 @@ #include "qmail.h" #include "control.h" -int auth_login(char *); -int auth_plain(char *); +int auth_login(const char *); +int auth_plain(const char *); int auth_cram(); int err_noauth(); -void logerr(char *); -void logerrf(char *); +void logerr(const char *); +void logerrf(const char *); void logerr_start(); ssize_t saferead(int fd, char *buf, size_t len); ssize_t safewrite(int fd, char *buf, size_t len); @@ -125,12 +128,12 @@ static int authd = 0; static int rcptcount = 0; static int match; static char strnum[FMT_ULONG], pid_str[FMT_ULONG], accept_buf[FMT_ULONG]; -static char *protocol = "SMTP"; -static char *hostname, *remoteip, *relayclient, *remoteinfo; +const char *protocol = "SMTP"; +const char *hostname, *remoteip, *relayclient, *remoteinfo; static char **childargs; static struct authcmd { - char *text; + const char *text; int (*fun) (); } authcmds[] = { {"login", auth_login}, @@ -170,13 +173,13 @@ flush() } void -out(char *s) +out(const char *s) { substdio_puts(&ssout, s); } void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s)) _exit (1); @@ -196,7 +199,7 @@ logerr_start() } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s)) _exit (1); @@ -205,9 +208,9 @@ logerrf(char *s) } void -log_trans(char *arg1, char *arg2, int rcptlen, char *arg3) +log_trans(const char *arg1, const char *arg2, int rcptlen, const char *arg3) { - char *ptr; + const char *ptr; int idx; for (ptr = arg2 + 1, idx = 0; idx < rcptlen; idx++) { @@ -250,10 +253,10 @@ log_trans(char *arg1, char *arg2, int rcptlen, char *arg3) } void -err_queue(char *arg1, char *arg2, int len, char *arg3, char *qqx, +err_queue(const char *arg1, const char *arg2, int len, const char *arg3, const char *qqx, int permanent, unsigned long qp) { - char *ptr; + const char *ptr; int idx; accept_buf[fmt_ulong(accept_buf, qp)] = 0; @@ -304,7 +307,7 @@ err_queue(char *arg1, char *arg2, int len, char *arg3, char *qqx, } no_return void -die_control(char *arg) +die_control(const char *arg) { logerr_start(); logerr("451 unable to read control file "); @@ -647,14 +650,14 @@ smtp_rcpt(char *arg) struct qmail qqt; void -put(char *buf, unsigned int len) +put(const char *buf, unsigned int len) { qmail_put(&qqt, buf, len); databytes += len; } void -myputs(char *buf) +myputs(const char *buf) { unsigned int len; @@ -674,7 +677,7 @@ rewritelist(stralloc *list) } void -putlist(char *name_t, stralloc *list) +putlist(const char *name_t, stralloc *list) { if (!list->len) return; @@ -703,33 +706,33 @@ stralloc bottom = { 0 }; mess822_header h = MESS822_HEADER; mess822_action a[] = { - {"date", 0, 0, 0, 0, &date} - , {"to", 0, 0, 0, &to, 0} - , {"cc", 0, 0, 0, &cc, 0} - , {"notice-requested-upon-delivery-to", 0, 0, 0, &nrudt, 0} - , {"from", 0, 0, 0, &from, 0} - , {"sender", 0, 0, 0, &headersender, 0} - , {"reply-to", 0, 0, 0, &replyto, 0} - , {"mail-reply-to", 0, 0, 0, &mailreplyto, 0} - , {"mail-followup-to", 0, 0, 0, &followupto, 0} - , {"message-id", 0, &msgid, 0, 0, 0} - , {"received", 0, &top, 0, 0, 0} - , {"delivered-to", 0, &top, 0, 0, 0} - , {"errors-to", 0, &top, 0, 0, 0} - , {"return-receipt-to", 0, &top, 0, 0, 0} - , {"resent-sender", 0, &top, 0, 0, 0} - , {"resent-from", 0, &top, 0, 0, 0} - , {"resent-reply-to", 0, &top, 0, 0, 0} - , {"resent-to", 0, &top, 0, 0, 0} - , {"resent-cc", 0, &top, 0, 0, 0} - , {"resent-bcc", 0, &top, 0, 0, 0} - , {"resent-date", 0, &top, 0, 0, 0} - , {"resent-message-id", 0, &top, 0, 0, 0} - , {"bcc", 0, 0, 0, 0, 0} - , {"return-path", 0, 0, 0, 0, 0} - , {"apparently-to", 0, 0, 0, 0, 0} - , {"content-length", 0, 0, 0, 0, 0} - , {0, 0, &bottom, 0, 0, 0} + {"date", 0, 0, 0, 0, &date}, + {"to", 0, 0, 0, &to, 0}, + {"cc", 0, 0, 0, &cc, 0}, + {"notice-requested-upon-delivery-to", 0, 0, 0, &nrudt, 0}, + {"from", 0, 0, 0, &from, 0}, + {"sender", 0, 0, 0, &headersender, 0}, + {"reply-to", 0, 0, 0, &replyto, 0}, + {"mail-reply-to", 0, 0, 0, &mailreplyto, 0}, + {"mail-followup-to", 0, 0, 0, &followupto, 0}, + {"message-id", 0, &msgid, 0, 0, 0}, + {"received", 0, &top, 0, 0, 0}, + {"delivered-to", 0, &top, 0, 0, 0}, + {"errors-to", 0, &top, 0, 0, 0}, + {"return-receipt-to", 0, &top, 0, 0, 0}, + {"resent-sender", 0, &top, 0, 0, 0}, + {"resent-from", 0, &top, 0, 0, 0}, + {"resent-reply-to", 0, &top, 0, 0, 0}, + {"resent-to", 0, &top, 0, 0, 0}, + {"resent-cc", 0, &top, 0, 0, 0}, + {"resent-bcc", 0, &top, 0, 0, 0}, + {"resent-date", 0, &top, 0, 0, 0}, + {"resent-message-id", 0, &top, 0, 0, 0}, + {"bcc", 0, 0, 0, 0, 0}, + {"return-path", 0, 0, 0, 0, 0}, + {"apparently-to", 0, 0, 0, 0, 0}, + {"content-length", 0, 0, 0, 0, 0}, + {0, 0, &bottom, 0, 0, 0} }; void @@ -859,7 +862,7 @@ void smtp_data() { struct tai n; - char *qqx; + const char *qqx; unsigned long qp; tai_now(&n); @@ -907,7 +910,7 @@ smtp_data() } void -safecats(stralloc *out, char *in) +safecats(stralloc *out, const char *in) { char ch; while ((ch = *in++)) { @@ -931,7 +934,7 @@ safecats(stralloc *out, char *in) void received_init() { - char *x; + const char *x; if (!stralloc_copys(&received, "Received: (ofmipd ")) nomem(); @@ -1020,7 +1023,7 @@ authenticate(void) } int -auth_login(char *arg) +auth_login(const char *arg) { int r; @@ -1054,7 +1057,7 @@ auth_login(char *arg) } int -auth_plain(char *arg) +auth_plain(const char *arg) { int r, id = 0; @@ -1246,7 +1249,7 @@ main(int argc, char **argv) void getversion_ofmipd_c() { - static char *x = "$Id: ofmipd.c,v 1.25 2024-01-23 01:22:02+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ofmipd.c,v 1.26 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/ofmipname.c b/indimail-mta-x/ofmipname.c index 84a86da745..fc6d591d67 100644 --- a/indimail-mta-x/ofmipname.c +++ b/indimail-mta-x/ofmipname.c @@ -1,5 +1,8 @@ /* * $Log: ofmipname.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -147,7 +150,7 @@ main(int argc, char **argv) void getversion_ofmipname_c() { - static char *x = "$Id: ofmipname.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: ofmipname.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/parsedate.c b/indimail-mta-x/parsedate.c index 2aa42c1e2d..ac84cc236f 100644 --- a/indimail-mta-x/parsedate.c +++ b/indimail-mta-x/parsedate.c @@ -1,5 +1,8 @@ /* * $Log: parsedate.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-01-03 16:39:03+05:30 Cprogrammer * removed auto_sysconfdir.h dependency * @@ -99,7 +102,7 @@ main() void getversion_parsedate_c() { - static char *x = "$Id: parsedate.c,v 1.7 2023-01-03 16:39:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: parsedate.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/pidopen.c b/indimail-mta-x/pidopen.c index 5cbfd85a0b..2cec4236ef 100644 --- a/indimail-mta-x/pidopen.c +++ b/indimail-mta-x/pidopen.c @@ -1,5 +1,8 @@ /* * $Log: pidopen.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2022-04-03 18:14:07+05:30 Cprogrammer * use 70 as return code for pidopen failure * @@ -23,7 +26,7 @@ char *pidfn; int messfd; unsigned int -pidfmt(char *s, unsigned long seq, datetime_sec _starttime, char *tmpdir) +pidfmt(char *s, unsigned long seq, datetime_sec _starttime, const char *tmpdir) { unsigned int i, len; pid_t mypid; @@ -66,7 +69,7 @@ pidfmt(char *s, unsigned long seq, datetime_sec _starttime, char *tmpdir) } int -pidopen(datetime_sec _starttime, char *tmpdir) +pidopen(datetime_sec _starttime, const char *tmpdir) { unsigned int len; unsigned long seq; @@ -89,9 +92,8 @@ pidopen(datetime_sec _starttime, char *tmpdir) void getversion_pidopen_c() { - static char *x = "$Id: pidopen.c,v 1.3 2022-04-03 18:14:07+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: pidopen.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidpidopenh; x++; } #endif diff --git a/indimail-mta-x/pidopen.h b/indimail-mta-x/pidopen.h index 9984caceaa..2f092e24b7 100644 --- a/indimail-mta-x/pidopen.h +++ b/indimail-mta-x/pidopen.h @@ -1,5 +1,8 @@ /* * $Log: pidopen.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-06-15 21:50:44+05:30 Cprogrammer * added tmpdir argument to pidfmt(), pidopen() * @@ -11,14 +14,10 @@ #define _PIDOPEN_H #include -#ifndef lint -static char sccsidpidopenh[] = "$Id: pidopen.h,v 1.2 2021-06-15 21:50:44+05:30 Cprogrammer Exp mbhangui $"; -#endif - extern char *pidfn; extern int messfd; -int pidopen(datetime_sec, char *); -unsigned int pidfmt(char *, unsigned long, datetime_sec, char *); +int pidopen(datetime_sec, const char *); +unsigned int pidfmt(char *, unsigned long, datetime_sec, const char *); #endif diff --git a/indimail-mta-x/plugtest.c b/indimail-mta-x/plugtest.c index 585f9d72a6..d55e850667 100644 --- a/indimail-mta-x/plugtest.c +++ b/indimail-mta-x/plugtest.c @@ -1,5 +1,8 @@ /* * $Log: plugtest.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -41,12 +44,12 @@ #define FATAL "plugtest: fatal: " static int authenticated; -static char *relayclient; +const char *relayclient; static PLUGIN **plug = (PLUGIN **) 0; static void **handle; void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -73,7 +76,7 @@ die_nomem() } no_return void -die_plugin(char *arg1, char *arg2, char *arg3, char *arg4) +die_plugin(const char *arg1, const char *arg2, const char *arg3, const char *arg4) { substdio_flush(subfdout); if (arg1) @@ -90,7 +93,7 @@ die_plugin(char *arg1, char *arg2, char *arg3, char *arg4) } void -load_plugin(char *library, char *plugin_symb, int j) +load_plugin(const char *library, const char *plugin_symb, int j) { PLUGIN *(*func) (void); char *error; @@ -115,7 +118,7 @@ load_plugin(char *library, char *plugin_symb, int j) return; } -char *usage = +const char *usage = "usage: plugtest -MTD -l localip -r remoteip -R remotehost -m mailfrom recipient ...]\n" " -M test mail plugin\n" " -T test rcpt plugin\n" @@ -124,8 +127,9 @@ char *usage = int main(int argc, char **argv) { - char *localip, *remoteip, *remotehost, *mailfrom, - *plugindir, *start_plugin, *plugin_symb, *mesg; + const char *localip, *remoteip, *remotehost, *mailfrom, + *plugindir, *start_plugin, *plugin_symb; + char *mesg; char **argv_ptr; char strnum[FMT_ULONG]; int opt, i, j, len, mail_opt, rcpt_opt, data_opt, plugin_count, status; @@ -385,7 +389,7 @@ main(int argc, char **argv) void getversion_plugtest_c() { - static char *x = "$Id: plugtest.c,v 1.7 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: plugtest.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/predate.c b/indimail-mta-x/predate.c index 6059311e7d..da3d7d116d 100644 --- a/indimail-mta-x/predate.c +++ b/indimail-mta-x/predate.c @@ -1,5 +1,8 @@ /* * $Log: predate.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2020-11-24 13:46:28+05:30 Cprogrammer * removed exit.h * @@ -27,7 +30,7 @@ #define FATAL "predate: fatal: " -static char *montab[12] = { +const char *montab[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -35,9 +38,7 @@ char num[FMT_ULONG]; char outbuf[1024]; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { time_t now; struct tm *tm; @@ -135,7 +136,7 @@ main(argc, argv) void getversion_predate_c() { - static char *x = "$Id: predate.c,v 1.8 2020-11-24 13:46:28+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: predate.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/preline.c b/indimail-mta-x/preline.c index 8e10d0225c..25b42027bc 100644 --- a/indimail-mta-x/preline.c +++ b/indimail-mta-x/preline.c @@ -1,5 +1,8 @@ /* * $Log: preline.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-09-15 21:15:16+05:30 Cprogrammer * moved check for env variables after getopt * @@ -37,7 +40,7 @@ #define FATAL "preline: fatal: " no_return void -die_usage(char *arg) +die_usage(const char *arg) { if (arg) strerr_die4x(111, FATAL, "No ", arg, " environment variable"); @@ -132,7 +135,7 @@ main(int argc, char **argv) void getversion_preline_c() { - static char *x = "$Id: preline.c,v 1.11 2023-09-15 21:15:16+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: preline.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/printass.c b/indimail-mta-x/printass.c index 374ec31124..3dcc954201 100644 --- a/indimail-mta-x/printass.c +++ b/indimail-mta-x/printass.c @@ -1,5 +1,5 @@ /* - * $Id: printass.c,v 1.1 2023-12-10 10:18:52+05:30 Cprogrammer Exp mbhangui $ + * $Id: printass.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -176,7 +176,7 @@ main(int argc, char **argv) void getversion_printass_c() { - static char *x = "$Id: printass.c,v 1.1 2023-12-10 10:18:52+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: printass.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } @@ -184,6 +184,9 @@ getversion_printass_c() /* * $Log: printass.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-12-10 10:18:52+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/printforward.c b/indimail-mta-x/printforward.c index bcadf12bf8..8b820b2660 100644 --- a/indimail-mta-x/printforward.c +++ b/indimail-mta-x/printforward.c @@ -1,5 +1,8 @@ /* * $Log: printforward.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -47,21 +50,21 @@ getch(char *ch) } void -putch(char *ch) +putch(const char *ch) { if (substdio_put(subfdoutsmall, ch, 1) == -1) strerr_die2x(111, FATAL, "unable to write output: "); } void -print(char *buf) +print(const char *buf) { while (*buf) putch(buf++); } void -printsafe(char *buf, int len) +printsafe(const char *buf, int len) { char ch; @@ -175,7 +178,7 @@ main() void getversion_printforward_c() { - static char *x = "$Id: printforward.c,v 1.4 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: printforward.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/printmaillist.c b/indimail-mta-x/printmaillist.c index 3ed33031de..066e8be6ad 100644 --- a/indimail-mta-x/printmaillist.c +++ b/indimail-mta-x/printmaillist.c @@ -1,5 +1,8 @@ /* * $Log: printmaillist.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -72,7 +75,7 @@ main() void getversion_printmaillist_c() { - static char *x = "$Id: printmaillist.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: printmaillist.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/prioq.c b/indimail-mta-x/prioq.c index a5c6ef0ad4..32b2400a71 100644 --- a/indimail-mta-x/prioq.c +++ b/indimail-mta-x/prioq.c @@ -1,5 +1,8 @@ /* * $Log: prioq.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-06-03 18:03:39+05:30 Cprogrammer * allow prioq to be ordered from max to min * @@ -127,7 +130,7 @@ prioq_del(prioq *pq) void getversion_prioq_c() { - static char *x = "$Id: prioq.c,v 1.7 2021-06-03 18:03:39+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: prioq.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/process_queue.c b/indimail-mta-x/process_queue.c index 535566a319..bec5f4cbdb 100644 --- a/indimail-mta-x/process_queue.c +++ b/indimail-mta-x/process_queue.c @@ -1,5 +1,8 @@ /* * $Log: process_queue.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2022-04-13 16:58:06+05:30 Cprogrammer * flush subfdout to fix out of band err messages * @@ -39,10 +42,10 @@ #endif void -process_queue(char *warn, char *fatal, int (*func)(), int *w, int *x, int *y, int *z) +process_queue(const char *warn, const char *fatal, int (*func)(), int *w, int *x, int *y, int *z) { char *ptr, *qbase; - char *extra_queue[] = {"nqueue", "slowq", "qmta", 0}; + const char *extra_queue[] = {"nqueue", "slowq", "qmta", 0}; char strnum[FMT_ULONG]; int idx, count, qcount, qstart; static stralloc Queuedir = { 0 }, QueueBase = { 0 }; @@ -126,7 +129,7 @@ process_queue(char *warn, char *fatal, int (*func)(), int *w, int *x, int *y, in void getversion_process_queue_c() { - static char *x = "$Id: process_queue.c,v 1.6 2022-04-13 16:58:06+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: process_queue.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/process_queue.h b/indimail-mta-x/process_queue.h index 8373655504..f825056ab9 100644 --- a/indimail-mta-x/process_queue.h +++ b/indimail-mta-x/process_queue.h @@ -1,5 +1,8 @@ /* * $Log: process_queue.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2021-06-28 17:08:05+05:30 Cprogrammer * Initial revision * @@ -7,6 +10,6 @@ #ifndef _PROCESS_QUEUE_H #define _PROCESS_QUEUE_H -void process_queue(char *, char *, int (*)(), int *w, int *x, int *y, int *z); +void process_queue(const char *, const char *, int (*)(), int *w, int *x, int *y, int *z); #endif diff --git a/indimail-mta-x/qaes.c b/indimail-mta-x/qaes.c index e37f8c597e..513d09ffa2 100644 --- a/indimail-mta-x/qaes.c +++ b/indimail-mta-x/qaes.c @@ -7,6 +7,9 @@ * Saju Pillai (saju.pillai@gmail.com) * * $Log: qaes.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2024-01-23 01:24:18+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -55,21 +58,21 @@ static char ssinbuf[BUFSIZE_IN]; static char ssoutbuf[BUFSIZE_OUT]; static char sserrbuf[BUFSIZE_OUT]; -static char *usage = "usage: qaes -k key [ -i -d -e -s salt ]\n"; +const char *usage = "usage: qaes -k key [ -i -d -e -s salt ]\n"; static char strnum[FMT_ULONG]; static substdio ssin = SUBSTDIO_FDBUF(read, 0, ssinbuf, sizeof ssinbuf); static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -78,7 +81,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -92,7 +95,7 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s) +my_puts(const char *s) { if (substdio_puts(&ssout, s) == -1) my_error("qaes: write", 0, WRITE_ERR); @@ -347,7 +350,7 @@ main(int argc, char **argv) void getversion_qaes_c() { - static char *x = "$Id: qaes.c,v 1.7 2024-01-23 01:24:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qaes.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qarf.c b/indimail-mta-x/qarf.c index b5ba162261..42fa3f8ea2 100644 --- a/indimail-mta-x/qarf.c +++ b/indimail-mta-x/qarf.c @@ -1,5 +1,8 @@ /* * $Log: qarf.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2024-01-23 01:22:15+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -72,19 +75,19 @@ static char ssoutbuf[BUFSIZE_OUT]; static char sserrbuf[BUFSIZE_OUT]; static char strnum[FMT_ULONG]; -static char *usage = "usage: qarf [-i] -t recipient -s subject -f sender [-m filename]\n"; +const char *usage = "usage: qarf [-i] -t recipient -s subject -f sender [-m filename]\n"; static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -93,7 +96,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -107,14 +110,14 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s) +my_puts(const char *s) { if (substdio_puts(&ssout, s) == -1) my_error("qarf: write", 0, WRITE_ERR); } void -my_putb(char *s, int len) +my_putb(const char *s, int len) { if (substdio_bput(&ssout, s, len) == -1) my_error("qarf: write", 0, WRITE_ERR); @@ -124,7 +127,7 @@ static int mkTempFile(int seekfd) { char inbuf[2048], outbuf[2048]; - char *tmpdir; + const char *tmpdir; static stralloc tmpFile = {0}; struct substdio ssin; struct substdio sstmp; @@ -179,7 +182,7 @@ mkTempFile(int seekfd) stralloc addr = { 0 }; int -addrparse(char *arg) +addrparse(const char *arg) { int i, flagesc, flagquoted; char ch, terminator; @@ -336,7 +339,7 @@ main(int argc, char **argv) struct substdio ssin; static char ssinbuf[1024]; char buf[DATE822FMT], inbuf[128]; - char *to, *from, *subject, *text, *ip, *reported_ip; + const char *to, *from, *subject, *text, *ip, *reported_ip; to = from = subject = text = 0; reported_ip = 0; @@ -420,7 +423,7 @@ main(int argc, char **argv) my_putb("\"; ", 3); my_puts( "report-type=\"feedback-report\"\n" - "X-Mailer: qarf $Revision: 1.14 $\n"); + "X-Mailer: qarf $Revision: 1.15 $\n"); /*- Body */ my_puts("\nThis is a multi-part message in MIME format\n\n"); @@ -464,7 +467,7 @@ main(int argc, char **argv) my_puts( "Feedback-Type: abuse\n" - "User-Agent: $Id: qarf.c,v 1.14 2024-01-23 01:22:15+05:30 Cprogrammer Exp mbhangui $\n" + "User-Agent: $Id: qarf.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $\n" "Version: 0.1\n"); if (email_from.len) { my_putb("Original-Mail-From: ", 20); @@ -524,7 +527,7 @@ main(int argc, char **argv) void getversion_qarf_c() { - static char *x = "$Id: qarf.c,v 1.14 2024-01-23 01:22:15+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qarf.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qbase64.c b/indimail-mta-x/qbase64.c index 622e1aa68b..affacc943f 100644 --- a/indimail-mta-x/qbase64.c +++ b/indimail-mta-x/qbase64.c @@ -1,5 +1,8 @@ /* * $Log: qbase64.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2024-01-23 01:22:20+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -36,14 +39,14 @@ static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -52,7 +55,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -106,7 +109,7 @@ main(int argc, char **argv) void getversion_qbase64_c() { - static char *x = "$Id: qbase64.c,v 1.9 2024-01-23 01:22:20+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qbase64.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qcat.c b/indimail-mta-x/qcat.c index 2a3da9a493..2442a3ce91 100644 --- a/indimail-mta-x/qcat.c +++ b/indimail-mta-x/qcat.c @@ -18,7 +18,7 @@ * convert() function code taken and adaptred from coreutils/src/cat.c * By tege@sics.se, Torbjörn Granlund, advised by rms, Richard Stallman. * - * $Id: qcat.c,v 1.11 2024-02-22 08:35:30+05:30 Cprogrammer Exp mbhangui $ + * $Id: qcat.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -42,14 +42,14 @@ static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -58,7 +58,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -236,13 +236,16 @@ main(int argc, char **argv) void getversion_qmail_cat_c() { - static char *x = "$Id: qcat.c,v 1.11 2024-02-22 08:35:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qcat.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qcat.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2024-02-22 08:35:30+05:30 Cprogrammer * added options -v, -e, -t with code from coreutils/src/cat.c * diff --git a/indimail-mta-x/qcount_dir.c b/indimail-mta-x/qcount_dir.c index 077f67691d..07229783bf 100644 --- a/indimail-mta-x/qcount_dir.c +++ b/indimail-mta-x/qcount_dir.c @@ -1,5 +1,8 @@ /* * $Log: qcount_dir.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-10-18 12:59:56+05:30 Cprogrammer * replaced alloc_re() with alloc() * @@ -24,9 +27,9 @@ #include "substdio.h" static int -skip_system_files(char *filename) +skip_system_files(const char *filename) { - char *system_files[] = { + const char *system_files[] = { ".Trash", ".current_size", "domain", @@ -47,7 +50,7 @@ skip_system_files(char *filename) "shared-folders", 0, }; - char **ptr; + const char **ptr; int len; for (ptr = system_files; ptr && *ptr; ptr++) { @@ -58,7 +61,7 @@ skip_system_files(char *filename) return (0); } -ssize_t qcount_dir(char *dir_name, size_t *mailcount) +ssize_t qcount_dir(const char *dir_name, size_t *mailcount) { DIR *entry; struct dirent *dp; @@ -138,7 +141,7 @@ ssize_t qcount_dir(char *dir_name, size_t *mailcount) void getversion_qcount_dir_c() { - static char *x = "$Id: qcount_dir.c,v 1.3 2020-10-18 12:59:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qcount_dir.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qcount_dir.h b/indimail-mta-x/qcount_dir.h index 335d589154..6b4e42d9d9 100644 --- a/indimail-mta-x/qcount_dir.h +++ b/indimail-mta-x/qcount_dir.h @@ -1,5 +1,8 @@ /* * $Log: qcount_dir.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2020-03-24 12:56:28+05:30 Cprogrammer * Initial revision * @@ -8,6 +11,6 @@ #define QCOUNT_DIR_H #include -ssize_t qcount_dir(char *, size_t *); +ssize_t qcount_dir(const char *, size_t *); #endif diff --git a/indimail-mta-x/qdane.c b/indimail-mta-x/qdane.c index ed19ed57ac..433a700e92 100644 --- a/indimail-mta-x/qdane.c +++ b/indimail-mta-x/qdane.c @@ -1,5 +1,8 @@ /* * $Log: qdane.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2018-05-27 22:15:49+05:30 mbhangui * added defintions for qmail-daned modes * @@ -25,7 +28,7 @@ int noipv6 = 1; #endif void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -51,7 +54,7 @@ timeoutfn() } void -err_tmpfail(char *arg) +err_tmpfail(const char *arg) { out("temporary failure: "); out(arg); @@ -90,7 +93,7 @@ print_status(char status) return; } -char *usage = +const char *usage = "usage: qdane [qsf] -d mxhost ipaddr\n" " -q (query mode - DANE VERIFICATION)\n" " -S (update mode - success)\n" @@ -165,7 +168,7 @@ main(int argc, char **argv) void getversion_qdane_c() { - static char *x = "$Id: qdane.c,v 1.3 2018-05-27 22:15:49+05:30 mbhangui Exp mbhangui $"; + const char *x = "$Id: qdane.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qhpsi.c b/indimail-mta-x/qhpsi.c index 517a935b46..0d8d3c2f93 100644 --- a/indimail-mta-x/qhpsi.c +++ b/indimail-mta-x/qhpsi.c @@ -1,5 +1,5 @@ /* - * $Id: qhpsi.c,v 1.12 2023-10-27 16:11:40+05:30 Cprogrammer Exp mbhangui $ + * $Id: qhpsi.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -27,8 +27,8 @@ main(int argc, char **argv) { int childrc = -1, i, u, flaglog = 0; void *handle; - int (*func) (char *); - char *messfn, *error, *queue_plugin_symbol, *plugindir; + int (*func) (const char *); + const char *messfn, *error, *queue_plugin_symbol, *plugindir; stralloc plugin = { 0 }; if (uidinit(1, 1) == -1) @@ -106,12 +106,15 @@ main(int argc, char **argv) void getversion_qmail_qhpsi_c() { - static char *x = "$Id: qhpsi.c,v 1.12 2023-10-27 16:11:40+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qhpsi.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qhpsi.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2023-10-27 16:11:40+05:30 Cprogrammer * replace hard-coded exit values with constants from qmail.h * diff --git a/indimail-mta-x/qmail-cdb.c b/indimail-mta-x/qmail-cdb.c index 5180f43d2d..397de8c26c 100644 --- a/indimail-mta-x/qmail-cdb.c +++ b/indimail-mta-x/qmail-cdb.c @@ -1,5 +1,8 @@ /* * $Log: qmail-cdb.c,v $ + * Revision 1.16 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.15 2023-03-12 19:03:59+05:30 Cprogrammer * allow workdir to be overriden by SYSCONFDIR, CONTROLDIR env variables * @@ -71,7 +74,8 @@ int main(int argc, char **argv) { char inbuf[1024]; - char *arg, *ptr, *workdir; + const char *arg, *workdir; + char *ptr; int fd, fdtemp, match, i, recipient_cdb = 0, do_move = 0, dlen; struct cdbmss cdbmss; @@ -182,7 +186,7 @@ main(int argc, char **argv) void getversion_qmail_cdb_c() { - static char *x = "$Id: qmail-cdb.c,v 1.15 2023-03-12 19:03:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-cdb.c,v 1.16 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-clean.c b/indimail-mta-x/qmail-clean.c index 674f06ec07..1157516689 100644 --- a/indimail-mta-x/qmail-clean.c +++ b/indimail-mta-x/qmail-clean.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-clean.c,v 1.15 2023-12-25 10:03:23+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-clean.c,v 1.16 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -57,7 +57,7 @@ cleanuppid() } void -respond(char *s) +respond(const char *s) { if (substdio_putflush(subfdoutsmall, s, 1) == -1) _exit(100); @@ -140,13 +140,16 @@ if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; } void getversion_qmail_clean_c() { - static char *x = "$Id: qmail-clean.c,v 1.15 2023-12-25 10:03:23+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-clean.c,v 1.16 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-clean.c,v $ + * Revision 1.16 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.15 2023-12-25 10:03:23+05:30 Cprogrammer * made OSSIFIED configurable * diff --git a/indimail-mta-x/qmail-daned.c b/indimail-mta-x/qmail-daned.c index 5e6cf2492e..61ed1a9eae 100644 --- a/indimail-mta-x/qmail-daned.c +++ b/indimail-mta-x/qmail-daned.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-daned.c,v 1.34 2024-02-08 22:05:36+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-daned.c,v 1.35 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "hastlsa.h" #include "subfd.h" @@ -73,7 +73,7 @@ static int dane_count, hcount; static int hash_size, h_allocated = 0; static int whitelistok = 0; static int tlsadomainsok = 0; -static char *whitefn = 0, *tlsadomainsfn = 0; +static char *whitefn = 0, *tlsadomainsfn = NULL; static stralloc context_file = { 0 }; static stralloc line = { 0 }; static stralloc whitelist = { 0 }; @@ -113,13 +113,13 @@ whitelist_init(char *arg) int domain_match(char *fn, stralloc *domain, stralloc *content, - struct constmap *ptrmap, char **errStr) + struct constmap *ptrmap, const char *errStr[]) { int x, len; char *ptr; if (errStr) - *errStr = 0; + *errStr = NULL; if (fn) { switch ((x = cdb_matchaddr(fn, domain->s, domain->len - 1))) { @@ -148,9 +148,9 @@ domain_match(char *fn, stralloc *domain, stralloc *content, } int -is_tlsadomain(char *domain) +is_tlsadomain(const char *domain) { - char *errStr = 0; + const char *errStr = NULL; static stralloc _domain = { 0 }; if (!stralloc_copys(&_domain, domain) || @@ -174,9 +174,9 @@ is_tlsadomain(char *domain) } int -is_white(char *domain) +is_white(const char *domain) { - char *errStr = 0; + const char *errStr = NULL; static stralloc _domain = { 0 }; if (!stralloc_copys(&_domain, domain) || @@ -200,7 +200,7 @@ is_white(char *domain) } int -copy_dane(struct danerec *ptr, char *domain, char status) +copy_dane(struct danerec *ptr, const char *domain, char status) { int len; @@ -285,7 +285,7 @@ create_hash(struct danerec *curr) */ hdestroy(); hcount = 0; - curr = 0; + curr = NULL; logerr("WARNING!! recreating hash table, size="); strnum[fmt_ulong(strnum, (unsigned long) ((125 * hash_size * h_allocated)/100))] = 0; logerr(strnum); @@ -341,7 +341,7 @@ expire_records(time_t cur_time) dane_count--; if (ptr == head) { head = ptr->next; - head->prev = 0; + head->prev = NULL; } (ptr->prev)->next = ptr->next; (ptr->next)->prev = ptr->prev; @@ -361,7 +361,7 @@ expire_records(time_t cur_time) } int -search_record(char *domain, int fr_int, struct danerec **store) +search_record(const char *domain, int fr_int, struct danerec **store) { struct danerec *ptr; time_t cur_time, start; @@ -390,7 +390,7 @@ search_record(char *domain, int fr_int, struct danerec **store) } } else ptr = head; /*- latest unexpired entry */ - e.key = domain; + e.key = (char *) domain; if (!(ep = hsearch(e, FIND))) return (RECORD_NEW); ptr = (struct danerec *) ep->data; @@ -408,14 +408,14 @@ search_record(char *domain, int fr_int, struct danerec **store) * added to hash list if not found in hash list */ struct danerec * -add_record(char *domain, char status, struct danerec **dnrec) +add_record(const char *domain, char status, struct danerec **dnrec) { struct danerec *ptr; if (!head) { if (!(ptr = (struct danerec *) malloc(sizeof(struct danerec)))) die_nomem(); - ptr->prev = ptr->next = 0; + ptr->prev = ptr->next = NULL; head = tail = ptr; } else { if (!(ptr = (struct danerec *) malloc(sizeof(struct danerec)))) @@ -439,7 +439,7 @@ add_record(char *domain, char status, struct danerec **dnrec) } int -write_file(int fd, char *arg, int len) +write_file(int fd, const char *arg, int len) { int i; @@ -556,8 +556,8 @@ load_context() if (!head) { if (!(ptr = (struct danerec *) malloc(sizeof(struct danerec)))) die_nomem(); - ptr->prev = 0; - ptr->next = 0; + ptr->prev = NULL; + ptr->next = NULL; head = tail = ptr; } else { if (!(ptr = (struct danerec *) malloc(sizeof(struct danerec)))) @@ -669,8 +669,8 @@ sigterm() _exit (0); } -char * -print_status(char status) +const char * +print_status(const char status) { switch (status) { @@ -702,11 +702,11 @@ print_status(char status) * record ok \1\2 */ int -send_response(int s, union sockunion *from, int fromlen, char *domain, +send_response(int s, union sockunion *from, int fromlen, const char *domain, int fr_int, struct danerec **dnrecord, int *record_added, int *org_state, int qmr) { - char *resp; - struct danerec *ptr = 0; + const char *resp; + struct danerec *ptr = NULL; char dane_state, rbuf[2]; int i, n = 0; @@ -877,7 +877,7 @@ send_response(int s, union sockunion *from, int fromlen, char *domain, return (0); } -char *pusage = +const char *pusage = "usage: qmail-daned [options] ipaddr context_file\n" "Options [ vhtfswi ]\n" " [ -v 0, 1 or 2]\n" @@ -894,15 +894,16 @@ main(int argc, char **argv) fromlen, rec_added, o_s, qmr; union sockunion sin, from; #if defined(LIBC_HAS_IP6) - struct addrinfo hints = {0}, *res = 0, *res0 = 0; + struct addrinfo hints = {0}, *res = NULL, *res0 = NULL; #else struct hostent *hp; #endif struct danerec *dnrec; unsigned long save_interval, free_interval; - char *ptr, *ipaddr = 0, *domain, *a_port = "1998"; + char *ptr, *domain; + const char *ipaddr = NULL, *a_port = "1998"; #ifdef DYNAMIC_BUF - char *rdata = 0, *buf = 0; + char *rdata = NULL, *buf = NULL; int bufsize = MAXDANEDATASIZE, buf_len, rdata_len; #else char rdata[MAXDANEDATASIZE]; @@ -1162,7 +1163,7 @@ main(int argc, char **argv) * danerec(3) protocol packet structure - * Dgmail.com\0 */ - domain = 0; + domain = NULL; switch (rdata[0]) { case 'E': /*- same as 'D' but send back TLSA RR data */ @@ -1256,7 +1257,7 @@ main() void getversion_qmail_dane_c() { - static char *x = "$Id: qmail-daned.c,v 1.34 2024-02-08 22:05:36+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-daned.c,v 1.35 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #if defined(HASTLSA) && defined(TLS) x = sccsidstarttlsh; @@ -1268,6 +1269,9 @@ getversion_qmail_dane_c() /* * $Log: qmail-daned.c,v $ + * Revision 1.35 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.34 2024-02-08 22:05:36+05:30 Cprogrammer * fix potential use after free() * diff --git a/indimail-mta-x/qmail-direct.c b/indimail-mta-x/qmail-direct.c index 661aa67bca..f1dc693b0f 100644 --- a/indimail-mta-x/qmail-direct.c +++ b/indimail-mta-x/qmail-direct.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-direct.c,v 1.13 2023-12-25 09:40:23+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-direct.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -63,7 +63,7 @@ cleanup() } no_return void -die(int e, char *str) +die(int e, const char *str) { cleanup(); if (qm_custom_err) @@ -135,7 +135,7 @@ received_setup() } unsigned int -fmtqfn(char *s, char *dirslash, unsigned long id, char *suffix) +fmtqfn(char *s, const char *dirslash, unsigned long id, const char *suffix) { unsigned int len; unsigned int i; @@ -160,7 +160,7 @@ fmtqfn(char *s, char *dirslash, unsigned long id, char *suffix) } char * -fnnum(char *dirslash, char *suffix) +fnnum(const char *dirslash, const char *suffix) { char *s; @@ -537,15 +537,16 @@ main(int argc, char **argv) void getversion_qmail_direct_c() { - static char *x = "$Id: qmail-direct.c,v 1.13 2023-12-25 09:40:23+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-direct.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidpidopenh; - if (x) - x++; + x++; } /* * $Log: qmail-direct.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2023-12-25 09:40:23+05:30 Cprogrammer * made DEATH configurable * diff --git a/indimail-mta-x/qmail-dkim.c b/indimail-mta-x/qmail-dkim.c index 32b73e190e..a2bb4f0cdf 100644 --- a/indimail-mta-x/qmail-dkim.c +++ b/indimail-mta-x/qmail-dkim.c @@ -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-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "hasdkim.h" #ifdef HASDKIM @@ -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) @@ -144,10 +144,10 @@ maybe_die_dkim(int e) return; } } - -static char *dkimsign = 0; -static char *dkimverify = 0; -static char *dkimpractice = "FGHIJKLMNPQRSTUVWX"; +typedef const char c_char; +static c_char *dkimsign = 0; +static c_char *dkimverify = 0; +static c_char *dkimpractice = "FGHIJKLMNPQRSTUVWX"; static stralloc dkimoutput = { 0 }; /*- DKIM-Signature */ static stralloc dksignature = { 0 }; /*- content of private signature */ static stralloc sigdomains = { 0 }; /*- domains which must have signatures */ @@ -163,10 +163,11 @@ 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; + const char *p; + char *t, *s; int i, d, r, len; static stralloc tmp = {0}; @@ -213,7 +214,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; @@ -321,9 +322,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 }; @@ -435,7 +437,7 @@ write_signature(char *domain, DKIMSignOptions *opts, size_t selector_size) } int -ParseTagValues(char *list, char *letters[], char *values[]) +ParseTagValues(char *list, const char *letters[], char *values[]) { char *t, *ptr, *key; int i; @@ -487,7 +489,7 @@ int checkSSP(char *domain, int *bTesting) { char *query, *results; - char *tags[] = { "dkim", "t", 0}; + const char *tags[] = { "dkim", "t", 0}; char *values[2]; int bIsParentSSP = 0, iSSP = DKIM_SSP_UNKNOWN; @@ -562,7 +564,7 @@ int checkADSP(char *domain) { char *query, *results; - char *tags[] = { "dkim", 0}; + const char *tags[] = { "dkim", 0}; char *values[1]; results = dns_text(domain); @@ -612,7 +614,7 @@ checkADSP(char *domain) } void -dkimverify_exit(int dkimRet, char *status, char *code) +dkimverify_exit(int dkimRet, const char *status, const char *code) { if (dkimRet < 0) { if (dkimverify[str_chr(dkimverify, 'F' - dkimRet)]) @@ -630,7 +632,7 @@ dkimverify_exit(int dkimRet, char *status, char *code) void writeHeaderNexit(int ret, int origRet, int resDKIMSSP, int resDKIMADSP, int useSSP, int useADSP) { - char *dkimStatus = 0, *sspStatus = 0, *adspStatus = 0, *code = 0, *orig = 0; + const char *dkimStatus = 0, *sspStatus = 0, *adspStatus = 0, *code = 0, *orig = 0; char strnum[FMT_ULONG]; switch (ret) @@ -961,7 +963,7 @@ main(int argc, char *argv[]) int sCount = 0, sSize = 0, verbose = 0; int ret = 0, origRet = DKIM_MAX_ERROR, i, nSigCount = 0, len, token_len; unsigned long pid, death; - char *selector = NULL, *ptr; + const char *selector = NULL, *ptr; stralloc dkimfn = {0}; DKIMVerifyDetails *pDetails; DKIMSignOptions sopts = { 0 }; @@ -1018,7 +1020,7 @@ main(int argc, char *argv[]) if (DKIMSignInit(&ctxt, &sopts) != DKIM_SUCCESS) /*- failed to initialize signature */ custom_error("qmail-dkim", "Z", "dkim initialization failed", 0, "X.3.0"); } else { - char *x; + const char *x; restore_gid(); if (!dkimverify) @@ -1103,7 +1105,7 @@ main(int argc, char *argv[]) } if (dkimsign || dkimverify) { if (dkimsign) { - char *t; + const char *t; if (!(t = DKIMSignGetDomain(&ctxt))) { DKIMSignFree(&ctxt); @@ -1298,12 +1300,10 @@ 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 $"; + const char *x = "$Id: qmail-dkim.c,v 1.83 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #ifdef HASDKIM x = sccsidmakeargsh; - x = sccsidqmultih; - x = sccsidpidopenh; x = sccsidgetdomainth; #endif x++; @@ -1312,6 +1312,9 @@ getversion_qmail_dkim_c() /* * $Log: qmail-dkim.c,v $ + * Revision 1.83 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.82 2024-01-23 01:22:34+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/qmail-getpw.c b/indimail-mta-x/qmail-getpw.c index 6d634cc239..00c5c01935 100644 --- a/indimail-mta-x/qmail-getpw.c +++ b/indimail-mta-x/qmail-getpw.c @@ -1,5 +1,8 @@ /* * $Log: qmail-getpw.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2021-07-05 21:24:03+05:30 Cprogrammer * use qgetpw interface from libqmail if USE_QPWGR is set * @@ -35,7 +38,8 @@ #define GETPW_USERLEN 32 -static char *local, *dash, *extension; +typedef const char c_char; +static c_char *local, *dash, *extension; static int use_pwgr; static struct passwd *pw; @@ -116,7 +120,7 @@ main(int argc, char **argv) void getversion_qmail_getpw_c() { - static char *x = "$Id: qmail-getpw.c,v 1.8 2021-07-05 21:24:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-getpw.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-greyd.c b/indimail-mta-x/qmail-greyd.c index bb56907eeb..e9df218198 100644 --- a/indimail-mta-x/qmail-greyd.c +++ b/indimail-mta-x/qmail-greyd.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-greyd.c,v 1.37 2024-02-08 22:02:15+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-greyd.c,v 1.38 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -106,7 +106,7 @@ die_nomem() } no_return void -die_control(char *arg) +die_control(const char *arg) { substdio_flush(subfdout); substdio_puts(subfderr, FATAL); @@ -119,29 +119,29 @@ die_control(char *arg) void #ifdef HAVE_STDARG_H -out(char *s1, ...) +out(const char *s1, ...) #else out(va_alist) va_dcl #endif { va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H - char *s1; + const char *s1; #endif #ifdef HAVE_STDARG_H va_start(ap, s1); #else va_start(ap); - s1 = va_arg(ap, char *); + s1 = va_arg(ap, const char *); #endif if (substdio_puts(subfdout, s1) == -1) _exit(1); while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; if (substdio_puts(subfdout, str) == -1) @@ -160,29 +160,29 @@ flush() void #ifdef HAVE_STDARG_H -logerr(char *s1, ...) +logerr(const char *s1, ...) #else logerr(va_alist) va_dcl #endif { va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H - char *s1; + const char *s1; #endif #ifdef HAVE_STDARG_H va_start(ap, s1); #else va_start(ap); - s1 = va_arg(ap, char *); + s1 = va_arg(ap, const char *); #endif if (substdio_puts(subfderr, s1) == -1) _exit(1); while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; if (substdio_puts(subfderr, str) == -1) @@ -204,7 +204,7 @@ logflush() * Range can filled in struct netspec */ int -cidr2IPrange(char *ipaddr, int mask, struct netspec *spec) +cidr2IPrange(const char *ipaddr, int mask, struct netspec *spec) { ip_addr ip; @@ -223,7 +223,7 @@ stralloc whitelist = { 0 }; struct constmap mapwhite; void -whitelist_init(char *arg) +whitelist_init(const char *arg) { if (verbose > 2) { logerr("initializing whitelist\n", NULL); @@ -242,7 +242,7 @@ whitelist_init(char *arg) int ip_match(stralloc *ipaddr, stralloc *content, struct constmap *ptrmap, - char **errStr) + const char *errStr[]) { int x, len, mask; struct netspec netspec; @@ -251,7 +251,7 @@ ip_match(stralloc *ipaddr, stralloc *content, struct constmap *ptrmap, char *ptr; if (errStr) - *errStr = 0; + *errStr = NULL; if (whitefn) { switch ((x = cdb_matchaddr(whitefn, ipaddr->s, ipaddr->len - 1))) { @@ -303,9 +303,9 @@ ip_match(stralloc *ipaddr, stralloc *content, struct constmap *ptrmap, } int -is_white(char *ip) +is_white(const char *ip) { - char *errStr = 0; + const char *errStr = NULL; static stralloc ipaddr = { 0 }; if (!stralloc_copys(&ipaddr, ip) || @@ -329,7 +329,7 @@ is_white(char *ip) } int -copy_grey(struct greylst *ptr, char *ipaddr, char *rpath, char *rcpt, int rcptlen) +copy_grey(struct greylst *ptr, const char *ipaddr, const char *rpath, const char *rcpt, int rcptlen) { int len; @@ -370,11 +370,11 @@ grey_compare(int *key, struct greylst *ptr) } void -print_record(char *ip, char *rpath, char *rcpt, int rcptlen, time_t timestamp, +print_record(const char *ip, const char *rpath, const char *rcpt, int rcptlen, time_t timestamp, char status, int operation) { char strnum[FMT_ULONG]; - char *ptr; + const char *ptr; strnum[fmt_ulong(strnum, (unsigned long) timestamp)] = 0; out(strnum, " IP: ", ip, " FROM: ", rpath, " RCPT: [", NULL); @@ -418,7 +418,7 @@ print_record(char *ip, char *rpath, char *rcpt, int rcptlen, time_t timestamp, } int -compare_ip(unsigned char *ip1, unsigned char *ip2) +compare_ip(const unsigned char *ip1, const unsigned char *ip2) { register int i; @@ -574,7 +574,7 @@ struct greylst *grey_index; */ int -search_record(char *remoteip, char *rpath, char *rcpt, int rcptlen, int min_resend, +search_record(const char *remoteip, const char *rpath, const char *rcpt, int rcptlen, int min_resend, int resend_win, int fr_int, struct greylst **store) { struct greylst *ptr; @@ -617,7 +617,7 @@ search_record(char *remoteip, char *rpath, char *rcpt, int rcptlen, int min_rese logflush(); return (0); } - e.key = remoteip; + e.key = (char *) remoteip; if (!(ep = hsearch(e, FIND))) return (RECORD_NEW); for (found = 0, ptr = (struct greylst *) ep->data;ptr;ptr = ptr->ip_next) { @@ -667,7 +667,7 @@ search_record(char *remoteip, char *rpath, char *rcpt, int rcptlen, int min_rese * added to hash list if not found in hash list */ struct greylst * -add_record(char *ip, char *rpath, char *rcpt, int rcptlen, struct greylst **grey) +add_record(const char *ip, const char *rpath, const char *rcpt, int rcptlen, struct greylst **grey) { struct greylst *ptr; @@ -698,11 +698,11 @@ add_record(char *ip, char *rpath, char *rcpt, int rcptlen, struct greylst **grey } int -send_response(int s, union sockunion *from, int fromlen, char *ip, char *rpath, - char *rcpt, int rcptlen, int min_resend, int resend_win, int fr_int, +send_response(int s, union sockunion *from, int fromlen, const char *ip, const char *rpath, + const char *rcpt, int rcptlen, int min_resend, int resend_win, int fr_int, struct greylst **grey, int *record_added) { - char *resp; + const char *resp; int i, n = 0; #ifndef IPV6 unsigned char ibuf[sizeof(struct in6_addr)]; @@ -766,7 +766,7 @@ send_response(int s, union sockunion *from, int fromlen, char *ip, char *rpath, } int -write_file(int fd, char *arg, int len) +write_file(int fd, const char *arg, int len) { int i; @@ -1009,7 +1009,7 @@ sigterm() _exit(0); } -char * +const char * print_status(char status) { switch (status) @@ -1039,7 +1039,7 @@ print_status(char status) * greydaemon [-w whitelist] [-t timeout_days] [-g resend_window_hours] * [-m min_resend_minutes] ipaddr savefile */ -char *usage = +const char *usage = "usage: qmail-greyd [options] ipaddr context_file\n" "Options [ vhtgmfspw ]\n" " [ -v 0, 1 or 2]\n" @@ -1063,7 +1063,8 @@ main(int argc, char **argv) #endif struct greylst *grey; unsigned long resend_window, min_resend, save_interval, free_interval; - char *ptr, *ipaddr = 0, *client_ip = 0, *rpath = 0, *rcpt_head = 0, *a_port = "1999"; + char *ptr, *client_ip = 0, *rpath = 0, *rcpt_head = 0; + const char *ipaddr, *a_port = "1999"; #ifdef DYNAMIC_BUF char *rdata = 0, *buf = 0; int bufsize = MAXGREYDATASIZE; @@ -1432,13 +1433,16 @@ main(int argc, char **argv) void getversion_qmail_greyd_c() { - static char *x = "$Id: qmail-greyd.c,v 1.37 2024-02-08 22:02:15+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-greyd.c,v 1.38 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-greyd.c,v $ + * Revision 1.38 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.37 2024-02-08 22:02:15+05:30 Cprogrammer * fix potential use after free() * diff --git a/indimail-mta-x/qmail-inject.c b/indimail-mta-x/qmail-inject.c index 574270847c..678fe306a2 100644 --- a/indimail-mta-x/qmail-inject.c +++ b/indimail-mta-x/qmail-inject.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-inject.c,v 1.51 2023-12-23 00:17:13+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-inject.c,v 1.52 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -47,15 +47,16 @@ datetime_sec starttime; +typedef const char c_char; static unsigned long databytes = 0; static unsigned long size = 0; static token822_alloc envs = { 0 }; static struct qmail qqt; -static char *qmopts; -static char *mailhost; -static char *mailuser; -static char *mailrhost; -static char *mailruser; +static c_char *qmopts; +static c_char *mailhost; +static c_char *mailuser; +static c_char *mailrhost; +static c_char *mailruser; static int flagdeletesender = 0; static int flagdeletefrom = 0; static int flagdeletemessid = 0; @@ -104,7 +105,7 @@ static token822_alloc df = { 0 }; static token822_alloc drp = { 0 }; void -put(char *s, int len) +put(const char *s, int len) { if (flagqueue) { qmail_put(&qqt, s, len); @@ -118,7 +119,7 @@ put(char *s, int len) } void -my_puts(char *s) +my_puts(const char *s) { put(s, str_len(s)); } @@ -167,7 +168,7 @@ die_regex() } no_return void -die_control(char *arg) +die_control(const char *arg) { substdio_puts(subfderr, "qmail-inject: fatal: unable to read control file "); substdio_puts(subfderr, arg); @@ -256,7 +257,7 @@ do_domainqueue(char *recip) no_return void exitnicely() { - char *qqx; + const char *qqx; if (!flagqueue) substdio_flush(subfdout); @@ -658,7 +659,7 @@ defaultfrommake() die_nomem(); df.len = 0; df.t[df.len].type = TOKEN822_ATOM; - df.t[df.len].s = "From"; + df.t[df.len].s = (char *) "From"; df.t[df.len].slen = 4; ++df.len; df.t[df.len].type = TOKEN822_COLON; @@ -672,14 +673,14 @@ defaultfrommake() ++df.len; } df.t[df.len].type = mailusertokentype; - df.t[df.len].s = mailuser; + df.t[df.len].s = (char *) mailuser; df.t[df.len].slen = str_len(mailuser); ++df.len; if (mailhost) { df.t[df.len].type = TOKEN822_AT; ++df.len; df.t[df.len].type = TOKEN822_ATOM; - df.t[df.len].s = mailhost; + df.t[df.len].s = (char *) mailhost; df.t[df.len].slen = str_len(mailhost); ++df.len; } @@ -689,7 +690,7 @@ defaultfrommake() } if (fullname && flagnamecomment) { df.t[df.len].type = TOKEN822_COMMENT; - df.t[df.len].s = fullname; + df.t[df.len].s = (char *) fullname; df.t[df.len].slen = str_len(fullname); ++df.len; } @@ -720,7 +721,7 @@ dodefaultreturnpath() die_nomem(); drp.len = 0; drp.t[drp.len].type = TOKEN822_ATOM; - drp.t[drp.len].s = "Return-Path"; + drp.t[drp.len].s = (char *) "Return-Path"; drp.t[drp.len].slen = 11; ++drp.len; drp.t[drp.len].type = TOKEN822_COLON; @@ -733,7 +734,7 @@ dodefaultreturnpath() drp.t[drp.len].type = TOKEN822_AT; ++drp.len; drp.t[drp.len].type = TOKEN822_ATOM; - drp.t[drp.len].s = mailrhost; + drp.t[drp.len].s = (char *) mailrhost; drp.t[drp.len].slen = str_len(mailrhost); ++drp.len; } @@ -1075,13 +1076,16 @@ main(int argc, char **argv) void getversion_qmail_inject_c() { - static char *x = "$Id: qmail-inject.c,v 1.51 2023-12-23 00:17:13+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-inject.c,v 1.52 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-inject.c,v $ + * Revision 1.52 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.51 2023-12-23 00:17:13+05:30 Cprogrammer * prevent SIGSEGV in do_domainqueue if recip is null * diff --git a/indimail-mta-x/qmail-local.c b/indimail-mta-x/qmail-local.c index 5b433417f5..e7bcf334dd 100644 --- a/indimail-mta-x/qmail-local.c +++ b/indimail-mta-x/qmail-local.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-local.c,v 1.50 2023-10-02 22:50:22+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-local.c,v 1.51 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -47,8 +47,9 @@ #include "auto_patrn.h" #include "filterit.h" -static char *user, *homedir, *local, *dash, *ext, *host, *sender, *aliasempty, *qqeh; -static char *overquota = "Recipient's mailbox is full, message returned to sender. (#5.2.2)"; +typedef const char c_char; +static c_char *user, *homedir, *local, *dash, *ext, *host, *sender, *aliasempty, *qqeh; +static c_char *overquota = "Recipient's mailbox is full, message returned to sender. (#5.2.2)"; static char buf[1024], outbuf[1024]; static int flagdoit, flag99; static stralloc safeext, ufline, rpline, envrecip, dtline, qme, ueo, cmds, @@ -73,7 +74,7 @@ temp_rewind() } no_return void -temp_childcrashed(char *p) +temp_childcrashed(const char *p) { if (p) strerr_die3x(111, "Aack, child [", p, "] crashed. (#4.3.0)"); @@ -100,8 +101,7 @@ temp_slowlock() } no_return void -temp_qmail(fn) - char *fn; +temp_qmail(const char *fn) { strerr_die5x(111, "Unable to open ", fn, ": ", error_str(errno), ". (#4.3.0)"); } @@ -125,7 +125,7 @@ die_srs() #endif void -maildir(char *fn) +maildir(const char *fn) { pid_t child; int wstat; @@ -161,9 +161,9 @@ maildir(char *fn) } void -filterit(char *cmd) +filterit(const char *cmd) { - char *x; + const char *x; if (!env_put2("QQEH", qqeh)) temp_nomem(); @@ -184,14 +184,11 @@ filterit(char *cmd) } void -mailfile(char *fn) +mailfile(const char *fn) { - int fd; - substdio ss; - substdio ssout; - int match; + int fd, match, flaglocked; + substdio ss, ssout; seek_pos pos; - int flaglocked; if (seek_begin(0) == -1) temp_rewind(); @@ -259,7 +256,7 @@ mailfile(char *fn) } void -mailprogram(char *prog) +mailprogram(const char *prog) { pid_t child; char *(args[4]); @@ -275,9 +272,9 @@ mailprogram(char *prog) case 0: if (!env_put2("QQEH", qqeh)) temp_nomem(); - args[0] = "/bin/sh"; - args[1] = "-c"; - args[2] = prog; + args[0] = (char *) "/bin/sh"; + args[1] = (char *) "-c"; + args[2] = (char *) prog; args[3] = 0; sig_pipedefault(); pathexec(args); @@ -314,7 +311,7 @@ void mailforward(char **recips) { struct qmail qqt; - char *qqx; + const char *qqx; char **a; substdio ss; int match, x; @@ -408,7 +405,7 @@ bouncexf() } void -checkhome(char *home_dir) +checkhome(const char *home_dir) { struct stat st; int ldmok; @@ -449,7 +446,7 @@ checkhome(char *home_dir) } int -qmeox(char *dashowner) +qmeox(const char *dashowner) { struct stat st; @@ -571,7 +568,7 @@ count_print() } void -sayit(char *type, char *cmd, unsigned int len) +sayit(const char *type, const char *cmd, unsigned int len) { substdio_puts(subfdoutsmall, type); substdio_put(subfdoutsmall, cmd, len); @@ -581,10 +578,10 @@ sayit(char *type, char *cmd, unsigned int len) void sanitize_env(char *x) { - char *e; + const char *e; int i, j; struct env_tab { - char *env_name; + const char *env_name; char *env_val; } etable[] = { { "USE_FSYNC", 0 }, @@ -636,7 +633,7 @@ sanitize_env(char *x) int main(int argc, char **argv) { - char *x, *e; + const char *x, *e; char **recips; int opt, fd, flagforwardonly, r; unsigned int i, j, numforward; @@ -649,7 +646,7 @@ main(int argc, char **argv) if (!stralloc_ready(&cmds, 0)) temp_nomem(); if ((x = env_get("SANITIZE_ENV"))) - sanitize_env(x); + sanitize_env((char *) x); flagdoit = 1; while ((opt = getopt(argc, argv, "nN")) != opteof) { switch (opt) @@ -746,7 +743,7 @@ main(int argc, char **argv) temp_nomem(); if (!env_put2("UFLINE", foo.s)) temp_nomem(); - x = ext; + x = (char *) ext; if (!env_put2("EXT", x)) temp_nomem(); x += str_chr(x, '-'); @@ -986,7 +983,7 @@ main(int argc, char **argv) void getversion_qmail_local_c() { - static char *x = "$Id: qmail-local.c,v 1.50 2023-10-02 22:50:22+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-local.c,v 1.51 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmyctimeh; x++; @@ -994,6 +991,9 @@ getversion_qmail_local_c() /* * $Log: qmail-local.c,v $ + * Revision 1.51 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.50 2023-10-02 22:50:22+05:30 Cprogrammer * fix copy of srs_result * diff --git a/indimail-mta-x/qmail-lspawn.c b/indimail-mta-x/qmail-lspawn.c index 058677c862..be0e9a0286 100644 --- a/indimail-mta-x/qmail-lspawn.c +++ b/indimail-mta-x/qmail-lspawn.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-lspawn.c,v 1.46 2023-12-20 11:13:33+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-lspawn.c,v 1.47 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -304,7 +304,7 @@ copy_pwstruct(struct passwd *pw, char *recip, int at, int is_inactive) #ifdef ENABLE_VIRTUAL_PKG int -set_pwstruct(char *recip, int at, char *libptr, void *phandle, int (*isvirtualdomain) (char *)) +set_pwstruct(char *recip, int at, const char *libptr, void *phandle, int (*isvirtualdomain) (const char *)) { int f; struct passwd *pw; @@ -376,10 +376,10 @@ SPAWN(int fdmess, int fdout, unsigned long msgsize, char *sender, char *qqeh, ch int f, at = at_t; char *ptr, *recip = recip_t; #ifdef ENABLE_VIRTUAL_PKG /*- for indimail */ - char *libptr, *tptr; + const char *libptr, *tptr; int len; extern void *phandle; - int (*isvirtualdomain) (char *); + int (*isvirtualdomain) (const char *); #endif if (!env_unset("QMAILREMOTE")) @@ -491,7 +491,7 @@ SPAWN(int fdmess, int fdout, unsigned long msgsize, char *sender, char *qqeh, ch !stralloc_0(&q)) _exit (QLX_NOMEM); args[0] = q.s; - args[1] = "--"; + args[1] = (char *) "--"; args[2] = x; /*- n = user */ n = byte_chr(x, xlen, 0); if (n++ == xlen) @@ -566,7 +566,7 @@ SPAWN(int fdmess, int fdout, unsigned long msgsize, char *sender, char *qqeh, ch void getversion_qmail_lspawn_c() { - static char *x = "$Id: qmail-lspawn.c,v 1.46 2023-12-20 11:13:33+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-lspawn.c,v 1.47 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -574,6 +574,9 @@ getversion_qmail_lspawn_c() /* * $Log: qmail-lspawn.c,v $ + * Revision 1.47 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.46 2023-12-20 11:13:33+05:30 Cprogrammer * refactored code for setting PWSTRUCT environment variable * diff --git a/indimail-mta-x/qmail-multi.c b/indimail-mta-x/qmail-multi.c index 2fbbecc808..be600557a9 100644 --- a/indimail-mta-x/qmail-multi.c +++ b/indimail-mta-x/qmail-multi.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-multi.c,v 1.4 2023-12-25 09:30:34+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-multi.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -43,16 +43,17 @@ main(int argc, char **argv) void getversion_qmail_multi_c() { - static char *x = "$Id: qmail-multi.c,v 1.4 2023-12-25 09:30:34+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-multi.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidqmultih; - x = sccsidmailfilterh; x++; } #endif /* * $Log: qmail-multi.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2023-12-25 09:30:34+05:30 Cprogrammer * made DEATH configurable * diff --git a/indimail-mta-x/qmail-newu.c b/indimail-mta-x/qmail-newu.c index 571128d8f2..e4a1024bbf 100644 --- a/indimail-mta-x/qmail-newu.c +++ b/indimail-mta-x/qmail-newu.c @@ -1,5 +1,8 @@ /* * $Log: qmail-newu.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2023-02-12 13:28:28+05:30 Cprogrammer * refactored code * @@ -197,7 +200,7 @@ main(int argc, char **argv) void getversion_qmail_newu_c() { - static char *x = "$Id: qmail-newu.c,v 1.13 2023-02-12 13:28:28+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-newu.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-nullqueue.c b/indimail-mta-x/qmail-nullqueue.c index a5f7f80d8f..accf5af09f 100644 --- a/indimail-mta-x/qmail-nullqueue.c +++ b/indimail-mta-x/qmail-nullqueue.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-nullqueue.c,v 1.6 2023-12-25 09:30:39+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-nullqueue.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -53,13 +53,16 @@ main() void getversion_qmail_nullqueue_c() { - static char *x = "$Id: qmail-nullqueue.c,v 1.6 2023-12-25 09:30:39+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-nullqueue.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-nullqueue.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2023-12-25 09:30:39+05:30 Cprogrammer * made DEATH configurable * diff --git a/indimail-mta-x/qmail-popbull.c b/indimail-mta-x/qmail-popbull.c index cd7bf59213..ad0e6bab3f 100644 --- a/indimail-mta-x/qmail-popbull.c +++ b/indimail-mta-x/qmail-popbull.c @@ -1,5 +1,8 @@ /* * $Log: qmail-popbull.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -145,7 +148,7 @@ main(int argc, char **argv) if (chdir(maildirname) == -1) die_nocdmaildir(); - argv[3] = "."; + argv[3] = (char *) "."; if (stat(".timestamp", &st) == -1) ts_date = 0; else @@ -196,7 +199,7 @@ main(int argc, char **argv) void getversion_qmail_popbull_c() { - static char *x = "$Id: qmail-popbull.c,v 1.11 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-popbull.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-poppass.c b/indimail-mta-x/qmail-poppass.c index b214f2826c..336270cb09 100644 --- a/indimail-mta-x/qmail-poppass.c +++ b/indimail-mta-x/qmail-poppass.c @@ -1,5 +1,8 @@ /* * $Log: qmail-poppass.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2024-01-23 01:22:46+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -76,14 +79,14 @@ static stralloc new_pass = { 0 }; static substdio ssup; void -errlog(char *s) +errlog(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(111); } void -errlogf(char *s) +errlogf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(111); @@ -92,7 +95,7 @@ errlogf(char *s) } void -out(char *s) +out(const char *s) { if (substdio_puts(&ssout, s) == -1) _exit(111); @@ -106,7 +109,7 @@ flush() } no_return void -my_error(char *s1, int exit_val) +my_error(const char *s1, int exit_val) { if (substdio_puts(&sserr, s1)) _exit(111); @@ -366,7 +369,7 @@ main(int argc, char **argv) void getversion_qmail_poppass_c() { - static char *x = "$Id: qmail-poppass.c,v 1.8 2024-01-23 01:22:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-poppass.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; diff --git a/indimail-mta-x/qmail-pw2u.c b/indimail-mta-x/qmail-pw2u.c index 5a191ca520..06e9dca630 100644 --- a/indimail-mta-x/qmail-pw2u.c +++ b/indimail-mta-x/qmail-pw2u.c @@ -1,5 +1,8 @@ /* * $Log: qmail-pw2u.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -49,7 +52,8 @@ #include "auto_assign.h" #include "auto_usera.h" -static char *dashcolon = "-:"; +typedef const char c_char; +static c_char *dashcolon = "-:"; static int flagalias = 0; static int flagnoupper = 1; static int okincl; @@ -145,7 +149,7 @@ doaccount() { struct stat st; int i; - char *mailnames; + const char *mailnames; char *x; unsigned int xlen; @@ -329,7 +333,7 @@ dosubuser() int i; char *x; unsigned int xlen; - char *u; + const char *u; x = line.s; xlen = line.len; @@ -511,7 +515,7 @@ main(argc, argv) void getversion_qmail_pw2u_c() { - static char *x = "$Id: qmail-pw2u.c,v 1.10 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-pw2u.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-qfilter.c b/indimail-mta-x/qmail-qfilter.c index 594ea8870b..5dc9c5ad5d 100644 --- a/indimail-mta-x/qmail-qfilter.c +++ b/indimail-mta-x/qmail-qfilter.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-qfilter.c,v 1.24 2024-02-20 22:25:37+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-qfilter.c,v 1.25 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * Copyright (C) 2001,2004-2005 Bruce Guenter * @@ -395,15 +395,17 @@ main(int argc, char *argv[]) void getversion_qmail_qfilter_c() { - static char *x = "$Id: qmail-qfilter.c,v 1.24 2024-02-20 22:25:37+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-qfilter.c,v 1.25 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidqmultih; x++; } #endif /* * $Log: qmail-qfilter.c,v $ + * Revision 1.25 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.24 2024-02-20 22:25:37+05:30 Cprogrammer * added exit code 2 (blackhole) for compatibility with qmail-multi * diff --git a/indimail-mta-x/qmail-qmqpc.c b/indimail-mta-x/qmail-qmqpc.c index 80399a50d2..237c04d935 100644 --- a/indimail-mta-x/qmail-qmqpc.c +++ b/indimail-mta-x/qmail-qmqpc.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-qmqpc.c,v 1.27 2024-01-23 01:22:55+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-qmqpc.c,v 1.28 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -331,13 +331,16 @@ main(int argc, char **argv) void getversion_qmail_qmqpc_c() { - static char *x = "$Id: qmail-qmqpc.c,v 1.27 2024-01-23 01:22:55+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-qmqpc.c,v 1.28 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-qmqpc.c,v $ + * Revision 1.28 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.27 2024-01-23 01:22:55+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/qmail-qmqpd.c b/indimail-mta-x/qmail-qmqpd.c index d6ffedb230..7b30e66af7 100644 --- a/indimail-mta-x/qmail-qmqpd.c +++ b/indimail-mta-x/qmail-qmqpd.c @@ -1,5 +1,8 @@ /* * $Log: qmail-qmqpd.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2024-01-23 01:22:59+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -120,10 +123,7 @@ struct qmail qq; void identify() { - char *remotehost; - char *remoteinfo; - char *remoteip; - char *local; + const char *remotehost, *remoteinfo, *remoteip, *local; if (!(remotehost = env_get("TCPREMOTEHOST"))) remotehost = "unknown"; @@ -168,7 +168,7 @@ int flagok = 1; int main() { - char *result; + const char *result; unsigned long qp; unsigned long len; char ch; @@ -231,7 +231,7 @@ main() void getversion_qmail_qmqpd_c() { - static char *x = "$Id: qmail-qmqpd.c,v 1.14 2024-01-23 01:22:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-qmqpd.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-qmtpd.c b/indimail-mta-x/qmail-qmtpd.c index 1f4fdd700a..134278ce4b 100644 --- a/indimail-mta-x/qmail-qmtpd.c +++ b/indimail-mta-x/qmail-qmtpd.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-qmtpd.c,v 1.19 2024-01-23 01:23:04+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-qmtpd.c,v 1.20 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -87,7 +87,7 @@ getcomma() unsigned int databytes = 0, bytestooverflow = 0; struct qmail qq; char buf[1000], buf2[100]; -char *remotehost, *remoteinfo, *remoteip, *local, *relayclient; +const char *remotehost, *remoteinfo, *remoteip, *local, *relayclient; stralloc failure = { 0 }; int relayclientlen; @@ -97,7 +97,7 @@ main() char ch; unsigned long biglen, len, qp, u; int i, flagdos = 0, flagsenderok, flagbother, hide_host; - char *result, *x; + const char *result, *x; sig_pipeignore(); sig_alarmcatch(resources); @@ -308,13 +308,16 @@ main() void getversion_qmail_qmtpd_c() { - static char *x = "$Id: qmail-qmtpd.c,v 1.19 2024-01-23 01:23:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-qmtpd.c,v 1.20 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-qmtpd.c,v $ + * Revision 1.20 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.19 2024-01-23 01:23:04+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/qmail-qread.c b/indimail-mta-x/qmail-qread.c index 2a8198c4d6..2f93865e54 100644 --- a/indimail-mta-x/qmail-qread.c +++ b/indimail-mta-x/qmail-qread.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-qread.c,v 1.46 2023-02-08 15:10:42+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-qread.c,v 1.47 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -242,7 +242,7 @@ get_arguments(int argc, char **argv) } void -putcounts(char *pre_str, int lCount, int rCount, int bCount, int tCount) +putcounts(const char *pre_str, int lCount, int rCount, int bCount, int tCount) { char foo[FMT_ULONG]; @@ -600,7 +600,7 @@ main(int argc, char **argv) void getversion_qmail_qread_c() { - static char *x = "$Id: qmail-qread.c,v 1.46 2023-02-08 15:10:42+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-qread.c,v 1.47 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -608,6 +608,9 @@ getversion_qmail_qread_c() /* * $Log: qmail-qread.c,v $ + * Revision 1.47 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.46 2023-02-08 15:10:42+05:30 Cprogrammer * auto determine dynamic queue using /dev/shm/qscheduler * diff --git a/indimail-mta-x/qmail-queue.c b/indimail-mta-x/qmail-queue.c index 454e54550d..5950368c2b 100644 --- a/indimail-mta-x/qmail-queue.c +++ b/indimail-mta-x/qmail-queue.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-queue.c,v 1.94 2024-02-05 09:38:54+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-queue.c,v 1.95 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -58,7 +58,8 @@ #define INET_ADDRSTRLEN 16 #endif -static char *tcpremoteip; +typedef const char c_char; +static c_char *tcpremoteip; static char *received; static char *pidfn, *messfn, *todofn, *intdfn; static char *origin; /* "X-Originating-IP: 10.0.0.1\n" */ @@ -112,7 +113,7 @@ cleanup() } no_return void -die(int e, int do_cleanup, char *str) +die(int e, int do_cleanup, const char *str) { if (do_cleanup) cleanup(); @@ -368,7 +369,7 @@ pidfmt(char *s, unsigned long seq) } char * -fnnum(char *dirslash, int flagsplit) +fnnum(const char *dirslash, int flagsplit) { char *s; @@ -399,7 +400,7 @@ pidopen() } #if defined(QHPSI) -char *qhpsi; +const char *qhpsi; /*- * Following added in addition to QHPSI @@ -408,7 +409,7 @@ char *qhpsi; * X-Quarantine-ID: */ void -qhpsiprog(char *program) +qhpsiprog(const char *program) { int wstat, child, rejectvirus = 0, childrc = -1, qhpsirc = 1, qhpsirn = 0; @@ -538,9 +539,10 @@ qhpsiprog(char *program) * *:abc@xyz.com:abc_13@example.com */ int -set_archive(char *eaddr) +set_archive(const char *eaddr) { - char *rule_ptr, *dest, *ptr, *errStr = 0, *addr, *addr_ptr; + char *rule_ptr, *dest, *ptr, *addr_ptr; + const char *addr, *errStr = NULL; int len, at, type, found, negate = 0, use_regex = 0; static stralloc tmpe = {0}; @@ -650,7 +652,7 @@ set_archive(char *eaddr) #ifdef HASLIBRT int -mq_todo(char *queue_ident, unsigned int priority) +mq_todo(const char *queue_ident, unsigned int priority) { mqd_t mqd; q_msg qmsg; @@ -685,7 +687,7 @@ mq_todo(char *queue_ident, unsigned int priority) * use value of env as the value in s. */ void -read_control(stralloc *s, char *env, char *f, int flag) +read_control(stralloc *s, const char *env, const char *f, int flag) { char *ptr; @@ -1191,7 +1193,7 @@ main() void getversion_qmail_queue_c() { - static char *x = "$Id: qmail-queue.c,v 1.94 2024-02-05 09:38:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-queue.c,v 1.95 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; @@ -1199,6 +1201,9 @@ getversion_qmail_queue_c() #endif /* * $Log: qmail-queue.c,v $ + * Revision 1.95 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.94 2024-02-05 09:38:54+05:30 Cprogrammer * fixed date field in Received header * diff --git a/indimail-mta-x/qmail-remote.c b/indimail-mta-x/qmail-remote.c index 194b29df1c..dd6bf65dd1 100644 --- a/indimail-mta-x/qmail-remote.c +++ b/indimail-mta-x/qmail-remote.c @@ -1,6 +1,6 @@ /*- * RCS log at bottom - * $Id: qmail-remote.c,v 1.172 2024-01-24 00:54:08+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-remote.c,v 1.173 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -141,7 +141,7 @@ static char *msgsize, *use_auth_smtp; static char **my_argv; static int my_argc; #ifdef TLS -static char *ssl_err_str = NULL; +static const char *ssl_err_str = NULL; static SSL *ssl; static int notls = 0; static stralloc notlshosts = { 0 } ; @@ -177,7 +177,8 @@ static CONSTMAP mapnosignlocals; #endif #if defined(TLS) && defined(HASTLSA) -static char *do_tlsa = NULL, *tlsadomainsfn = NULL; +static char *do_tlsa = NULL; +static c_char *tlsadomainsfn = NULL; static int use_daned = 0; static tlsarralloc ta = { 0 }; static stralloc hexstring = { 0 }; @@ -204,14 +205,14 @@ typedef enum { void temp_nomem(); void -out(char *s) +out(const char *s) { if (substdio_puts(subfdoutsmall, s) == -1) _exit(0); } void -my_error(char *s1, char *s2, char *s3) +my_error(const char *s1, const char *s2, const char *s3) { if (substdio_puts(subfderr, s1) == -1) _exit(0); @@ -241,7 +242,7 @@ my_error(char *s1, char *s2, char *s3) int run_script(char code, int succ) { - char *prog, *str; + const char *prog, *str; char remote_code[2] = "\0\0"; char **args; int child, wstat, i; @@ -360,7 +361,7 @@ extern void _exit (int __status) __attribute__ ((__noreturn__)); * execute user definded script/executable using run_script() */ no_return void -zerodie(char *s1, int succ) +zerodie(const char *s1, int succ) { #ifdef TLS if (ssl) { @@ -524,7 +525,7 @@ temp_chdir() } no_return void -temp_control(char *arg1, char *arg2) +temp_control(const char *arg1, const char *arg2) { out("Z"); out(arg1); @@ -545,7 +546,7 @@ temp_control(char *arg1, char *arg2) } no_return void -temp_cdb(char *arg) +temp_cdb(const char *arg) { out("Z"); out(arg); @@ -562,7 +563,7 @@ temp_cdb(char *arg) no_return void perm_partialline() { - char *r = "DSMTP cannot transfer messages with partial final lines. (#5.6.2)\n"; + const char *r = "DSMTP cannot transfer messages with partial final lines. (#5.6.2)\n"; out(r); if (!stralloc_copys(&smtptext, r + 1)) @@ -576,7 +577,7 @@ perm_partialline() no_return void perm_usage() { - char *r = "DI (qmail-remote) was invoked improperly. (#5.3.5)\n"; + const char *r = "DI (qmail-remote) was invoked improperly. (#5.3.5)\n"; out(r); if (!stralloc_copys(&smtptext, r + 3)) @@ -590,7 +591,7 @@ perm_usage() no_return void perm_dns() { - char *r = "DSorry, I couldn't find any host named "; + const char *r = "DSorry, I couldn't find any host named "; out(r); outsafe(&host); @@ -607,7 +608,7 @@ perm_dns() no_return void perm_nomx() { - char *r = "DSorry, I couldn't find a mail exchanger or IP address. (#5.4.4)\n"; + const char *r = "DSorry, I couldn't find a mail exchanger or IP address. (#5.4.4)\n"; out(r); if (!stralloc_copys(&smtptext, r + 1)) @@ -621,7 +622,7 @@ perm_nomx() no_return void perm_ambigmx() { - char *r = "DSorry. Although I'm listed as a best-preference MX or A for that host,\nit isn't in my "; + const char *r = "DSorry. Although I'm listed as a best-preference MX or A for that host,\nit isn't in my "; if (!controldir) { if (!(controldir = env_get("CONTROLDIR"))) @@ -721,7 +722,7 @@ dropped() } void -temp_noconn_out(char *s) +temp_noconn_out(const char *s) { out(s); if (!stralloc_cats(&smtptext, smtptext.len ? s : s + 1)) @@ -1010,17 +1011,17 @@ outsmtptext() no_return void #ifdef HAVE_STDARG_H -quit(int code, int die, char *prepend, ...) +quit(int code, int die, const char *prepend, ...) #else quit(va_alist) va_dcl #endif { va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H int code, die; - char *prepend; + const char *prepend; #endif #ifdef HAVE_STDARG_H @@ -1029,7 +1030,7 @@ va_dcl va_start(ap); code = va_arg(ap, int); die = va_arg(ap, int); - prepend = va_arg(ap, char *); + prepend = va_arg(ap, const char *); #endif if (substdio_putflush(&smtpto, "QUIT\r\n", 6) == -1) temp_write(); @@ -1037,7 +1038,7 @@ va_dcl outhost(); while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; out(str); @@ -1228,7 +1229,7 @@ char *partner_fqdn = NULL; #define SSL_ST_BEFORE 0x4000 #endif no_return void -tls_quit(const char *s1, char *s2, char *s3, char *s4, char *s5, stralloc *saptr) +tls_quit(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, stralloc *saptr) { char ch; int i, state; @@ -1465,7 +1466,7 @@ scan_response(stralloc *dst, stralloc *src, const char *search) * reference: https://www.rfc-editor.org/rfc/rfc4954 */ no_return static void -decode_smtpauth_err(int code, char *s1, char *s2) +decode_smtpauth_err(int code, const char *s1, const char *s2) { switch(code) { @@ -1803,7 +1804,7 @@ remove_newline() } static void -gsasl_authenticate(Gsasl_session *session, char *mech) +gsasl_authenticate(Gsasl_session *session, const char *mech) { char *p; int rc, code; @@ -2060,7 +2061,7 @@ smtp_auth(char *type, int use_size) int i = 0, login_supp = 0, plain_supp = 0, cram_md5_supp = 0, cram_sha1_supp = 0, cram_sha224_supp, cram_sha256_supp = 0, cram_sha384_supp, cram_sha512_supp = 0, cram_rmd_supp = 0, digest_md5_supp = 0; - char *ptr, *no_auth_login, *no_auth_plain, *no_cram_md5, *no_cram_sha1, *no_cram_sha224, + const char *ptr, *no_auth_login, *no_auth_plain, *no_cram_md5, *no_cram_sha1, *no_cram_sha224, *no_cram_sha256, *no_cram_sha384, *no_cram_sha512, *no_cram_ripemd, *no_digest_md5; #ifdef TLS int secure_auth; @@ -2786,7 +2787,7 @@ prep_reciplist(saa *list,char **recips,int flagcname,int flagquote) #if defined(TLS) && defined(HASTLSA) static int -dmatch(char *fn, stralloc *domain, stralloc *content, +dmatch(const char *fn, stralloc *domain, stralloc *content, CONSTMAP *ptrmap) { int x, len; @@ -2847,7 +2848,8 @@ void getcontrols() { int r; - char *senderdomain, *ip, *x; + char *senderdomain; + const char *ip, *x; static stralloc outgoingipfn; if (control_init() == -1) @@ -3041,7 +3043,7 @@ getcontrols() static stralloc newsender = { 0 }; #if OPENSSL_VERSION_NUMBER >= 0x30000000L no_return void -temp_batv(char *arg) +temp_batv(const char *arg) { out("Zerror creating batv signature. (#4.3.0)\n"); if (!stralloc_copys(&smtptext, arg) || @@ -3062,7 +3064,7 @@ sign_batv() static char hex[] = "0123456789abcdef"; #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_MD_CTX *mdctx; - const EVP_MD *md = NULL; + EVP_MD *md = NULL; unsigned char md5digest[EVP_MAX_MD_SIZE]; unsigned int md_len; #else @@ -3127,7 +3129,7 @@ sign_batv() * http://www.apecity.com/qmail/moresmtproutes.txt */ char * -moresmtproutes_lookup(char *hst, int len) +moresmtproutes_lookup(const char *hst, int len) { static stralloc morerelayhost = { 0 }; static stralloc h = { 0 }; @@ -3183,7 +3185,7 @@ timeoutconn46(int fd, struct ip_mx *ix, union v46addr *ip, int port_num, int tmo } void -password_lookup(char *addr, int addr_len) +password_lookup(const char *addr, int addr_len) { int i, j; char *result, *ptr; @@ -3233,7 +3235,8 @@ char * get_relayhost(char **recips) { int i, j, k, cntrl_stat1, cntrl_stat2; - char *relayhost, *x, *routes, *smtproutefile, + char *relayhost; + const char *x, *routes, *smtproutefile, *moresmtproutefile, *qmtproutefile; static stralloc controlfile; @@ -3307,11 +3310,11 @@ get_relayhost(char **recips) if (smtp_sender.len == 0) { /*- bounce routes */ if (!stralloc_copys(&bounce, "!@")) temp_nomem(); - if ((relayhost = constmap(&mapqmtproutes, bounce.s, bounce.len))) { + if ((relayhost = (char *) constmap(&mapqmtproutes, bounce.s, bounce.len))) { protocol_t = 'q'; port = PORT_QMTP; } else { - if (!(relayhost = constmap(&mapsmtproutes, bounce.s, bounce.len))) + if (!(relayhost = (char *) constmap(&mapsmtproutes, bounce.s, bounce.len))) relayhost = moresmtproutes_lookup("!@", 2); if (relayhost) { protocol_t = 's'; @@ -3326,21 +3329,21 @@ get_relayhost(char **recips) for (i = 0; !relayhost && i <= host.len; ++i) { if ((i == 0) || (i == host.len) || (host.s[i] == '.')) { /*- default qmtproutes */ - if (cntrl_stat2 == 2 && (relayhost = constmap(&mapqmtproutes, host.s + i, host.len - i))) { + if (cntrl_stat2 == 2 && (relayhost = (char *) constmap(&mapqmtproutes, host.s + i, host.len - i))) { protocol_t = 'q'; port = PORT_QMTP; break; } else - if (cntrl_stat1 == 2 && (relayhost = constmap(&mapsmtproutes, host.s + i, host.len - i))) { + if (cntrl_stat1 == 2 && (relayhost = (char *) constmap(&mapsmtproutes, host.s + i, host.len - i))) { port = PORT_SMTP; break; } else - if (cntrl_stat2 && (relayhost = constmap(&mapqmtproutes, host.s + i, host.len - i))) { + if (cntrl_stat2 && (relayhost = (char *) constmap(&mapqmtproutes, host.s + i, host.len - i))) { protocol_t = 'q'; port = PORT_QMTP; break; } else - if (cntrl_stat1 && (relayhost = constmap(&mapsmtproutes, host.s + i, host.len - i))) { + if (cntrl_stat1 && (relayhost = (char *) constmap(&mapsmtproutes, host.s + i, host.len - i))) { port = PORT_SMTP; break; } else @@ -3738,13 +3741,16 @@ main(int argc, char **argv) void getversion_qmail_remote_c() { - static char *x = "$Id: qmail-remote.c,v 1.172 2024-01-24 00:54:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-remote.c,v 1.173 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidqrdigestmd5h; x++; } /* * $Log: qmail-remote.c,v $ + * Revision 1.173 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.172 2024-01-24 00:54:08+05:30 Cprogrammer * added comment on avoiding buffer to buffer copy * diff --git a/indimail-mta-x/qmail-rm.c b/indimail-mta-x/qmail-rm.c index 328263de43..cd3927a52a 100644 --- a/indimail-mta-x/qmail-rm.c +++ b/indimail-mta-x/qmail-rm.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-rm.c,v 1.26 2024-02-12 20:57:47+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-rm.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * COPYRIGHT INFORMATION - DO NOT REMOVE * @@ -156,8 +156,8 @@ char *read_file(const char *); int find_files(char *, char *[], const char *); unsigned long digits(unsigned long); char *mk_nohashpath(char *, int); -char *mk_hashpath(char *, int); -char *mk_newpath(char *, int); +char *mk_hashpath(const char *, int); +char *mk_newpath(const char *, int); #ifdef HASRENAMEAT int renameat(int, const char *, int, const char *); #else @@ -165,12 +165,13 @@ int rename(const char *, const char *); #endif char *strptime(const char *s, const char *format, struct tm *tm); +typedef const char c_char; /*- globals */ extern const char *__progname; static const char *default_pattern = ".*"; static unsigned long read_bytes = 0; static int regex_flags = 0, verbosity = 0, conf_split, remove_files = 0, delete_files = 0; -static char *yank_dir = "trash"; +static c_char *yank_dir = "trash"; /*- if the eXpire option is specified on the command line, this will reflect that */ static int expire_files = 0; @@ -842,7 +843,7 @@ mk_nohashpath(char *queue, int inode_name) } char * -mk_hashpath(char *queue, int inode_name) +mk_hashpath(const char *queue, int inode_name) { int len = 0, hash_num = 0; char *old_name = NULL; @@ -871,7 +872,7 @@ mk_hashpath(char *queue, int inode_name) } char * -mk_newpath(char *subdir, int inode_name) +mk_newpath(const char *subdir, int inode_name) { int len = 0; char *new_name = NULL; @@ -1025,13 +1026,16 @@ digits(unsigned long num) void getversion_qmail_rm_c() { - static char *x = "$Id: qmail-rm.c,v 1.26 2024-02-12 20:57:47+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-rm.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-rm.c,v $ + * Revision 1.27 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.26 2024-02-12 20:57:47+05:30 Cprogrammer * use unlinkat() if available instead of unlink() * use renameat() if available instead of rename() diff --git a/indimail-mta-x/qmail-rspawn.c b/indimail-mta-x/qmail-rspawn.c index c5801f41e6..717bd9d78b 100644 --- a/indimail-mta-x/qmail-rspawn.c +++ b/indimail-mta-x/qmail-rspawn.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-rspawn.c,v 1.44 2022-03-05 13:34:54+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-rspawn.c,v 1.45 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -149,7 +149,7 @@ SPAWN(int fdmess, int fdout, unsigned long msgsize, char *s, char *qqeh, char *r #endif size_buf[fmt_ulong(size_buf, msgsize)] = 0; - args[0] = "qmail-remote"; + args[0] = (char *) "qmail-remote"; args[1] = r + at + 1; /*- domain */ args[2] = s; /*- sender */ args[3] = qqeh; /*- qqeh */ @@ -251,7 +251,7 @@ SPAWN(int fdmess, int fdout, unsigned long msgsize, char *s, char *qqeh, char *r void getversion_qmail_rspawn_c() { - static char *x = "$Id: qmail-rspawn.c,v 1.44 2022-03-05 13:34:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-rspawn.c,v 1.45 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -259,6 +259,9 @@ getversion_qmail_rspawn_c() /* * $Log: qmail-rspawn.c,v $ + * Revision 1.45 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.44 2022-03-05 13:34:54+05:30 Cprogrammer * use auto_prefix/sbin for qmail-remote path * diff --git a/indimail-mta-x/qmail-send.c b/indimail-mta-x/qmail-send.c index 0ecba3960b..fa945cf898 100644 --- a/indimail-mta-x/qmail-send.c +++ b/indimail-mta-x/qmail-send.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-send.c,v 1.115 2024-02-08 20:48:32+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-send.c,v 1.116 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -67,6 +67,7 @@ #define SLEEP_CLEANUP 76431 /*- time between cleanups */ #define SLEEP_SYSFAIL 123 +typedef const char c_char; static int lifetime = 604800; static int bouncemaxbytes = 50000; #ifdef BOUNCELIFETIME @@ -98,23 +99,23 @@ static char strnum2[FMT_ULONG]; static char *qident; #define CHANNELS 2 -static char *chanaddr[CHANNELS] = { "local/", "remote/" }; -static char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; -static char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanaddr[CHANNELS] = { "local/", "remote/" }; +static c_char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; +static c_char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries temporarily held\n", "remote deliveries temporarily held\n" }; -static char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries resumed\n", "remote deliveries resumed\n" }; -static char *tochan[CHANNELS] = { " to local ", " to remote " }; +static c_char *tochan[CHANNELS] = { " to local ", " to remote " }; static int chanfdout[CHANNELS] = { 1, 3 }; static int chanfdin[CHANNELS] = { 2, 4 }; static int chanskip[CHANNELS] = { 10, 20 }; -char *queuedesc; -static char *argv0 = "qmail-send"; +const char *queuedesc; +static c_char *argv0 = "qmail-send"; extern dtype delivery; static int do_ratelimit; @@ -809,11 +810,11 @@ job_close(int j) /*- this file is too long ------------------------------------------- BOUNCES */ /*- strip the virtual domain which is prepended to addresses e.g. xxx.com-user01@xxx.com */ -static char * +static const char * stripvdomprepend(char *recip) { unsigned int i, domainlen; - char *domain, *prepend; + const char *domain, *prepend; i = str_rchr(recip, '@'); if (!recip[i]) @@ -894,8 +895,9 @@ addbounce(unsigned long id, char *recip, char *report) } static int -bounce_processor(struct qmail *qq, char *messfn, char *bouncefn, char *bounce_report, char *origrecip, char *sender, - char *recipient) +bounce_processor(struct qmail *qq, const char *messfn, const char *bouncefn, + const char *bounce_report, const char *origrecip, const char *sender, + const char *recipient) { char *prog, *(args[8]); int i, child, wstat; @@ -911,12 +913,12 @@ bounce_processor(struct qmail *qq, char *messfn, char *bouncefn, char *bounce_re return (111); case 0: args[0] = prog; - args[1] = messfn; /*- message filename */ - args[2] = bouncefn; /*- bounce message filename */ - args[3] = bounce_report; /*- bounce report */ - args[4] = sender; /*- bounce sender */ - args[5] = origrecip; /*- original recipient */ - args[6] = recipient; /*- original sender */ + args[1] = (char *) messfn; /*- message filename */ + args[2] = (char *) bouncefn; /*- bounce message filename */ + args[3] = (char *) bounce_report; /*- bounce report */ + args[4] = (char *) sender; /*- bounce sender */ + args[5] = (char *) origrecip; /*- original recipient */ + args[6] = (char *) recipient; /*- original sender */ args[7] = 0; execv(*args, args); slog(1, "alert: ", argv0, ": ", queuedesc, ": Unable to run: ", prog, ": ", error_str(errno), "\n", NULL); @@ -947,7 +949,8 @@ injectbounce(unsigned long id) datetime_sec birth; substdio ssread; char buf[128], inbuf[128]; - char *bouncesender, *bouncerecip = "", *brep = "?", *p; + const char *bouncesender, *bouncerecip = ""; + char *brep = (char *) "?", *p; int r = -1, fd, ret; unsigned long qp; #ifdef MIME @@ -2317,7 +2320,8 @@ run_plugin() void *handle; int i, status = 0, len; int (*func) (void); - char *error, *start_plugin, *plugin_symb, *plugindir, *ptr, *plugin_ptr, *end; + char *ptr, *plugin_ptr; + const char *error, *start_plugin, *plugin_symb, *plugindir, *end; if (!(plugindir = env_get("PLUGINDIR"))) plugindir = "plugins"; @@ -2394,7 +2398,7 @@ run_plugin() #ifdef HASLIBRT void -shm_init(char *shm_name) +shm_init(const char *shm_name) { int q[5]; @@ -2717,7 +2721,7 @@ main(int argc, char **argv) void getversion_qmail_send_c() { - static char *x = "$Id: qmail-send.c,v 1.115 2024-02-08 20:48:32+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-send.c,v 1.116 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsiddelivery_rateh; x = sccsidgetdomainth; @@ -2727,6 +2731,9 @@ getversion_qmail_send_c() /* * $Log: qmail-send.c,v $ + * Revision 1.116 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.115 2024-02-08 20:48:32+05:30 Cprogrammer * fixed multiplication result converted to larger type (codeql) * diff --git a/indimail-mta-x/qmail-showctl.c b/indimail-mta-x/qmail-showctl.c index 3149c4ff68..e2b0b7aa40 100644 --- a/indimail-mta-x/qmail-showctl.c +++ b/indimail-mta-x/qmail-showctl.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-showctl.c,v 1.18 2024-02-20 23:23:18+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-showctl.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -75,7 +75,7 @@ safeput(char *buf, unsigned int len) } void -do_int(char *fn, char *def, char *pre, char *post) +do_int(const char *fn, const char *def, const char *pre, const char *post) { int i; @@ -96,7 +96,7 @@ do_int(char *fn, char *def, char *pre, char *post) } void -do_str(char *fn, int flagme, char *def, char *pre) +do_str(const char *fn, int flagme, const char *def, const char *pre) { int i = 0; @@ -123,7 +123,7 @@ do_str(char *fn, int flagme, char *def, char *pre) } int -do_lst(char *fn, char *def, char *pre, char *post) +do_lst(const char *fn, const char *def, const char *pre, const char *post) { int i, j; @@ -164,7 +164,7 @@ print_concurrency() } no_return void -die_chdir(char *dir) +die_chdir(const char *dir) { substdio_puts(subfdout, "Oops! Unable to chdir to "); substdio_puts(subfdout, dir); @@ -176,7 +176,7 @@ die_chdir(char *dir) void display_control() { - char *ptr, *local_ip, *qbase, *local_id, *errstr; + const char *ptr, *local_ip, *qbase, *local_id, *errstr; void *handle = (void *) 0; struct stat stmrh, stmrhcdb; int i, load_indimail = 0; @@ -383,14 +383,14 @@ display_control() } int -valid_control_files(char *fn) +valid_control_files(const char *fn) { int len, fd, match; struct substdio ssin; char inbuf[2048]; - char **ptr; - char *control_fn_list[] = {"controlfiles.q", "controlfiles.i", 0}; - char *control_files[] = { + const char **ptr; + const char *control_fn_list[] = {"controlfiles.q", "controlfiles.i", 0}; + const char *control_files[] = { "bouncefrom", "bouncehost", "bouncesubject", "bouncemaxbytes", "bouncemessage", "doublebouncesubject", "doublebouncemessage", "badhost", "badmailpatterns", "badrcptpatterns", "spamignorepatterns", "filterargs", "spamfilter", "bouncefrom", @@ -428,7 +428,7 @@ valid_control_files(char *fn) #endif "conf-syncdir", "conf-fsync", "conf-fdatasync", "servicedir.conf", "level2-tlds", "level3-tlds", "libmysql", 0}; - char *cdb_sql_files[] = { + const char *cdb_sql_files[] = { "authdomains", "badhelo", "badext", "badmailfrom", "badrcptto", "blackholedsender", "blackholedrcpt", "chkrcptdomains", "goodrcptto", "relaymailfrom", "spamignore", "greylist.white", "tlsa.white", "tlsadomains", "badip", 0}; @@ -481,7 +481,7 @@ valid_control_files(char *fn) } void -show_internals(char *home) +show_internals(const char *home) { substdio_puts(subfdout, "indimail-mta home dir: "); substdio_puts(subfdout, auto_qmail); @@ -637,11 +637,11 @@ stralloc qdir = { 0 }; void show_queues() { - char *qbase; + const char *qbase; int save, i, j, k, l, bigtodo; char strnum[FMT_ULONG]; - char **ptr; - char *extra_queue[] = {"slowq", "nqueue", "qmta", 0}; + const char **ptr; + const char *extra_queue[] = {"slowq", "nqueue", "qmta", 0}; getEnvConfigInt(&bigtodo, "BIGTODO", 1); getEnvConfigInt(&conf_split, "CONFSPLIT", auto_split); @@ -764,11 +764,11 @@ int main(int argc, char **argv) { DIR *dir; - char *ptr; + const char *ptr; int opt, do_control = 0, do_internals = 0, do_concurrency = 0, do_queue = 0, do_errors = 0, do_env = 0, do_version = 0, qstat; pid_t pid; - char *svctool[] = { "svctool", "--dumpconfig", 0}; + const char *svctool[] = { "svctool", "--dumpconfig", 0}; stralloc bin = {0}; while ((opt = getopt(argc, argv, "acCiqeEsv")) != opteof) { @@ -803,7 +803,7 @@ main(int argc, char **argv) !stralloc_catb(&bin, "/sbin/svctool", 13) || !stralloc_0(&bin)) strerr_die2x(111, FATAL, "out of memory"); - execv(bin.s, svctool); /*- run svctool */ + execv(bin.s, (char **) svctool); /*- run svctool */ strerr_die4sys(111, FATAL, "execv: ", *svctool, ": "); break; default: @@ -901,7 +901,7 @@ main(int argc, char **argv) void getversion_qmail_showctl_c() { - static char *x = "$Id: qmail-showctl.c,v 1.18 2024-02-20 23:23:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-showctl.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -909,6 +909,9 @@ getversion_qmail_showctl_c() /* * $Log: qmail-showctl.c,v $ + * Revision 1.19 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.18 2024-02-20 23:23:18+05:30 Cprogrammer * added code to show version information * diff --git a/indimail-mta-x/qmail-smtpd.c b/indimail-mta-x/qmail-smtpd.c index 05c7acc570..ce30e42eee 100644 --- a/indimail-mta-x/qmail-smtpd.c +++ b/indimail-mta-x/qmail-smtpd.c @@ -1,5 +1,8 @@ /* * $Log: qmail-smtpd.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2023-10-11 14:51:10+05:30 Cprogrammer * added HIDE_HOST environment variable * @@ -63,23 +66,23 @@ void qmail_smtpd(int, char **, char **); void out(char *); void flush(); -char *getversion_smtpd_c(); +const char *getversion_smtpd_c(); no_return void print_details() { - char *ptr; - char **p; + const char *ptr; + const char **p; char revision[28]; int i; - char *auth_methods[] = { + const char *auth_methods[] = { "login", "plain", "cram-md5", "cram-sha1", "cram-sha224", "cram-sha256", "cram-sha384", "cram-sha512", "cram-ripemd", "digest-md5", "scram-sha-1", #ifdef HASLIBGSASL "scram-sha-256", "scram-sha-1-plus", "scram-sha-256-plus", #endif 0}; - char *control_files[] = { + const char *control_files[] = { "badhost", "badmailpatterns", "badrcptpatterns", "spamignore", "spamignorepatterns", "tlsclients", "tlsservermethod", "domainqueue", "from.envrules", "rcpt.envrules", "databytes", "maxhops", "dnsbllist", "envnoathost", "helohost", "greetdelay", @@ -100,11 +103,11 @@ print_details() "srs_alwaysrewrite", "srs_separator", #endif "servercert.pem", "tlsserverciphers", "libmysql", 0}; - char *cdb_sql_files[] = { + const char *cdb_sql_files[] = { "authdomains", "badhelo", "badext", "badmailfrom", "badrcptto", "blackholedsender", "blackholedrcpt", "chkrcptdomains", "goodrcptto", "relaymailfrom", "spamignore", "greylist.white", "tlsa.white", "tlsadomains", "badip", 0}; - char *read_env_vars[] = { + const char *read_env_vars[] = { "ANTISPOOFING", "AUTH_ALL", "AUTHRULES", "BADHELO", "BADHELOCHECK", "BADHOST", "BADHOSTCHECK", "BADIP", "BADIPCHECK", #ifdef USE_SPF @@ -132,7 +135,7 @@ print_details() #endif "STARTTLS", "TARPITCOUNT", "TARPITDELAY", "GREETDELAY", "TLS_CIPHER_LIST", "TLS_CIPHER_SUITE", "TMPDIR", "VIRTUAL_PKG_LIB", "VIRUSCHECK", 0}; - char *write_env_vars[] = { + const char *write_env_vars[] = { "AUTHENTICATED", "AUTHINFO", "NULLQUEUE", #ifdef USE_SPF "SPFRESULT", @@ -275,7 +278,7 @@ main(int argc, char **argv) void getversion_qmail_smtpd_c() { - static char *x = "$Id: qmail-smtpd.c,v 1.14 2023-10-11 14:51:10+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-smtpd.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-spamfilter.c b/indimail-mta-x/qmail-spamfilter.c index 69c5a037c0..7aa61a0657 100644 --- a/indimail-mta-x/qmail-spamfilter.c +++ b/indimail-mta-x/qmail-spamfilter.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-spamfilter.c,v 1.10 2024-01-07 01:44:35+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-spamfilter.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -43,7 +43,7 @@ main(int argc, char **argv) struct substdio ssin, ssout; stralloc spamfilterargs = { 0 }, q = { 0 }; char inbuf[2048], outbuf[2048]; - char *ptr, *spamf; + const char *ptr, *spamf; char **Argv; if (chdir("/") == -1) @@ -235,9 +235,8 @@ main(int argc, char **argv) void getversion_qmail_spamfilter_c() { - static char *x = "$Id: qmail-spamfilter.c,v 1.10 2024-01-07 01:44:35+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-spamfilter.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidqmultih; x = sccsidmakeargsh; x = sccsidmktempfileh; x++; @@ -246,6 +245,9 @@ getversion_qmail_spamfilter_c() /* * $Log: qmail-spamfilter.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2024-01-07 01:44:35+05:30 Cprogrammer * bypass antispam filter when RELAYCLIENT and RELAYCLIENT_NOSPAMFILTER is set * diff --git a/indimail-mta-x/qmail-sql.c b/indimail-mta-x/qmail-sql.c index c371d0d356..37085bc6d6 100644 --- a/indimail-mta-x/qmail-sql.c +++ b/indimail-mta-x/qmail-sql.c @@ -1,5 +1,8 @@ /* * $Log: qmail-sql.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-02-14 09:16:35+05:30 Cprogrammer * renamed auto_uidv, auto_gidv to auto_uidi, auto_gidi * @@ -61,7 +64,7 @@ #define FATAL "qmail-sql: fatal: " void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -79,7 +82,7 @@ flush() } int -insert_db(MYSQL *conn, char *fn, char *table_name, int replace, char **errStr) +insert_db(MYSQL *conn, const char *fn, const char *table_name, int replace, const char *errStr[]) { int num = 0, m_error; @@ -140,7 +143,7 @@ insert_db(MYSQL *conn, char *fn, char *table_name, int replace, char **errStr) return (num); } -char *usage = +const char *usage = "usage: qmail-sql [-Sr] [-s mysql_host -u user -p password -d database -t table_name] filename\n" " -S (skip)\n" " -r (replace table)"; @@ -149,7 +152,8 @@ int main(int argc, char **argv) { int fd, opt, skip_load = 0, replace = 0; - char *dbserver, *user, *pass, *dbname, *table_name, *tname, *errStr; + char *tname; + const char *dbserver, *user, *pass, *dbname, *table_name, *errStr; stralloc fn = {0}, str = {0}; struct stat statbuf; MYSQL *conn; @@ -275,7 +279,7 @@ main(int argc, char **argv) void getversion_qmail_sql_c() { - static char *x = "$Id: qmail-sql.c,v 1.11 2023-02-14 09:16:35+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-sql.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-start.c b/indimail-mta-x/qmail-start.c index a0f10442cc..61de2ec930 100644 --- a/indimail-mta-x/qmail-start.c +++ b/indimail-mta-x/qmail-start.c @@ -1,5 +1,5 @@ /* - * $Id: qmail-start.c,v 1.28 2023-12-23 23:29:04+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail-start.c,v 1.29 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * RCS log at bottom */ #include @@ -20,7 +20,7 @@ #include "setuserid.h" no_return void -die(char *arg) +die(const char *arg) { strerr_die3sys(111, "fatal: qmail-start: ", arg, ": "); _exit(111); @@ -34,7 +34,7 @@ die(char *arg) * return 0 if user is not present in the list */ int -check_user(char *userlist, char *user) +check_user(char *userlist, const char *user) { char *ptr1, *ptr2; @@ -113,11 +113,11 @@ int main(int argc, char **argv) { char *set_supplementary_groups, *ptr; - char *(qsargs[]) = { "qmail-send", 0, (char *) NULL, (char *) NULL}; - char *(qcargs[]) = { "qmail-clean", 0, 0, (char *) NULL}; - char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0, (char *) NULL}; - char *(qrargs[]) = { "qmail-rspawn", 0, (char *) NULL}; - char *(qtargs[]) = { "todo-proc", 0, 0, 0, (char *) NULL}; + const char *(qsargs[]) = { "qmail-send", 0, (char *) NULL, (char *) NULL}; + const char *(qcargs[]) = { "qmail-clean", 0, 0, (char *) NULL}; + const char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0, (char *) NULL}; + const char *(qrargs[]) = { "qmail-rspawn", 0, (char *) NULL}; + const char *(qtargs[]) = { "todo-proc", 0, 0, 0, (char *) NULL}; gid_t *gidset; int ngroups, i = 1, j = 1; int opt; @@ -239,7 +239,7 @@ main(int argc, char **argv) die("unable to copy fd1 to pipe2"); close2345678(); closepipes(); - execvp(*qlargs, qlargs); /*- qmail-lspawn */ + execvp(*qlargs, (char **) qlargs); /*- qmail-lspawn */ die("unable to exec qmail-lspawn"); } switch (fork()) /*- qmail-rspawn */ @@ -264,7 +264,7 @@ main(int argc, char **argv) die("unable to copy fd1 to pipe4"); close2345678(); closepipes(); - execvp(*qrargs, qrargs); /*- qmail-rspawn */ + execvp(*qrargs, (char **) qrargs); /*- qmail-rspawn */ die("unable to exec qmail-rspawn"); } switch (fork()) /*- qmail-clean for qmail-send */ @@ -290,7 +290,7 @@ main(int argc, char **argv) close2345678(); closepipes(); qcargs[2] = "qmail-send"; /*- pass qmail-send as argument for the ps command */ - execvp(*qcargs, qcargs); /*- qmail-clean */ + execvp(*qcargs, (char **) qcargs); /*- qmail-clean */ die("unable to exec qmail-clean (qmail-send)"); } switch (fork()) /*- todo-proc */ @@ -310,7 +310,7 @@ main(int argc, char **argv) if (fd_copy(3, pi10[0]) == -1) die("unable to copy fd3 to pipe10"); closepipes(); - execvp(*qtargs, qtargs); /*- todo-proc */ + execvp(*qtargs, (char **) qtargs); /*- todo-proc */ die("unable to exec todo-proc"); } @@ -337,7 +337,7 @@ main(int argc, char **argv) close2345678(); closepipes(); qcargs[2] = "todo-proc"; /*- pass todo-proc as argument for the ps command */ - execvp(*qcargs, qcargs); /*- qmail-clean */ + execvp(*qcargs, (char **) qcargs); /*- qmail-clean */ die("unable to exec qmail-clean (todo-proc)"); } if (check_user(set_supplementary_groups, "qmails")) { @@ -370,7 +370,7 @@ main(int argc, char **argv) if (fd_copy(8, pi8[0]) == -1) die("unable to copy fd8 to pipe8"); closepipes(); - execvp(*qsargs, qsargs); /*- qmail-send */ + execvp(*qsargs, (char **) qsargs); /*- qmail-send */ die("unable to exec qmail-send"); /*- Not reached */ return(0); @@ -379,13 +379,16 @@ main(int argc, char **argv) void getversion_qmail_start_c() { - static char *x = "$Id: qmail-start.c,v 1.28 2023-12-23 23:29:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-start.c,v 1.29 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qmail-start.c,v $ + * Revision 1.29 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.28 2023-12-23 23:29:04+05:30 Cprogrammer * updated comments * diff --git a/indimail-mta-x/qmail-tcpok.c b/indimail-mta-x/qmail-tcpok.c index f0b5139317..95b8f4d183 100644 --- a/indimail-mta-x/qmail-tcpok.c +++ b/indimail-mta-x/qmail-tcpok.c @@ -93,6 +93,9 @@ main(int argc, char **argv) /* * $Log: qmail-tcpok.c,v $ + * Revision 1.29 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.28 2021-06-28 17:07:29+05:30 Cprogrammer * use process_queue to process all queues * @@ -173,7 +176,7 @@ main(int argc, char **argv) void getversion_qmail_tcpok_c() { - static char *x = "$Id: qmail-tcpok.c,v 1.28 2021-06-28 17:07:29+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-tcpok.c,v 1.29 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail-tcpto.c b/indimail-mta-x/qmail-tcpto.c index 6e4919f3f9..fdca2b15c5 100644 --- a/indimail-mta-x/qmail-tcpto.c +++ b/indimail-mta-x/qmail-tcpto.c @@ -156,6 +156,9 @@ main(int argc, char **argv) /* * $Log: qmail-tcpto.c,v $ + * Revision 1.28 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.27 2021-06-28 17:07:25+05:30 Cprogrammer * use process_queue to process all queues * @@ -235,7 +238,7 @@ main(int argc, char **argv) void getversion_qmail_tcpto_c() { - static char *x = "$Id: qmail-tcpto.c,v 1.27 2021-06-28 17:07:25+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail-tcpto.c,v 1.28 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmail.c b/indimail-mta-x/qmail.c index d6656caa8c..f902e6edc5 100644 --- a/indimail-mta-x/qmail.c +++ b/indimail-mta-x/qmail.c @@ -1,5 +1,5 @@ /* - * $Id: qmail.c,v 1.37 2023-11-05 05:13:56+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail.c,v 1.38 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -137,7 +137,7 @@ qmail_fail(struct qmail *qq) } void -qmail_put(struct qmail *qq, char *s, unsigned int len) +qmail_put(struct qmail *qq, const char *s, unsigned int len) { if (!qq->flagerr) { if (substdio_put(&qq->ss, s, len) == -1) @@ -146,7 +146,7 @@ qmail_put(struct qmail *qq, char *s, unsigned int len) } void -qmail_puts(struct qmail *qq, char *s) +qmail_puts(struct qmail *qq, const char *s) { if (!qq->flagerr) { if (substdio_puts(&qq->ss, s) == -1) @@ -155,7 +155,7 @@ qmail_puts(struct qmail *qq, char *s) } void -qmail_from(struct qmail *qq, char *s) +qmail_from(struct qmail *qq, const char *s) { if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1; @@ -167,14 +167,14 @@ qmail_from(struct qmail *qq, char *s) } void -qmail_to(struct qmail *qq, char *s) +qmail_to(struct qmail *qq, const char *s) { qmail_put(qq, "T", 1); qmail_puts(qq, s); qmail_put(qq, "", 1); } -char * +const char * qmail_close(struct qmail *qq) { int wstat, exitcode, len = 0; @@ -312,7 +312,7 @@ qmail_close(struct qmail *qq) void getversion_qmail_c() { - static char *x = "$Id: qmail.c,v 1.37 2023-11-05 05:13:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmail.c,v 1.38 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; @@ -320,6 +320,9 @@ getversion_qmail_c() /* * $Log: qmail.c,v $ + * Revision 1.38 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.37 2023-11-05 05:13:56+05:30 Cprogrammer * fixed NULLQEUEUE * diff --git a/indimail-mta-x/qmail.h b/indimail-mta-x/qmail.h index 345b5d403c..1e88bdfa96 100644 --- a/indimail-mta-x/qmail.h +++ b/indimail-mta-x/qmail.h @@ -1,5 +1,5 @@ /* - * $Id: qmail.h,v 1.12 2024-01-23 01:22:42+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmail.h,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef QMAIL_H #define QMAIL_H @@ -26,12 +26,12 @@ struct qmail }; int qmail_open(struct qmail *); -void qmail_put(struct qmail *, char *, unsigned int); -void qmail_puts(struct qmail *, char *); -void qmail_from(struct qmail *, char *); -void qmail_to(struct qmail *, char *); +void qmail_put(struct qmail *, const char *, unsigned int); +void qmail_puts(struct qmail *, const char *); +void qmail_from(struct qmail *, const char *); +void qmail_to(struct qmail *, const char *); void qmail_fail(struct qmail *); -char *qmail_close(struct qmail *); +const char *qmail_close(struct qmail *); unsigned long qmail_qp(struct qmail *); #define QQ_OK 0 @@ -101,6 +101,9 @@ unsigned long qmail_qp(struct qmail *); /* * $Log: qmail.h,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2024-01-23 01:22:42+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/qmaildirmake.c b/indimail-mta-x/qmaildirmake.c index 594fe4d9b2..2f1754af3b 100644 --- a/indimail-mta-x/qmaildirmake.c +++ b/indimail-mta-x/qmaildirmake.c @@ -1,5 +1,8 @@ /* * $Log: qmaildirmake.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2020-11-24 13:46:47+05:30 Cprogrammer * removed exit.h * @@ -62,7 +65,7 @@ main(argc, argv) void getversion_maildirmake_c() { - static char *x = "$Id: qmaildirmake.c,v 1.7 2020-11-24 13:46:47+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmaildirmake.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmaildirwatch.c b/indimail-mta-x/qmaildirwatch.c index a195d39699..b9867dcdd8 100644 --- a/indimail-mta-x/qmaildirwatch.c +++ b/indimail-mta-x/qmaildirwatch.c @@ -1,5 +1,8 @@ /* * $Log: qmaildirwatch.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -166,7 +169,7 @@ main() void getversion_qmaildirwatch_c() { - static char *x = "$Id: qmaildirwatch.c,v 1.9 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmaildirwatch.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qmonitor.c b/indimail-mta-x/qmonitor.c index 74039c8cf5..e134ca0fb9 100644 --- a/indimail-mta-x/qmonitor.c +++ b/indimail-mta-x/qmonitor.c @@ -1,5 +1,5 @@ /* - * $Id: qmonitor.c,v 1.5 2023-01-18 00:02:13+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmonitor.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "haslibrt.h" #ifdef HASLIBRT @@ -19,7 +19,7 @@ #define FATAL "qmonitor: fatal: " #define WARN "qmonitor: warn: " -char *usage = +const char *usage = "usage: qmonitor [-t threshold ] [-i interval] [-n]\n" " -t threshold (load threshold)\n" " -i interval"; @@ -91,13 +91,16 @@ main(argc, argv) void getversion_qmonitor_c() { - static char *x = "$Id: qmonitor.c,v 1.5 2023-01-18 00:02:13+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmonitor.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /*- * $Log: qmonitor.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-01-18 00:02:13+05:30 Cprogrammer * replaced qprintf with subprintf * diff --git a/indimail-mta-x/qmta-send.c b/indimail-mta-x/qmta-send.c index d2e87435b2..34aeb4fe5b 100644 --- a/indimail-mta-x/qmta-send.c +++ b/indimail-mta-x/qmta-send.c @@ -1,5 +1,5 @@ /* - * $Id: qmta-send.c,v 1.31 2024-02-08 20:47:48+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmta-send.c,v 1.32 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -65,8 +65,9 @@ int qmail_lspawn(int, char **); int qmail_rspawn(int, char **); -char *queuedesc = "qmta"; -static char *argv0 = "qmta-send"; +typedef const char c_char; +const char *queuedesc = "qmta"; +static c_char *argv0 = "qmta-send"; static int lifetime = 604800; static int flagexitasap = 0, flagrunasap = 1, flagreadasap = 0; static int _qmail_clean, _qmail_lspawn, _qmail_rspawn;; @@ -96,17 +97,17 @@ datetime_sec recent; static int chanfdout[CHANNELS]; static int chanfdin[CHANNELS]; static int chanskip[CHANNELS] = { 10, 20 }; -static char *chanaddr[CHANNELS] = { "local/", "remote/" }; -static char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; -static char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanaddr[CHANNELS] = { "local/", "remote/" }; +static c_char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; +static c_char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries temporarily held\n", "remote deliveries temporarily held\n" }; -static char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries resumed\n", "remote deliveries resumed\n" }; -static char *tochan[CHANNELS] = { " to local ", " to remote " }; +static c_char *tochan[CHANNELS] = { " to local ", " to remote " }; static prioq pqdone = { 0 }; /*- -todo +info; HOPEFULLY -local -remote */ static prioq pqchan[CHANNELS] = { {0} , {0} }; /*- pqchan 0: -todo +info +local ?remote */ /*- pqchan 1: -todo +info ?local +remote */ @@ -131,10 +132,10 @@ static stralloc bouncefrom = { 0 }; static stralloc bouncehost = { 0 }; static stralloc doublebounceto = { 0 }; static stralloc doublebouncehost = { 0 }; -char *(qlargs[]) = { "qmail-lspawn", "./Maildir/", 0, (char *) 0}; -char *(qrargs[]) = { "qmail-rspawn", 0, (char *) 0}; -char *(qcargs[]) = { "qmail-clean", "qmta", (char *) 0}; -char *(qfargs[]) = { "queue-fix", "-s", 0, 0, 0, (char *) 0}; +const char *(qlargs[]) = { "qmail-lspawn", "./Maildir/", 0, (char *) 0}; +const char *(qrargs[]) = { "qmail-rspawn", 0, (char *) 0}; +const char *(qcargs[]) = { "qmail-clean", "qmta", (char *) 0}; +const char *(qfargs[]) = { "queue-fix", "-s", 0, 0, 0, (char *) 0}; static int flagspawnalive[CHANNELS]; static int flagcleanup; /*- if 1, cleanupdir is initialized and ready */ static readsubdir cleanupdir; @@ -479,7 +480,7 @@ static int rewrite(char *recip) { unsigned int i, j, at; - char *x; + const char *x; static stralloc addr = { 0 }; if (!stralloc_copys(&rwline, "T") @@ -796,7 +797,7 @@ todo_do(fd_set *rfds) unsigned long id; char *ptr; char oldfn[FMTQFN]; - char *fix_dirs[] = {"todo/", "intd/", "mess/", 0}; + const char *fix_dirs[] = {"todo/", "intd/", "mess/", 0}; int i, split; if (flagexitasap) @@ -1195,11 +1196,11 @@ markdone(int c, unsigned long id, seek_pos pos) } /*- strip the virtual domain which is prepended to addresses e.g. xxx.com-user01@xxx.com */ -static char * -stripvdomprepend(char *recip) +static const char * +stripvdomprepend(const char *recip) { unsigned int i, domainlen; - char *domain, *prepend; + const char *domain, *prepend; i = str_rchr(recip, '@'); if (!recip[i]) @@ -1618,7 +1619,8 @@ injectbounce(unsigned long id) datetime_sec birth; substdio ssread; char buf[128], inbuf[128]; - char *bouncesender, *bouncerecip = "", *brep = "?", *p; + const char *bouncesender, *bouncerecip = ""; + char *brep = (char *) "?", *p; int r = -1, fd; unsigned long qp; #ifdef MIME @@ -2003,7 +2005,7 @@ queue_fix() !stralloc_0(&q)) nomem(argv0); qfargs[0] = q.s; - execv(*qfargs, qfargs); /*- queue-fix */ + execv(*qfargs, (char **) qfargs); /*- queue-fix */ _exit(111); } sig_unblock(sig_int); @@ -2076,7 +2078,7 @@ run_daemons(char **oargv, char **argv) !stralloc_0(&q)) nomem(argv0); qlargs[0] = q.s; - execv(*qlargs, qlargs); /*- qmail-lspawn */ + execv(*qlargs, (char **) qlargs); /*- qmail-lspawn */ } else { sig_block(sig_int); i = str_rchr(oargv[0], '/'); @@ -2084,7 +2086,7 @@ run_daemons(char **oargv, char **argv) str_copy(oargv[0] + i + 1, "MTAlspawn"); else str_copy(oargv[0], "MTAlspawn"); - qmail_lspawn(2, qlargs); + qmail_lspawn(2, (char **) qlargs); } _exit(111); } @@ -2124,7 +2126,7 @@ run_daemons(char **oargv, char **argv) !stralloc_0(&q)) nomem(argv0); qrargs[0] = q.s; - execv(*qrargs, qrargs); /*- qmail-rspawn */ + execv(*qrargs, (char **) qrargs); /*- qmail-rspawn */ } else { sig_block(sig_int); i = str_rchr(oargv[0], '/'); @@ -2132,7 +2134,7 @@ run_daemons(char **oargv, char **argv) str_copy(oargv[0] + i + 1, "MTArspawn"); else str_copy(oargv[0], "MTArspawn"); - qmail_rspawn(1, qrargs); + qmail_rspawn(1, (char **) qrargs); } _exit(111); } @@ -2173,7 +2175,7 @@ run_daemons(char **oargv, char **argv) !stralloc_0(&q)) nomem(argv0); qcargs[0] = q.s; - execv(*qcargs, qcargs); /*- qmail-clean */ + execv(*qcargs, (char **) qcargs); /*- qmail-clean */ _exit(111); } close(pi5[0]); @@ -2479,20 +2481,20 @@ void check_usage(int argc, char **argv, int *daemon_mode, int *flagqfix) { int i, j, opt; - char *bin_programs[] = {"sbin/qmail-lspawn", "sbin/qmail-rspawn", "sbin/qmail-clean", 0}; + const char *bin_programs[] = {"sbin/qmail-lspawn", "sbin/qmail-rspawn", "sbin/qmail-clean", 0}; char opt_str[9]; - char *usage_str = + const char *usage_str = "USAGE: qmta-send [options] [ defaultdelivery [logger arg...] ]\n" "OPTIONS\n" " -d Run as a daemon\n" " -f fix queue\n" " -b use Big Todo\n" " -s queue_split"; - char *u_str1 = + const char *u_str1 = " -l Use qmail-lspawn for spawning local deliveries"; - char *u_str2 = + const char *u_str2 = " -r Use qmail-rspawn for spawning remote deliveries"; - char *u_str3 = + const char *u_str3 = " -c Use qmail-clean for cleanup"; *daemon_mode = *flagqfix = 0; @@ -2771,7 +2773,7 @@ main(int argc, char **argv) void getversion_qmta_send_c() { - static char *x = "$Id: qmta-send.c,v 1.31 2024-02-08 20:47:48+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmta-send.c,v 1.32 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -2779,6 +2781,9 @@ getversion_qmta_send_c() /* * $Log: qmta-send.c,v $ + * Revision 1.32 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.31 2024-02-08 20:47:48+05:30 Cprogrammer * fixed multiplication result converted to larger type (codeql) * diff --git a/indimail-mta-x/qmulti.c b/indimail-mta-x/qmulti.c index 101a440eaa..21239f3417 100644 --- a/indimail-mta-x/qmulti.c +++ b/indimail-mta-x/qmulti.c @@ -1,5 +1,5 @@ /* - * $Id: qmulti.c,v 1.66 2023-10-28 07:29:59+05:30 Cprogrammer Exp mbhangui $ + * $Id: qmulti.c,v 1.67 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include "haslibrt.h" @@ -29,7 +29,7 @@ #include "qmail.h" int -getfreespace(char *filesystem) +getfreespace(const char *filesystem) { unsigned long quota_size, u; char *ptr; @@ -110,7 +110,7 @@ set_queuedir(char **argv) } no_return int -qmulti(char *queue_env, int argc, char **argv) +qmulti(const char *queue_env, int argc, char **argv) { char *queue_prog = NULL, *queuedir; int i, is_qmailq = 0; @@ -240,15 +240,17 @@ rewrite_envelope(int outfd) void getversion_qmulti_c() { - static char *x = "$Id: qmulti.c,v 1.66 2023-10-28 07:29:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qmulti.c,v 1.67 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidqmultih; x++; } #endif /* * $Log: qmulti.c,v $ + * Revision 1.67 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.66 2023-10-28 07:29:59+05:30 Cprogrammer * unset env variables queue_env, QUEUEPROG to prevent recursion * refactored code to handle qmail-queue consistently diff --git a/indimail-mta-x/qmulti.h b/indimail-mta-x/qmulti.h index 4bec00942c..c3924bd811 100644 --- a/indimail-mta-x/qmulti.h +++ b/indimail-mta-x/qmulti.h @@ -1,5 +1,8 @@ /* * $Log: qmulti.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2021-06-09 19:33:19+05:30 Cprogrammer * Initial revision * @@ -7,13 +10,9 @@ #ifndef QMULTI_H #define QMULTI_H -#ifndef lint -static char sccsidqmultih[] = "$Id: qmulti.h,v 1.1 2021-06-09 19:33:19+05:30 Cprogrammer Exp mbhangui $"; -#endif - -int qmulti(char *, int, char **); +int qmulti(const char *, int, char **); int discard_envelope(); int rewrite_envelope(int); -int getfreespace(char *); +int getfreespace(const char *); #endif diff --git a/indimail-mta-x/qnotify.c b/indimail-mta-x/qnotify.c index d73b30587f..28bca78a29 100644 --- a/indimail-mta-x/qnotify.c +++ b/indimail-mta-x/qnotify.c @@ -1,5 +1,8 @@ /* * $Log: qnotify.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2024-01-23 01:23:21+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -105,10 +108,11 @@ * */ +typedef const char c_char; static char strnum[FMT_ULONG]; static char ssoutbuf[BUFSIZE_OUT]; static char sserrbuf[BUFSIZE_OUT]; -static char *usage = "usage: qnotify [-n][-h]\n"; +static c_char *usage = "usage: qnotify [-n][-h]\n"; static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); static int flagqueue = 1; @@ -136,14 +140,14 @@ die_qqtemp() } void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit (WRITE_ERR); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit (WRITE_ERR); @@ -152,7 +156,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -171,7 +175,7 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s) +my_puts(const char *s) { if (flagqueue) qmail_puts(&qqt, s); @@ -181,7 +185,7 @@ my_puts(char *s) } void -my_putb(char *s, int len) +my_putb(const char *s, int len) { if (flagqueue) qmail_put(&qqt, s, len); @@ -194,7 +198,7 @@ static int mkTempFile(int seekfd) { char inbuf[2048], outbuf[2048]; - char *tmpdir; + const char *tmpdir; static stralloc tmpFile = {0}; struct substdio ssin; struct substdio sstmp; @@ -328,7 +332,7 @@ parse_email(int get_subj, int get_rpath) struct substdio ssin; static char ssinbuf[1024]; int match; - char *disposition_hdr; + const char *disposition_hdr; /*- original mail on stdin */ got_disposition = got_msgid = got_from = got_date = 0; @@ -429,7 +433,8 @@ main(int argc, char **argv) struct substdio ssin; static char ssinbuf[1024]; char buf[DATE822FMT]; - char *rpline, *qqx, *recipient, *host; + char *rpline, *recipient, *host; + const char *qqx; while ((ch = getopt(argc, argv, "nh")) != sgoptdone) { switch (ch) @@ -584,7 +589,7 @@ main(int argc, char **argv) void getversion_qnotify_c() { - static char *x = "$Id: qnotify.c,v 1.13 2024-01-23 01:23:21+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qnotify.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qquote.c b/indimail-mta-x/qquote.c index 7c415fbe51..4aa151898d 100644 --- a/indimail-mta-x/qquote.c +++ b/indimail-mta-x/qquote.c @@ -1,5 +1,8 @@ /* * $Log: qquote.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -60,7 +63,7 @@ main(int argc, char **argv) void getversion_qquote_c() { - static char *x = "$Id: qquote.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qquote.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qr_digest_md5.c b/indimail-mta-x/qr_digest_md5.c index ec692e61a5..1873e5474e 100644 --- a/indimail-mta-x/qr_digest_md5.c +++ b/indimail-mta-x/qr_digest_md5.c @@ -1,5 +1,8 @@ /* * $Log: qr_digest_md5.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2011-12-05 15:07:24+05:30 Cprogrammer * added version information * @@ -16,7 +19,7 @@ static char hextab[] = "0123456789abcdef"; char * qr_digest_md5(char *user, int ulen, char *realm, int rlen, char *pass, int plen, char *authzid, char *nonce, int nlen, char *digesturi, int dlen, - char *cnonce, char *nc, char *qop) + char *cnonce, const char *nc, const char *qop) { unsigned char digest[20], ea1[33], ea2[33]; static char encrypted[41]; @@ -106,7 +109,7 @@ qr_digest_md5(char *user, int ulen, char *realm, int rlen, char *pass, int plen, void getversion_qr_digest_md5_c() { - static char *x = "$Id: qr_digest_md5.c,v 1.2 2011-12-05 15:07:24+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: qr_digest_md5.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x=sccsidmd5h; x=sccsidglobalh; x++; diff --git a/indimail-mta-x/qr_digest_md5.h b/indimail-mta-x/qr_digest_md5.h index 97a4edd70b..ddc464c6b0 100644 --- a/indimail-mta-x/qr_digest_md5.h +++ b/indimail-mta-x/qr_digest_md5.h @@ -1,5 +1,8 @@ /* * $Log: qr_digest_md5.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2011-12-05 15:07:16+05:30 Cprogrammer * added RCS id * @@ -11,9 +14,9 @@ #define _AUTH_DIGEST_MD5_H 1 #ifndef lint -static char sccsidqrdigestmd5h[] = "$Id: qr_digest_md5.h,v 1.2 2011-12-05 15:07:16+05:30 Cprogrammer Stab mbhangui $"; +static const char sccsidqrdigestmd5h[] = "$Id: qr_digest_md5.h,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif -char *qr_digest_md5(char *, int, char *, int, char *, int, char *, char *, int, char *, int, char *, char *, char *); +char *qr_digest_md5(char *, int, char *, int, char *, int, char *, char *, int, char *, int, char *, const char *, const char *); #endif diff --git a/indimail-mta-x/qreceipt.c b/indimail-mta-x/qreceipt.c index 20f5d11310..236090b2c9 100644 --- a/indimail-mta-x/qreceipt.c +++ b/indimail-mta-x/qreceipt.c @@ -1,5 +1,8 @@ /* * $Log: qreceipt.c,v $ + * Revision 1.16 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.15 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -169,7 +172,7 @@ rwnotice(token822_alloc *addr) void finishheader() { - char *qqx; + const char *qqx; struct qmail qqt; if (!flagreceipt) @@ -254,7 +257,7 @@ main(int argc, char **argv) void getversion_qreceipt_c() { - static char *x = "$Id: qreceipt.c,v 1.15 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qreceipt.c,v 1.16 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qregex.c b/indimail-mta-x/qregex.c index 223100656a..372528f53d 100644 --- a/indimail-mta-x/qregex.c +++ b/indimail-mta-x/qregex.c @@ -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-09 22:03:17+05:30 mbhangui 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-09 22:03:17+05:30 $ + * Revision: $Revision: 1.38 $ * * Do POSIX regex matching on addresses for anti-relay / spam control. * It logs to the maillog @@ -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 @@ -60,12 +60,12 @@ #include "wildmat.h" static int wildmat_match(stralloc *, struct constmap *, stralloc *); -static int regex_match(stralloc *, stralloc *, char **); +static int regex_match(stralloc *, stralloc *, const char *[]); static char dotChar = '@'; int -cdbmatch(char *fn, char *addr, int len, struct constmap *maprh, char **errStr) +cdbmatch(const char *fn, const char *addr, int len, struct constmap *maprh, const char *errStr[]) { static stralloc controlfile = {0}; static stralloc temp = { 0 }; @@ -79,7 +79,7 @@ cdbmatch(char *fn, char *addr, int len, struct constmap *maprh, char **errStr) controldir = auto_control; } if (errStr) - *errStr = 0; + *errStr = NULL; if (!stralloc_copys(&controlfile, controldir) || !stralloc_cats(&controlfile, "/") || !stralloc_cats(&controlfile, fn) || !stralloc_cats(&controlfile, ".cdb") || !stralloc_0(&controlfile)) { @@ -137,15 +137,15 @@ setdotChar(char c) } int -address_match(char *fn, stralloc *addr, stralloc *bhf, struct constmap *mapbhf, - stralloc *wildcard, char **errStr) +address_match(const char *fn, stralloc *addr, stralloc *bhf, struct constmap *mapbhf, + stralloc *wildcard, const char *errStr[]) { char *ptr; int x = 0; case_lowerb(addr->s, addr->len); /*- convert into lower case */ if (errStr) - *errStr = 0; + *errStr = NULL; if (fn && (x = cdbmatch(fn, addr->s, addr->len - 1, 0, errStr))) return (x); #if defined(USE_SQL) @@ -165,9 +165,7 @@ address_match(char *fn, stralloc *addr, stralloc *bhf, struct constmap *mapbhf, static int wildmat_match(stralloc *addr, struct constmap *ptrmap, stralloc *wildcard) { - int i = 0; - int j = 0; - int k = 0; + int i = 0, j = 0, k = 0; char subvalue; if (ptrmap) { @@ -197,7 +195,7 @@ wildmat_match(stralloc *addr, struct constmap *ptrmap, stralloc *wildcard) } static int -regex_match(stralloc *addr, stralloc *map, char **errStr) +regex_match(stralloc *addr, stralloc *map, const char *errStr[]) { int i = 0; int j = 0; @@ -207,7 +205,7 @@ regex_match(stralloc *addr, stralloc *map, char **errStr) match = 0; if (errStr) - *errStr = 0; + *errStr = NULL; if (map) { while (j < map->len) { i = j; @@ -241,7 +239,7 @@ 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 $"; + const char *x = "$Id: qregex.c,v 1.38 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidwildmath; x++; @@ -249,6 +247,9 @@ getversion_qregex_c() /* * $Log: qregex.c,v $ + * Revision 1.38 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.37 2023-11-03 05:21:55+05:30 Cprogrammer * fix wildmat when pattern file is missing * diff --git a/indimail-mta-x/qregex.h b/indimail-mta-x/qregex.h index 4a85e0d437..fa5a715a88 100644 --- a/indimail-mta-x/qregex.h +++ b/indimail-mta-x/qregex.h @@ -1,5 +1,8 @@ /* * $Log: qregex.h,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-09-05 20:59:42+05:30 Cprogrammer * moved matchregex error codes to libqmail/base/matchregex.h * @@ -51,7 +54,7 @@ #define AM_MYSQL_ERR (MAX_AM_ERR -1) #endif -int address_match(char *, stralloc *, stralloc *, struct constmap *, stralloc *, char **); +int address_match(const char *, stralloc *, stralloc *, struct constmap *, stralloc *, const char *err[]); void setdotChar(char); -int cdbmatch(char *, char *, int, struct constmap *, char **); +int cdbmatch(const char *, const char *, int, struct constmap *, const char *err[]); #endif diff --git a/indimail-mta-x/qscanq-stdin.c b/indimail-mta-x/qscanq-stdin.c index 064bc575a7..f2b09ca791 100644 --- a/indimail-mta-x/qscanq-stdin.c +++ b/indimail-mta-x/qscanq-stdin.c @@ -1,5 +1,8 @@ /* * $Log: qscanq-stdin.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -199,9 +202,8 @@ main(int argc, char *argv[]) void getversion_qscanq_stdin_c() { - static char *x = "$Id: qscanq-stdin.c,v 1.8 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qscanq-stdin.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; - x = sccsidqmultih; x++; } #endif diff --git a/indimail-mta-x/qscanq.c b/indimail-mta-x/qscanq.c index 336d396cfe..9908f9dad4 100644 --- a/indimail-mta-x/qscanq.c +++ b/indimail-mta-x/qscanq.c @@ -1,5 +1,5 @@ /* - * $Id: qscanq.c,v 1.13 2024-02-12 19:51:30+05:30 Cprogrammer Exp mbhangui $ + * $Id: qscanq.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -163,13 +163,16 @@ main(int argc, char *argv[]) void getversion_qscanq_c() { - static char *x = "$Id: qscanq.c,v 1.13 2024-02-12 19:51:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qscanq.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: qscanq.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2024-02-12 19:51:30+05:30 Cprogrammer * rearranged header files and moved RCS log to bottom * diff --git a/indimail-mta-x/qscheduler.c b/indimail-mta-x/qscheduler.c index c37db7c57e..7d0b745d77 100644 --- a/indimail-mta-x/qscheduler.c +++ b/indimail-mta-x/qscheduler.c @@ -1,5 +1,8 @@ /* * $Log: qscheduler.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2024-02-28 18:03:16+05:30 Cprogrammer * removed unreachable statement * @@ -67,6 +70,7 @@ #define ERROR_INTERVAL 5 +typedef const char c_char; static int qstart, qcount; static char *qbase; static stralloc envQueue = {0}, QueueBase = {0}; @@ -91,21 +95,21 @@ static char ssoutbuf[512]; static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof(ssoutbuf)); int conf_split; static qtab *queue_table; -static char *(qsargs[]) = { "qmail-start", "-s", "./Mailbox", 0}; -char *(qfargs[]) = { "queue-fix", "-s", 0, 0, 0}; +static c_char *(qsargs[]) = { "qmail-start", "-s", "./Mailbox", 0}; +static c_char *(qfargs[]) = { "queue-fix", "-s", 0, 0, 0}; void start_send(int queueNum, pid_t pid); static void nomem(); void -log_out(char *s) +log_out(const char *s) { if (substdio_puts(&ssout, s) == -1) _exit(1); } void -log_outf(char *s) +log_outf(const char *s) { if (substdio_puts(&ssout, s) == -1) _exit(1); @@ -114,7 +118,7 @@ log_outf(char *s) } void -log_announce(int pid, char *qdir, unsigned long load, int died) +log_announce(int pid, const char *qdir, unsigned long load, int died) { log_out("info: qscheduler: pid "); strnum1[fmt_ulong(strnum1, pid)] = 0; @@ -235,14 +239,14 @@ nomem() } static void -die_opendir(char *fn) +die_opendir(const char *fn) { strerr_warn3("alert: qscheduler: unable to opendir ", fn, ": ", &strerr_sys); die(1); } static void -die_chdir(char *s) +die_chdir(const char *s) { strerr_warn3("alert: qscheduler: unable to switch to ", s, ": ", &strerr_sys); die(1); @@ -444,13 +448,13 @@ check_send(int queue_no) } int -is_queue_empty(char *qptr) +is_queue_empty(const char *qptr) { readsubdir qsubdir; int x, split_flag = bigtodo; unsigned long id; - char *dir_s1[] = {"todo", "local", "remote", 0}; - char **ptr; + const char *dir_s1[] = {"todo", "local", "remote", 0}; + const char **ptr; if (chdir(qptr) == -1) die_chdir(qptr); @@ -519,7 +523,7 @@ start_send(int queueNum, pid_t pid) strnum1[fmt_ulong(strnum1, queue_no)] = 0; if (!env_put(envQueue.s) || !env_put2("QIDENT", strnum1)) strerr_die1x(111, "alert: qscheduler: out of memory"); - execvp(*qsargs, qsargs); + execvp(*qsargs, (char **) qsargs); strerr_die3sys(111, "alert: qscheduler: execv ", *qsargs, ": "); default: queue_table[queue_no].pid = qspid; @@ -668,7 +672,7 @@ queue_fix(char *queuedir) strnum1[fmt_int(strnum1, conf_split)] = 0; qfargs[2] = strnum1; qfargs[3] = queuedir; - execvp(*qfargs, qfargs); /*- queue-fix */ + execvp(*qfargs, (char **) qfargs); /*- queue-fix */ strerr_die3sys(111, "alert: qscheduler: execv ", *qfargs, ": "); } sig_unblock(sig_int); @@ -1248,7 +1252,7 @@ main(int argc, char **argv) void getversion_queue_scheduler_c() { - static char *x = "$Id: qscheduler.c,v 1.10 2024-02-28 18:03:16+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qscheduler.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qsmhook.c b/indimail-mta-x/qsmhook.c index 63b5e25aac..d7dd79146a 100644 --- a/indimail-mta-x/qsmhook.c +++ b/indimail-mta-x/qsmhook.c @@ -1,5 +1,8 @@ /* * $Log: qsmhook.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -36,7 +39,7 @@ #include no_return void -die(int e, char *s) +die(int e, const char *s) { substdio_putsflush(subfderr, s); _exit(e); @@ -206,7 +209,7 @@ main(int argc, char **argv) void getversion_qsmhook_c() { - static char *x = "$Id: qsmhook.c,v 1.10 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qsmhook.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qsutil.c b/indimail-mta-x/qsutil.c index 1fab11539e..66782af3bb 100644 --- a/indimail-mta-x/qsutil.c +++ b/indimail-mta-x/qsutil.c @@ -1,5 +1,8 @@ /* * $Log: qsutil.c,v $ + * Revision 1.26 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.25 2023-06-25 20:11:21+05:30 Cprogrammer * removed extra / from path * @@ -112,7 +115,7 @@ lockerr() } void -loglock_open(char *ident, int preopen) +loglock_open(const char *ident, int preopen) { char *ptr; int lock_status; @@ -143,7 +146,7 @@ loglock_open(char *ident, int preopen) #endif int -fix_split(char *s, char *path, char *client_split, unsigned long id) +fix_split(char *s, const char *path, const char *client_split, unsigned long id) { int i, len; @@ -267,7 +270,7 @@ log_stat(stralloc *mailfrom, stralloc *mailto, unsigned long id, size_t bytes) } void -nomem(char *argv0) +nomem(const char *argv0) { if (queuedesc) slog(1, "alert: ", argv0, ": ", queuedesc, ": out of memory, sleeping...\n", NULL); @@ -277,7 +280,7 @@ nomem(char *argv0) } void -pausedir(char *dir) +pausedir(const char *dir) { if (queuedesc) slog(1, "alert: ", queuedesc, ": unable to opendir ", dir, ", sleeping...\n", NULL); @@ -293,7 +296,7 @@ issafe(char ch) } void -logsafe_noflush(char *s, char *argv0) +logsafe_noflush(const char *s, const char *argv0) { int i; @@ -309,7 +312,7 @@ logsafe_noflush(char *s, char *argv0) } void -logsafe(char *s, char *argv0) +logsafe(const char *s, const char *argv0) { int i; @@ -327,7 +330,7 @@ logsafe(char *s, char *argv0) void getversion_qsutil_c() { - static char *x = "$Id: qsutil.c,v 1.25 2023-06-25 20:11:21+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: qsutil.c,v 1.26 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/qsutil.h b/indimail-mta-x/qsutil.h index 5f0897b43f..8cc73bf1c3 100644 --- a/indimail-mta-x/qsutil.h +++ b/indimail-mta-x/qsutil.h @@ -1,5 +1,8 @@ /* * $Log: qsutil.h,v $ + * Revision 1.24 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.23 2023-01-15 12:38:42+05:30 Cprogrammer * use slog() function with varargs to replace all log functions * @@ -70,7 +73,7 @@ #include #include "varargs.h" -void loglock_open(char *, int); +void loglock_open(const char *, int); void lockerr(void); #ifdef HAVE_STDARG_H void slog(int, ...); @@ -80,12 +83,12 @@ void slog(); void logsa(stralloc *); void logsa_noflush(stralloc *); void log_stat(stralloc *, stralloc *, unsigned long, size_t); -void nomem(char *); -void pausedir(char *); -void logsafe(char *, char *); -void logsafe_noflush(char *, char *); +void nomem(const char *); +void pausedir(const char *); +void logsafe(const char *, const char *); +void logsafe_noflush(const char *, const char *); void flush(); -int fix_split(char *s, char *path, char *client_split, unsigned long id); +int fix_split(char *s, const char *path, const char *client_split, unsigned long id); extern int loglock_fd; diff --git a/indimail-mta-x/query_skt.c b/indimail-mta-x/query_skt.c index b6d37908a0..26f57def90 100644 --- a/indimail-mta-x/query_skt.c +++ b/indimail-mta-x/query_skt.c @@ -1,5 +1,8 @@ /* * $Log: query_skt.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2018-04-25 22:49:59+05:30 Cprogrammer * Initial revision * @@ -12,13 +15,8 @@ #include "stralloc.h" int -query_skt(fd, ipaddr, queryp, responsep, maxresponsesize, timeout, timeoutfn, errfn) - int fd; - char *ipaddr; - stralloc *queryp; - char *responsep; - int maxresponsesize, timeout; - void (*errfn) (), (*timeoutfn) (); +query_skt(int fd, const char *ipaddr, stralloc *queryp, char *responsep, + int maxresponsesize, int timeout, void (*errfn) (), void (*timeoutfn) ()) { int r = 0; @@ -37,7 +35,7 @@ query_skt(fd, ipaddr, queryp, responsep, maxresponsesize, timeout, timeoutfn, er void getversion_query_skt_c() { - static char *x = "$Id: query_skt.c,v 1.1 2018-04-25 22:49:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: query_skt.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/queue-fix.c b/indimail-mta-x/queue-fix.c index f11cb6930a..a88862687a 100644 --- a/indimail-mta-x/queue-fix.c +++ b/indimail-mta-x/queue-fix.c @@ -1,5 +1,5 @@ /*- - * $Id: queue-fix.c,v 1.33 2024-02-11 23:22:35+05:30 Cprogrammer Exp mbhangui $ + * $Id: queue-fix.c,v 1.34 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * adapted from queue-fix 1.4 * by Eric Huss @@ -73,7 +73,7 @@ static int bigtodo; static uint tcpto_size = TCPTO_BUFSIZ; void -out(char *str) +out(const char *str) { if (substdio_puts(subfdout, str) == -1) strerr_die2sys(111, FATAL, "write: "); @@ -115,7 +115,7 @@ usage() } no_return void -die_check(char *arg) +die_check(const char *arg) { substdio_put(subfderr, "\n", 1); strerr_warn3(FATAL, arg, " failed checking qmail queue structure.\n" @@ -135,7 +135,7 @@ die_rerun() } int -qchown(char *name, uid_t uid, gid_t gid) +qchown(const char *name, uid_t uid, gid_t gid) { int fd; @@ -150,7 +150,7 @@ qchown(char *name, uid_t uid, gid_t gid) } int -qchmod(char *name, mode_t mode) +qchmod(const char *name, mode_t mode) { int fd; @@ -185,7 +185,8 @@ confirm() * gid may be -1 on files for "unknown" */ int -check_item(char *name, char *owner, char *group, uid_t uid, gid_t gid, mode_t perm, char type, int size) +check_item(const char *name, const char *owner, const char *group, + uid_t uid, gid_t gid, mode_t perm, char type, int size) { struct stat st; int fd = -1, ffd; @@ -510,7 +511,8 @@ check_item(char *name, char *owner, char *group, uid_t uid, gid_t gid, mode_t pe } int -check_files(char *directory, char *owner, char *group, uid_t uid, gid_t gid, mode_t perm) +check_files(const char *directory, const char *owner, const char *group, + uid_t uid, gid_t gid, mode_t perm) { DIR *dir; direntry *d; @@ -539,7 +541,7 @@ check_files(char *directory, char *owner, char *group, uid_t uid, gid_t gid, mod } void -warn_files(char *directory) +warn_files(const char *directory) { DIR *dir; direntry *d; @@ -564,8 +566,9 @@ warn_files(char *directory) } int -check_splits(char *directory, char *owner, char *group, char *fgroup, - uid_t dir_uid, gid_t dir_gid, mode_t dir_perm, gid_t file_gid, mode_t file_perm) +check_splits(const char *directory, const char *owner, const char *group, + const char *fgroup, uid_t dir_uid, gid_t dir_gid, mode_t dir_perm, + gid_t file_gid, mode_t file_perm) { DIR *dir; direntry *d; @@ -604,7 +607,8 @@ check_splits(char *directory, char *owner, char *group, char *fgroup, } int -rename_mess(char *dir, char *part, char *new_part, char *old_filename, char *new_filename) +rename_mess(const char *dir, const char *part, const char *new_part, + const char *old_filename, const char *new_filename) { int s; @@ -741,7 +745,7 @@ fix_part(char *part, int part_num) } int -clean_tmp(char *directory, char *part) +clean_tmp(const char *directory, const char *part) { DIR *dir; direntry *d; @@ -812,9 +816,9 @@ fix_names() typedef struct queue_t { - char *name; - char *user; - char *group; + const char *name; + const char *user; + const char *group; uid_t uid; gid_t gid; mode_t perm_d; @@ -1002,10 +1006,10 @@ check_stray_parts() int find_strays() { - char *dir_s1[] = {"info", "local", "remote", 0}; - char *dir_s2[] = {"todo", "intd", 0}; - char *dir_s3[] = {"bounce", 0}; - char **ptr; + const char *dir_s1[] = {"info", "local", "remote", 0}; + const char *dir_s2[] = {"todo", "intd", 0}; + const char *dir_s3[] = {"bounce", 0}; + const char **ptr; int save; if (!stralloc_copy(&check_dir, &queue_dir)) @@ -1131,13 +1135,16 @@ main(int argc, char **argv) void getversion_queue_fix_c() { - static char *x = "$Id: queue-fix.c,v 1.33 2024-02-11 23:22:35+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: queue-fix.c,v 1.34 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: queue-fix.c,v $ + * Revision 1.34 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.33 2024-02-11 23:22:35+05:30 Cprogrammer * added option -S to specify tcpto buffer size * added option -t to create trash directory for qmail-rm diff --git a/indimail-mta-x/queue_load.c b/indimail-mta-x/queue_load.c index ec644e5f06..3181aaea6f 100644 --- a/indimail-mta-x/queue_load.c +++ b/indimail-mta-x/queue_load.c @@ -1,5 +1,5 @@ /* - * $Id: queue_load.c,v 1.3 2022-04-23 00:14:18+05:30 Cprogrammer Exp mbhangui $ + * $Id: queue_load.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "haslibrt.h" @@ -17,7 +17,7 @@ #include "queue_load.h" void -queue_load(char *argv0, int *qcount, int *qconf, double total_load[2], QDEF **queue) +queue_load(const char *argv0, int *qcount, int *qconf, double total_load[2], QDEF **queue) { int shm, i, j, queue_count, queue_conf, len, x, min = -1, lcur = 0, rcur = 0; double load_l, load_r; @@ -104,7 +104,7 @@ queue_load(char *argv0, int *qcount, int *qconf, double total_load[2], QDEF **qu void getversion_queue_load_c() { - static char *x = "$Id: queue_load.c,v 1.3 2022-04-23 00:14:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: queue_load.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } @@ -112,6 +112,9 @@ getversion_queue_load_c() /*- * $Log: queue_load.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2022-04-23 00:14:18+05:30 Cprogrammer * initialize QDEF * diff --git a/indimail-mta-x/queue_load.h b/indimail-mta-x/queue_load.h index a1d6ccbc90..c6d663c4a0 100644 --- a/indimail-mta-x/queue_load.h +++ b/indimail-mta-x/queue_load.h @@ -11,6 +11,6 @@ typedef struct { char flag; } QDEF; -void queue_load(char *, int *, int *, double qload[2], QDEF **); +void queue_load(const char *, int *, int *, double qload[2], QDEF **); #endif diff --git a/indimail-mta-x/quote.c b/indimail-mta-x/quote.c index d7ae0519f8..9f730b5f69 100644 --- a/indimail-mta-x/quote.c +++ b/indimail-mta-x/quote.c @@ -1,5 +1,8 @@ /* * $Log: quote.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2022-10-30 18:01:15+05:30 Cprogrammer * converted to ansic prototype * @@ -65,7 +68,7 @@ doit(stralloc *saout, stralloc *sain) } int -quote_need(char *s, unsigned int n) +quote_need(const char *s, unsigned int n) { unsigned char uch; int i; @@ -100,7 +103,7 @@ quote(stralloc *saout, stralloc *sain) static stralloc foo = { 0 }; int -quote2(stralloc *sa, char *s) +quote2(stralloc *sa, const char *s) { int j; @@ -120,7 +123,7 @@ quote2(stralloc *sa, char *s) void getversion_quote_c() { - static char *x = "$Id: quote.c,v 1.5 2022-10-30 18:01:15+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: quote.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/quote.h b/indimail-mta-x/quote.h index 937623940c..03d25ccfce 100644 --- a/indimail-mta-x/quote.h +++ b/indimail-mta-x/quote.h @@ -1,5 +1,8 @@ /* * $Log: quote.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-11 14:00:27+05:30 Cprogrammer * added function prototypes * @@ -10,8 +13,8 @@ #ifndef QUOTE_H #define QUOTE_H -int quote_need(char *, unsigned int); +int quote_need(const char *, unsigned int); int quote(stralloc *, stralloc *); -int quote2(stralloc *, char *); +int quote2(stralloc *, const char *); #endif diff --git a/indimail-mta-x/rcpthosts.c b/indimail-mta-x/rcpthosts.c index 87bddac937..8fab1225e1 100644 --- a/indimail-mta-x/rcpthosts.c +++ b/indimail-mta-x/rcpthosts.c @@ -1,5 +1,8 @@ /* * $Log: rcpthosts.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2022-12-24 22:33:27+05:30 Cprogrammer * converted function prototypes to ansic * @@ -76,9 +79,10 @@ rcpthosts_init() static stralloc host = { 0 }; int -rcpthosts(char *buf, int len, int nolocal) +rcpthosts(const char *buf, int len, int nolocal) { int j; + char *b; if (nolocal == 0) { if (flagrh != 1) @@ -98,10 +102,10 @@ rcpthosts(char *buf, int len, int nolocal) len -= j; if (!stralloc_copyb(&host, buf, len)) return -1; - buf = host.s; - case_lowerb(buf, len); + b = host.s; + case_lowerb(b, len); for (j = 0; j < len; ++j) { - if ((!j || (buf[j] == '.')) && constmap(&maprh, buf + j, len - j)) + if ((!j || (b[j] == '.')) && constmap(&maprh, b + j, len - j)) return 1; } if (fdmrh != -1) { @@ -109,12 +113,12 @@ rcpthosts(char *buf, int len, int nolocal) int r; for (j = 0; j < len; ++j) { - if (!j || (buf[j] == '.')) { - if ((r = cdb_seek(fdmrh, buf + j, len - j, &dlen))) { + if (!j || (b[j] == '.')) { + if ((r = cdb_seek(fdmrh, b + j, len - j, &dlen))) { if (errno == error_ebadf) { /*- oops fdmrh got closed */ if ((fdmrh = open_read(morercpthosts.s)) == -1) return r; - if ((r = cdb_seek(fdmrh, buf + j, len - j, &dlen))) + if ((r = cdb_seek(fdmrh, b + j, len - j, &dlen))) return r; } else return r; @@ -128,7 +132,7 @@ rcpthosts(char *buf, int len, int nolocal) void getversion_rcpthosts_c() { - static char *x = "$Id: rcpthosts.c,v 1.11 2022-12-24 22:33:27+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: rcpthosts.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/rcpthosts.h b/indimail-mta-x/rcpthosts.h index 03e58083e1..f84ee3c600 100644 --- a/indimail-mta-x/rcpthosts.h +++ b/indimail-mta-x/rcpthosts.h @@ -1,5 +1,8 @@ /* * $Log: rcpthosts.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-11 14:00:29+05:30 Cprogrammer * added function prototypes * @@ -11,6 +14,6 @@ #define RCPTHOSTS_H int rcpthosts_init(void); -int rcpthosts(char *, int, int); +int rcpthosts(const char *, int, int); #endif diff --git a/indimail-mta-x/rd-remote.c b/indimail-mta-x/rd-remote.c index cfc8e39c6a..fcc98b467f 100644 --- a/indimail-mta-x/rd-remote.c +++ b/indimail-mta-x/rd-remote.c @@ -1,5 +1,5 @@ /* - * $Id: rd-remote.c,v 1.3 2023-12-06 17:01:44+05:30 Cprogrammer Exp mbhangui $ + * $Id: rd-remote.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -22,7 +22,7 @@ static stralloc rdomain; void -out(char *s) +out(const char *s) { if (substdio_puts(subfdoutsmall, s) == -1) _exit(0); @@ -110,7 +110,7 @@ temp_write() * "Dexample.org does not like recipient\0\n" */ void -print_report(char *s1, char *msg, int msglen) +print_report(const char *s1, const char *msg, int msglen) { out(s1); if (substdio_put(subfdoutsmall, msg, msglen) == -1) @@ -129,7 +129,7 @@ static stralloc canonhost = { 0 }; static stralloc canonbox = { 0 }; void /*- host has to be canonical, box has to be quoted */ -addrmangle(stralloc *saout, char *sender) +addrmangle(stralloc *saout, const char *sender) { int j; @@ -165,11 +165,12 @@ main(int argc, char **argv) match; int pipefd[2], errpipe[2]; unsigned long size; - char *ptr, *cptr, *addr, *errStr, *dest_addr, *dest_domain, + const char *errStr; + char *ptr, *cptr, *addr, *dest_addr, *dest_domain, *prefix; char ssibuf[512], ssobuf[512], ssebuf[512], strnum[FMT_ULONG]; - char *(qrargs[]) = { "queue-remote", 0, 0, 0, 0, 0, (char *) 0}; - char *(mdargs[]) = { "maildirdeliver", 0, (char *) 0}; + const char *(qrargs[]) = { "queue-remote", 0, 0, 0, 0, 0, (char *) 0}; + const char *(mdargs[]) = { "maildirdeliver", 0, (char *) 0}; pid_t pid; substdio ssi, sso, sse; stralloc q = {0}, sender = {0}, recip = {0}, dto = {0}, line = {0}; @@ -306,7 +307,7 @@ main(int argc, char **argv) temp_nomem(); mdargs[0] = q.s; mdargs[1] = dest_addr; - execv(q.s, mdargs); /*- run maildirdeliver */ + execv(q.s, (char **) mdargs); /*- run maildirdeliver */ } else { if (!stralloc_copys(&q, auto_prefix) || !stralloc_catb(&q, "/sbin/qmail-remote", 18) || @@ -320,7 +321,7 @@ main(int argc, char **argv) strnum[fmt_ulong(strnum, size + dto.len)] = 0; qrargs[4] = strnum; qrargs[5] = dest_addr; - execv(q.s, qrargs); /*- run qmail-remote */ + execv(q.s, (char **) qrargs); /*- run qmail-remote */ } _exit(111); default: @@ -379,6 +380,9 @@ main(int argc, char **argv) /* * $Log: rd-remote.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2023-12-06 17:01:44+05:30 Cprogrammer * added comment on report format for qmail-rspawn * diff --git a/indimail-mta-x/read_assign.c b/indimail-mta-x/read_assign.c index 0cc5f27ae6..4d92014385 100644 --- a/indimail-mta-x/read_assign.c +++ b/indimail-mta-x/read_assign.c @@ -1,5 +1,5 @@ /* - * $Id: read_assign.c,v 1.1 2023-12-08 12:31:19+05:30 Cprogrammer Exp mbhangui $ + * $Id: read_assign.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -29,7 +29,7 @@ static stralloc cdbfilename, in_dir; * but this doesn't cache the result in static variables */ char * -read_assign(char *domain, stralloc *dir, uid_t *uid, gid_t *gid) +read_assign(const char *domain, stralloc *dir, uid_t *uid, gid_t *gid) { int fd; uint32_t dlen, i; @@ -110,7 +110,7 @@ read_assign(char *domain, stralloc *dir, uid_t *uid, gid_t *gid) void getversion_read_assign_c() { - static char *x = "$Id: read_assign.c,v 1.1 2023-12-08 12:31:19+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: read_assign.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -118,6 +118,9 @@ getversion_read_assign_c() /* * $Log: read_assign.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-12-08 12:31:19+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/read_assign.h b/indimail-mta-x/read_assign.h index 569de7f353..935c0ab80c 100644 --- a/indimail-mta-x/read_assign.h +++ b/indimail-mta-x/read_assign.h @@ -1,9 +1,9 @@ /* - * $Id: read_assign.h,v 1.1 2023-12-08 12:31:21+05:30 Cprogrammer Exp mbhangui $ + * $Id: read_assign.h,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifndef _READ_ASSIGN_H #define _READ_ASSIGN_H -char *read_assign(char *domain, stralloc *dir, uid_t *uid, gid_t *gid); +char *read_assign(const char *domain, stralloc *dir, uid_t *uid, gid_t *gid); #endif diff --git a/indimail-mta-x/readsubdir.c b/indimail-mta-x/readsubdir.c index 6da1d5f5b5..09e40f2597 100644 --- a/indimail-mta-x/readsubdir.c +++ b/indimail-mta-x/readsubdir.c @@ -1,5 +1,8 @@ /* * $Log: readsubdir.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2022-01-30 09:38:02+05:30 Cprogrammer * allow configurable big/small todo/intd * @@ -23,7 +26,7 @@ #include "str.h" void -readsubdir_init(readsubdir *rs, char *name, int flagsplit, void (*pause)()) +readsubdir_init(readsubdir *rs, const char *name, int flagsplit, void (*pause)()) { rs->name = name; rs->pause = pause; @@ -93,7 +96,7 @@ readsubdir_next(readsubdir *rs, unsigned long *id) void getversion_readsubdir_c() { - static char *x = "$Id: readsubdir.c,v 1.6 2022-01-30 09:38:02+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: readsubdir.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/readsubdir.h b/indimail-mta-x/readsubdir.h index d8685f3f61..d4ec39cbf0 100644 --- a/indimail-mta-x/readsubdir.h +++ b/indimail-mta-x/readsubdir.h @@ -1,5 +1,8 @@ /* * $Log: readsubdir.h,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2022-01-30 09:38:08+05:30 Cprogrammer * allow configurable big/small todo/intd * @@ -25,11 +28,11 @@ typedef struct readsubdir DIR *dir; int pos; int split; - char *name; + const char *name; void (*pause) (); } readsubdir; -void readsubdir_init(readsubdir *, char *, int, void (*pause) ()); +void readsubdir_init(readsubdir *, const char *, int, void (*pause) ()); int readsubdir_next(readsubdir *, unsigned long *); char *readsubdir_name(readsubdir *); diff --git a/indimail-mta-x/received.c b/indimail-mta-x/received.c index 0cd02af3ac..667d9978df 100644 --- a/indimail-mta-x/received.c +++ b/indimail-mta-x/received.c @@ -1,5 +1,5 @@ /* - * $Id: received.c,v 1.9 2024-02-05 09:32:58+05:30 Cprogrammer Exp mbhangui $ + * $Id: received.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -26,7 +26,7 @@ issafe(char ch) } void -safeput(struct qmail *qqt, char *s) +safeput(struct qmail *qqt, const char *s) { char ch; @@ -43,8 +43,9 @@ safeput(struct qmail *qqt, char *s) */ void -received(struct qmail *qqt, char *program, char *protocol, char *local, char *remoteip, - char *remotehost, char *remoteinfo, char *helo, int hide) +received(struct qmail *qqt, const char *program, const char *protocol, + const char *local, const char *remoteip, const char *remotehost, + const char *remoteinfo, const char *helo, int hide) { struct datetime dt; char strnum[FMT_ULONG], buf[DATE822FMT]; @@ -86,13 +87,16 @@ received(struct qmail *qqt, char *program, char *protocol, char *local, char *re void getversion_received_c() { - static char *x = "$Id: received.c,v 1.9 2024-02-05 09:32:58+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: received.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: received.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2024-02-05 09:32:58+05:30 Cprogrammer * added parameter hide to hide IP, Host in received headers * diff --git a/indimail-mta-x/received.h b/indimail-mta-x/received.h index 03bab570a9..a56dfc7fea 100644 --- a/indimail-mta-x/received.h +++ b/indimail-mta-x/received.h @@ -1,5 +1,8 @@ /* * $Log: received.h,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-10-07 01:26:30+05:30 Cprogrammer * added parameter hide to hide IP, Host in received headers * @@ -17,6 +20,6 @@ #define RECEIVED_H #include "qmail.h" -void received(struct qmail *, char *, char *, char *, char *, char *, char *, char *, int); +void received(struct qmail *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int); #endif diff --git a/indimail-mta-x/recipients.c b/indimail-mta-x/recipients.c index 90e3ed345d..6852946e45 100644 --- a/indimail-mta-x/recipients.c +++ b/indimail-mta-x/recipients.c @@ -1,6 +1,6 @@ /* * RCS log at bottom - * $Id: recipients.c,v 1.11 2023-08-14 00:56:38+05:30 Cprogrammer Exp mbhangui $ + * $Id: recipients.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -251,7 +251,7 @@ recipients(char *buf, int len) void getversion_recipients_c() { - static char *x = "$Id: recipients.c,v 1.11 2023-08-14 00:56:38+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: recipients.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; x = sccsidmakeargsh; @@ -260,6 +260,9 @@ getversion_recipients_c() /* * $Log: recipients.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2023-08-14 00:56:38+05:30 Cprogrammer * allow any number of arguments for pavm * diff --git a/indimail-mta-x/relaytest.c b/indimail-mta-x/relaytest.c index 75ae5f84f7..931dcf66a3 100644 --- a/indimail-mta-x/relaytest.c +++ b/indimail-mta-x/relaytest.c @@ -1,5 +1,8 @@ /* * $Log: relaytest.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-10-07 08:42:37+05:30 Cprogrammer * updated with original author * @@ -185,13 +188,16 @@ main(int argc, char **argv) void getversion_relaytest_c() { - static char *x = "$Id: relaytest.c,v 1.7 2023-10-07 08:42:37+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: relaytest.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: relaytest.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-10-07 08:42:37+05:30 Cprogrammer * updated with original author * diff --git a/indimail-mta-x/remoteinfo.c b/indimail-mta-x/remoteinfo.c index 2e17015e1c..c671e3872b 100644 --- a/indimail-mta-x/remoteinfo.c +++ b/indimail-mta-x/remoteinfo.c @@ -1,5 +1,8 @@ /* * $Log: remoteinfo.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2008-07-15 19:53:22+05:30 Cprogrammer * porting for Mac OS X * @@ -189,7 +192,7 @@ remoteinfo_get(saremote, salocal, timeout) void getversion_remoteinfo_c() { - static char *x = "$Id: remoteinfo.c,v 1.7 2008-07-15 19:53:22+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: remoteinfo.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/replier-config.c b/indimail-mta-x/replier-config.c index cf85ba428b..c0eaa57e1d 100644 --- a/indimail-mta-x/replier-config.c +++ b/indimail-mta-x/replier-config.c @@ -1,5 +1,8 @@ /* * $Log: replier-config.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2022-03-05 13:37:29+05:30 Cprogrammer * use auto_prefix/bin for binary paths * @@ -37,11 +40,12 @@ #define FATAL "replier-config: fatal: " +typedef const char c_char; static int fd; static substdio ss; static stralloc dirplus = { 0 }; static stralloc dotplus = { 0 }; -static char *fn, *dir, *dot, *local, *host, *outlocal, *outhost; +static c_char *fn, *dir, *dot, *local, *host, *outlocal, *outhost; static char buf[1024]; no_return void @@ -63,7 +67,7 @@ fail(void) } void -makedir(char *s) +makedir(const char *s) { fn = s; if (mkdir(fn, 0700) == -1) @@ -71,7 +75,7 @@ makedir(char *s) } void -start(char *s) +start(const char *s) { fn = s; if ((fd = open_trunc(fn)) == -1) @@ -80,7 +84,7 @@ start(char *s) } void -outs(char *s) +outs(const char *s) { if (substdio_puts(&ss, s) == -1) fail(); @@ -104,7 +108,7 @@ perm(int mode) } void -dirplusmake(char *slash) +dirplusmake(const char *slash) { if (!stralloc_copys(&dirplus, dir) || !stralloc_cats(&dirplus, slash) || @@ -113,7 +117,7 @@ dirplusmake(char *slash) } void -linkdotdir(char *dash, char *slash) +linkdotdir(const char *dash, const char *slash) { if (!stralloc_copys(&dotplus, dot) || !stralloc_cats(&dotplus, dash) || @@ -301,7 +305,7 @@ main(int argc, char **argv) void getversion_replier_config_c() { - static char *x = "$Id: replier-config.c,v 1.7 2022-03-05 13:37:29+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: replier-config.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/replier.c b/indimail-mta-x/replier.c index 172a128eec..5f1328b16c 100644 --- a/indimail-mta-x/replier.c +++ b/indimail-mta-x/replier.c @@ -1,5 +1,8 @@ /* * $Log: replier.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2022-10-17 19:45:16+05:30 Cprogrammer * collapsed multiple stralloc lines * @@ -102,13 +105,13 @@ mywrite(int fd, char *buf, unsigned int len) } void -put(char *buf, int len) +put(const char *buf, int len) { qmail_put(&qq, buf, len); } void -myputs(char *buf) +myputs(const char *buf) { qmail_puts(&qq, buf); } @@ -128,7 +131,8 @@ main(int argc, char **argv) struct constmap headerremovemap; char inbuf[1024], outbuf[512], strnum[FMT_ULONG]; substdio ssin, ssout; - char *dir, *addr, *sender, *local, *action, *qqx; + char *dir, *addr, *sender, *local, *action; + const char *qqx; char **e; int flagmlwasthere, match, i, flaginheader, flagbadfield, pid, wstat, tmperrno; @@ -282,7 +286,7 @@ main(int argc, char **argv) void getversion_replier_c() { - static char *x = "$Id: replier.c,v 1.13 2022-10-17 19:45:16+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: replier.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/report.c b/indimail-mta-x/report.c index 5eabb8c59c..af044c6218 100644 --- a/indimail-mta-x/report.c +++ b/indimail-mta-x/report.c @@ -1,5 +1,8 @@ /* * $Log: report.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2024-02-07 22:58:37+05:30 Cprogrammer * modified error messages * @@ -69,7 +72,7 @@ extern dtype delivery; * 100 - Permanent failure */ no_return void -report(int errCode, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) +report(int errCode, const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6) { if (delivery == local_delivery) /*- strerr_die does not return */ strerr_die6x(errCode, s1, s2, s3, s4, s5, s6); @@ -122,7 +125,7 @@ report(int errCode, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) void getversion_report_c() { - static char *x = "$Id: report.c,v 1.7 2024-02-07 22:58:37+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: report.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidreporth; x = sccsidgetdomainth; diff --git a/indimail-mta-x/report.h b/indimail-mta-x/report.h index a0aef2a7ea..16a2cb6e97 100644 --- a/indimail-mta-x/report.h +++ b/indimail-mta-x/report.h @@ -1,5 +1,8 @@ /* * $Log: report.h,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2022-01-30 09:38:19+05:30 Cprogrammer * define report() as no_return * @@ -17,9 +20,9 @@ #define _REPORT_H #ifndef lint -static char sccsidreporth[] = "$Id: report.h,v 1.4 2022-01-30 09:38:19+05:30 Cprogrammer Exp mbhangui $"; +static const char sccsidreporth[] = "$Id: report.h,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif -no_return void report(int, char *, char *, char *, char *, char *, char *); +no_return void report(int, const char *, const char *, const char *, const char *, const char *, const char *); #endif diff --git a/indimail-mta-x/rewind.c b/indimail-mta-x/rewind.c index b2d669629e..4c5556d2bd 100644 --- a/indimail-mta-x/rewind.c +++ b/indimail-mta-x/rewind.c @@ -1,5 +1,8 @@ /* * $Log: rewind.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2004-10-22 20:29:59+05:30 Cprogrammer * added RCS id * @@ -21,7 +24,7 @@ main(void) void getversion_rewind_c() { - static char *x = "$Id: rewind.c,v 1.3 2004-10-22 20:29:59+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: rewind.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/rpmattr.c b/indimail-mta-x/rpmattr.c index e4a693f72c..8e577c3e26 100644 --- a/indimail-mta-x/rpmattr.c +++ b/indimail-mta-x/rpmattr.c @@ -1,5 +1,8 @@ /* * $Log: rpmattr.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-06-27 11:36:54+05:30 Cprogrammer * removed call to uidinit * @@ -122,6 +125,6 @@ main(int argc, char **argv) void getversion_rpmattr_c() { - static char *x = "$Id: rpmattr.c,v 1.7 2021-06-27 11:36:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: rpmattr.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/rrforward.c b/indimail-mta-x/rrforward.c index aeb162bf21..e5935dd1f0 100644 --- a/indimail-mta-x/rrforward.c +++ b/indimail-mta-x/rrforward.c @@ -1,5 +1,8 @@ /* * $Log: rrforward.c,v $ + * Revision 1.12 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.11 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -82,7 +85,7 @@ qqtwrite(int fd, char *buf, size_t len) no_return void rr_forward(char *rrto, char *sender, char *dtline, char *rrnum) { - char *qqx; + const char *qqx; char num[FMT_ULONG]; sig_pipeignore(); @@ -160,7 +163,7 @@ main(int argc, char **argv) void getversion_rrforward_c() { - static char *x = "$Id: rrforward.c,v 1.11 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: rrforward.c,v 1.12 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/rrt.c b/indimail-mta-x/rrt.c index 5ba30d38d2..c95579c2be 100644 --- a/indimail-mta-x/rrt.c +++ b/indimail-mta-x/rrt.c @@ -1,5 +1,8 @@ /* * $Log: rrt.c,v $ + * Revision 1.14 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.13 2024-01-23 01:23:26+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -78,10 +81,11 @@ #define USAGE_ERR 7 #define PARSE_ERR 8 +typedef const char c_char; static char ssoutbuf[BUFSIZE_OUT], sserrbuf[BUFSIZE_OUT], strnum[FMT_ULONG]; static substdio ssout = SUBSTDIO_FDBUF(write, 1, ssoutbuf, sizeof ssoutbuf); static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof(sserrbuf)); -static char *usage = "usage: rrt [-n][-b]\n"; +static c_char *usage = "usage: rrt [-n][-b]\n"; static struct qmail qqt; static int flagqueue = 1; static stralloc line = { 0 }; @@ -108,14 +112,14 @@ die_qqtemp() } void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit (WRITE_ERR); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit (WRITE_ERR); @@ -124,7 +128,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); logerr(": "); @@ -138,7 +142,7 @@ my_error(char *s1, char *s2, int exit_val) } void -my_puts(char *s) +my_puts(const char *s) { if (flagqueue) qmail_puts(&qqt, s); @@ -148,7 +152,7 @@ my_puts(char *s) } void -my_putb(char *s, int len) +my_putb(const char *s, int len) { if (flagqueue) qmail_put(&qqt, s, len); @@ -160,7 +164,7 @@ my_putb(char *s, int len) stralloc addr = { 0 }, rpath = {0}; int -addrparse(char *arg) +addrparse(const char *arg) { int i, flagesc, flagquoted; char ch, terminator; @@ -291,8 +295,9 @@ main(int argc, char **argv) struct substdio ssin; static char ssinbuf[1024]; char buf[DATE822FMT]; - char *rpline, *recipient, *qqx, *ptr, + char *rpline, *recipient, *ptr, *smtptext = 0, *qmtptext = 0; + const char *qqx; while ((ch = getopt(argc, argv, "nb")) != opteof) { switch (ch) @@ -500,7 +505,7 @@ main(int argc, char **argv) void getversion_rr_c() { - static char *x = "$Id: rrt.c,v 1.13 2024-01-23 01:23:26+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: rrt.c,v 1.14 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/run-cleanq.c b/indimail-mta-x/run-cleanq.c index 3842a15f3f..280a6a3199 100644 --- a/indimail-mta-x/run-cleanq.c +++ b/indimail-mta-x/run-cleanq.c @@ -1,5 +1,8 @@ /* * $Log: run-cleanq.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2020-10-09 17:31:18+05:30 Cprogrammer * use SERVICEDIR define for qscanq path * @@ -39,7 +42,7 @@ main() void getversion_run_cleanq_c() { - static char *x = "$Id: run-cleanq.c,v 1.6 2020-10-09 17:31:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: run-cleanq.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/rwhconfig.c b/indimail-mta-x/rwhconfig.c index d94e33a6da..6ca5b23651 100644 --- a/indimail-mta-x/rwhconfig.c +++ b/indimail-mta-x/rwhconfig.c @@ -1,5 +1,8 @@ /* * $Log: rwhconfig.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-06-12 19:30:49+05:30 Cprogrammer * removed #include "auto_qmail.h" * @@ -38,7 +41,7 @@ static config_str plusdomain = CONFIG_STR; static config_str idhost = CONFIG_STR; static int -my_config_read(config_str *c, char *fname, int line) +my_config_read(config_str *c, const char *fname, int line) { if (!controldir) { if (!(controldir = env_get("CONTROLDIR"))) @@ -129,7 +132,7 @@ rwhconfig(config_str *rewrite, stralloc *idappend) void getversion_rwhconfig_c() { - static char *x = "$Id: rwhconfig.c,v 1.6 2021-06-12 19:30:49+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: rwhconfig.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/send_qload.c b/indimail-mta-x/send_qload.c index 74dec10efc..795f4aff8c 100644 --- a/indimail-mta-x/send_qload.c +++ b/indimail-mta-x/send_qload.c @@ -1,5 +1,5 @@ /* - * $Id: send_qload.c,v 1.1 2022-04-24 08:48:22+05:30 Cprogrammer Exp mbhangui $ + * $Id: send_qload.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "haslibrt.h" #ifdef HASLIBRT @@ -11,7 +11,7 @@ #include "qscheduler.h" int -send_qload(char *queue_ident, unsigned int queue_no, +send_qload(const char *queue_ident, unsigned int queue_no, long load, unsigned int priority) { mqd_t mqd; @@ -38,13 +38,16 @@ send_qload(char *queue_ident, unsigned int queue_no, void getversion_send_qload_c() { - static char *x = "$Id: send_qload.c,v 1.1 2022-04-24 08:48:22+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: send_qload.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: send_qload.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-04-24 08:48:22+05:30 Cprogrammer * Initial revision * diff --git a/indimail-mta-x/send_qload.h b/indimail-mta-x/send_qload.h index 374b4b87ff..37291d3843 100644 --- a/indimail-mta-x/send_qload.h +++ b/indimail-mta-x/send_qload.h @@ -1,5 +1,8 @@ /* * $Log: send_qload.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-04-24 08:48:24+05:30 Cprogrammer * Initial revision * @@ -9,7 +12,7 @@ #include "haslibrt.h" #ifdef HASLIBRT -int send_qload(char *, unsigned int, long, unsigned int); +int send_qload(const char *, unsigned int, long, unsigned int); #endif #endif diff --git a/indimail-mta-x/sendmail.c b/indimail-mta-x/sendmail.c index ad29d5e5b3..d9ec3f1906 100644 --- a/indimail-mta-x/sendmail.c +++ b/indimail-mta-x/sendmail.c @@ -1,5 +1,8 @@ /* * $Log: sendmail.c,v $ + * Revision 1.16 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.15 2023-12-20 11:14:46+05:30 Cprogrammer * added -r option to set mailx return path * @@ -138,7 +141,7 @@ main(int argc, char **argv) { int opt, i, flagh; char **qiargv, **arg; - char *sender; + const char *sender; if (chdir("/") == -1) { substdio_putsflush(subfderr, "sendmail: fatal: unable to switch to root directory\n"); @@ -258,13 +261,13 @@ main(int argc, char **argv) if (!stralloc_catb(&q, "/bin/qmail-inject", 17) || !stralloc_0(&q)) nomem(); *arg++ = q.s; - *arg++ = (flagh ? "-H" : "-a"); + *arg++ = (char *) (flagh ? "-H" : "-a"); if (sender) { - *arg++ = "-f"; - *arg++ = sender; + *arg++ = (char *) "-f"; + *arg++ = (char *) sender; do_sender(sender); } - *arg++ = "--"; + *arg++ = (char *) "--"; for (i = 0; i < argc; ++i) *arg++ = argv[i]; *arg = 0; @@ -278,7 +281,7 @@ main(int argc, char **argv) void getversion_sendmail_c() { - static char *x = "$Id: sendmail.c,v 1.15 2023-12-20 11:14:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sendmail.c,v 1.16 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/serialcmd.c b/indimail-mta-x/serialcmd.c index ce3d68ec83..fdd0f73489 100644 --- a/indimail-mta-x/serialcmd.c +++ b/indimail-mta-x/serialcmd.c @@ -1,5 +1,5 @@ /* - * $Id: serialcmd.c,v 1.8 2023-03-26 08:23:01+05:30 Cprogrammer Exp mbhangui $ + * $Id: serialcmd.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * serialcmd -- apply a command to a mail message. * Copyright 1999, Len Budney @@ -397,8 +397,8 @@ doit(int fd, char **argv, stralloc *fnam) /* * Run the command now. */ - argv[0] = "/bin/sh"; - argv[1] = "-c"; + argv[0] = (char *) "/bin/sh"; + argv[1] = (char *) "-c"; runcmd(argv, fd, fnam); } @@ -427,6 +427,9 @@ main(int argc, char *argv[]) /* * $Log: serialcmd.c,v $ + * Revision 1.9 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2023-03-26 08:23:01+05:30 Cprogrammer * fixed code for wait_handler * @@ -456,7 +459,7 @@ main(int argc, char *argv[]) void getversion_serialcmd_c() { - static char *x = "$Id: serialcmd.c,v 1.8 2023-03-26 08:23:01+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: serialcmd.c,v 1.9 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/serialqmtp.c b/indimail-mta-x/serialqmtp.c index 5593332c09..5766ca2681 100644 --- a/indimail-mta-x/serialqmtp.c +++ b/indimail-mta-x/serialqmtp.c @@ -1,5 +1,5 @@ /* - * $Id: serialqmtp.c,v 1.9 2023-10-05 22:29:58+05:30 Cprogrammer Exp mbhangui $ + * $Id: serialqmtp.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -295,13 +295,16 @@ main(int argc, char **argv) void getversion_serialqmtp_c() { - static char *x = "$Id: serialqmtp.c,v 1.9 2023-10-05 22:29:58+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: serialqmtp.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: serialqmtp.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-10-05 22:29:58+05:30 Cprogrammer * updated coding style * diff --git a/indimail-mta-x/serialsmtp.c b/indimail-mta-x/serialsmtp.c index a3b8872d40..94e9d32515 100644 --- a/indimail-mta-x/serialsmtp.c +++ b/indimail-mta-x/serialsmtp.c @@ -1,5 +1,5 @@ /* - * $Id: serialsmtp.c,v 1.10 2023-12-09 11:55:44+05:30 Cprogrammer Exp mbhangui $ + * $Id: serialsmtp.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -382,13 +382,16 @@ main(int argc, char **argv) void getversion_serialsmtp_c() { - static char *x = "$Id: serialsmtp.c,v 1.10 2023-12-09 11:55:44+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: serialsmtp.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: serialsmtp.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-12-09 11:55:44+05:30 Cprogrammer * fix skip SMTP QUIT when three args are provided * diff --git a/indimail-mta-x/set_environment.c b/indimail-mta-x/set_environment.c index 96a0000d6e..cf3f3197e7 100644 --- a/indimail-mta-x/set_environment.c +++ b/indimail-mta-x/set_environment.c @@ -1,5 +1,8 @@ /* * $Log: set_environment.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-05-31 12:06:05+05:30 Cprogrammer * skip local env variable processing of .defaultqueue if SKIP_LOCAL_ENVIRONMENT is set * @@ -41,9 +44,9 @@ static stralloc tmp = { 0 }; void -set_environment(char *warn, char *fatal, int root_rc) +set_environment(const char *warn, const char *fatal, int root_rc) { - char *qbase, *home, *err; + const char *qbase, *home, *err; char **e; int i, unreadable = 0; @@ -91,7 +94,7 @@ set_environment(char *warn, char *fatal, int root_rc) void getversion_set_environment_c() { - static char *x = "$Id: set_environment.c,v 1.9 2023-05-31 12:06:05+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: set_environment.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/set_environment.h b/indimail-mta-x/set_environment.h index 3d74bece7f..9509db85b3 100644 --- a/indimail-mta-x/set_environment.h +++ b/indimail-mta-x/set_environment.h @@ -1,5 +1,8 @@ /* * $Log: set_environment.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-07-05 21:19:04+05:30 Cprogrammer * new argument root_rc to allow root to load $HOME/.defaultqueue * @@ -10,6 +13,6 @@ #ifndef SET_ENVIRONMENT_H #define SET_ENVIRONMENT_H -void set_environment(char *, char *, int); +void set_environment(const char *, const char *, int); #endif diff --git a/indimail-mta-x/set_queuedir.c b/indimail-mta-x/set_queuedir.c index c7c697ec0f..e66d7fea8e 100644 --- a/indimail-mta-x/set_queuedir.c +++ b/indimail-mta-x/set_queuedir.c @@ -1,5 +1,8 @@ /* * $Log: set_queuedir.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-04-04 00:10:31+05:30 Cprogrammer * Initial revision * @@ -10,8 +13,8 @@ #include "auto_qmail.h" #include "control.h" -char * -set_queuedir(char *argv0, char *queue) +const char * +set_queuedir(const char *argv0, const char *queue) { char *qbase; static stralloc QueueDir = { 0 }; @@ -48,7 +51,7 @@ set_queuedir(char *argv0, char *queue) void getversion_set_queuedir_c() { - static char *x = "$Id: set_queuedir.c,v 1.1 2022-04-04 00:10:31+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: set_queuedir.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/set_queuedir.h b/indimail-mta-x/set_queuedir.h index 9090cc1417..154839d6aa 100644 --- a/indimail-mta-x/set_queuedir.h +++ b/indimail-mta-x/set_queuedir.h @@ -1,5 +1,8 @@ /* * $Log: set_queuedir.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2022-04-04 00:10:32+05:30 Cprogrammer * Initial revision * @@ -7,6 +10,6 @@ #ifndef _SET_QUEUEDIR_H #define _SET_QUEUEDIR_H -char *set_queuedir(char *, char *); +const char *set_queuedir(const char *, const char *); #endif diff --git a/indimail-mta-x/setforward.c b/indimail-mta-x/setforward.c index 2460783331..1d2827ed2a 100644 --- a/indimail-mta-x/setforward.c +++ b/indimail-mta-x/setforward.c @@ -1,5 +1,8 @@ /* * $Log: setforward.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -95,7 +98,7 @@ writeerr() } void -doit(char *prepend, char *data, int datalen) +doit(const char *prepend, const char *data, int datalen) { if (!stralloc_copys(&key, prepend)) nomem(); @@ -107,8 +110,7 @@ doit(char *prepend, char *data, int datalen) } int -getch(ch) - char *ch; +getch(char *ch) { int r; @@ -118,9 +120,7 @@ getch(ch) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char ch; @@ -223,7 +223,7 @@ main(argc, argv) void getversion_setforward_c() { - static char *x = "$Id: setforward.c,v 1.6 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: setforward.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/setmaillist.c b/indimail-mta-x/setmaillist.c index 10e4d2801c..9bbca8a6dd 100644 --- a/indimail-mta-x/setmaillist.c +++ b/indimail-mta-x/setmaillist.c @@ -1,5 +1,8 @@ /* * $Log: setmaillist.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -35,13 +38,13 @@ usage() } no_return void -writeerr(char *s) +writeerr(const char *s) { strerr_die4sys(111, FATAL, "unable to write to ", s, ": "); } void -out(substdio *ss, char *s, int len, char *fntmp) +out(substdio *ss, const char *s, int len, char *fntmp) { if (substdio_put(ss, s, len) == -1) writeerr(fntmp); @@ -106,7 +109,7 @@ main(int argc, char **argv) void getversion_setmaillist_c() { - static char *x = "$Id: setmaillist.c,v 1.4 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: setmaillist.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/setqload.c b/indimail-mta-x/setqload.c index add239929d..34ec9a7bdd 100644 --- a/indimail-mta-x/setqload.c +++ b/indimail-mta-x/setqload.c @@ -1,5 +1,8 @@ /* * $Log: setqload.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2022-08-14 21:58:24+05:30 Cprogrammer * fix compilation warning if HASLIBRT is undefined * @@ -30,9 +33,9 @@ #define FATAL "setqload: fatal: " #define WARN "setqload: warn: " -char *usage1 = "-q queue_number total"; -char *usage2 = "-q queue_number lcur/lmax rcur/rmax"; -char *desc = +const char *usage1 = "-q queue_number total"; +const char *usage2 = "-q queue_number lcur/lmax rcur/rmax"; +const char *desc = "\n\nwhere\n" " total = lcur/lmax + rcur/rmax\n" " lcur = cur local concurrency\n" @@ -53,7 +56,7 @@ get_queue_details(int *q) } int -compute_expression(struct vartable *vt, char *s, double *x) +compute_expression(struct vartable *vt, const char *s, double *x) { struct val result; @@ -166,7 +169,7 @@ main(argc, argv) void getversion_setqload_c() { - static char *x = "$Id: setqload.c,v 1.3 2022-08-14 21:58:24+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: setqload.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #ifdef HASLIBRT x = sccsidevalh; diff --git a/indimail-mta-x/slowq-send.c b/indimail-mta-x/slowq-send.c index db22a953e3..2b3cbd8987 100644 --- a/indimail-mta-x/slowq-send.c +++ b/indimail-mta-x/slowq-send.c @@ -1,5 +1,5 @@ /* - * $Id: slowq-send.c,v 1.38 2024-02-08 20:48:20+05:30 Cprogrammer Exp mbhangui $ + * $Id: slowq-send.c,v 1.39 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -68,6 +68,7 @@ #endif #define CHUNK_SIZE 1 +typedef const char c_char; static int lifetime = 604800; static int bouncemaxbytes = 50000; #ifdef BOUNCELIFETIME @@ -98,23 +99,23 @@ static char strnum1[FMT_ULONG]; static char strnum2[FMT_ULONG]; #define CHANNELS 2 -static char *chanaddr[CHANNELS] = { "local/", "remote/" }; -static char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; -static char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanaddr[CHANNELS] = { "local/", "remote/" }; +static c_char *chanstatusmsg[CHANNELS] = { " local ", " remote " }; +static c_char *chanjobsheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries temporarily held\n", "remote deliveries temporarily held\n" }; -static char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ +static c_char *chanjobsunheldmsg[CHANNELS] = { /* NJL 1998/05/03 */ "local deliveries resumed\n", "remote deliveries resumed\n" }; -static char *tochan[CHANNELS] = { " to local ", " to remote " }; +static c_char *tochan[CHANNELS] = { " to local ", " to remote " }; static int chanfdout[CHANNELS] = { 1, 3 }; static int chanfdin[CHANNELS] = { 2, 4 }; static int chanskip[CHANNELS] = { 10, 20 }; -char *queuedesc; -static char *argv0 = "slowq-send"; +const char *queuedesc; +static char *argv0 = (char *) "slowq-send"; static int flagexitsend; /*- slowq-send: exit when set */ static int flagexittodo; /*- todo-processor: exit when set */ @@ -155,7 +156,7 @@ static void sigusr2(); void #ifdef HAVE_STDARG_H -todo_log(char *s1, ...) +todo_log(const char *s1, ...) #else todo_log(va_alist) va_dcl @@ -163,16 +164,16 @@ va_dcl { int pos; va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H - char *s1; + const char *s1; #endif #ifdef HAVE_STDARG_H va_start(ap, s1); #else va_start(ap); - s1 = va_arg(ap, char *); + s1 = va_arg(ap, const char *); #endif pos = comm_buf_todo.len; @@ -181,7 +182,7 @@ va_dcl goto fail; while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; if (!stralloc_cats(&comm_buf_todo, str)) @@ -561,7 +562,7 @@ void comm_write_todo(unsigned long id, int local, int remote) { int pos; - char *s; + const char *s; if (flagdetached) return; @@ -1175,11 +1176,11 @@ job_close(int j) /*- this file is too long ------------------------------------------- BOUNCES */ /*- strip the virtual domain which is prepended to addresses e.g. xxx.com-user01@xxx.com */ -static char * -stripvdomprepend(char *recip) +static const char * +stripvdomprepend(const char *recip) { unsigned int i, domainlen; - char *domain, *prepend; + const char *domain, *prepend; i = str_rchr(recip, '@'); if (!recip[i]) @@ -1260,8 +1261,9 @@ addbounce(unsigned long id, char *recip, char *report) } static int -bounce_processor(struct qmail *qq, char *messfn, char *bouncefn, char *bounce_report, char *origrecip, char *sender, - char *recipient) +bounce_processor(struct qmail *qq, const char *messfn, const char *bouncefn, + const char *bounce_report, const char *origrecip, const char *sender, + const char *recipient) { char *prog, *(args[8]); int i, child, wstat; @@ -1277,12 +1279,12 @@ bounce_processor(struct qmail *qq, char *messfn, char *bouncefn, char *bounce_re return (111); case 0: args[0] = prog; - args[1] = messfn; /*- message filename */ - args[2] = bouncefn; /*- bounce message filename */ - args[3] = bounce_report; /*- bounce report */ - args[4] = sender; /*- bounce sender */ - args[5] = origrecip; /*- original recipient */ - args[6] = recipient; /*- original sender */ + args[1] = (char *) messfn; /*- message filename */ + args[2] = (char *) bouncefn; /*- bounce message filename */ + args[3] = (char *) bounce_report; /*- bounce report */ + args[4] = (char *) sender; /*- bounce sender */ + args[5] = (char *) origrecip; /*- original recipient */ + args[6] = (char *) recipient; /*- original sender */ args[7] = 0; execv(*args, args); slog(1, "alert: ", argv0, ": ", queuedesc, ": Unable to run: ", prog, ": ", @@ -1315,7 +1317,8 @@ injectbounce(unsigned long id) datetime_sec birth; substdio ssread; char buf[128], inbuf[128]; - char *bouncesender, *bouncerecip = "", *brep = "?", *p; + const char *bouncesender, *bouncerecip = ""; + char *brep = (char *) "?", *p; int r = -1, fd, ret; unsigned long qp; #ifdef MIME @@ -2238,7 +2241,7 @@ static int rewrite(char *recip) { unsigned int i, j, at; - char *x; + const char *x; static stralloc addr = { 0 }; if (!stralloc_copys(&rwline, "T") @@ -2921,8 +2924,7 @@ todo_scan(int *nfds, fd_set *rfds, unsigned long *id, int mq_flag) void log_stat_todo(unsigned long id, size_t bytes) { - char *ptr; - char *mode; + const char *ptr, *mode; strnum1[fmt_ulong(strnum1 + 1, id) + 1] = 0; strnum2[fmt_ulong(strnum2 + 1, bytes) + 1] = 0; @@ -3810,7 +3812,7 @@ main(int argc, char **argv) void getversion_slowq_send_c() { - static char *x = "$Id: slowq-send.c,v 1.38 2024-02-08 20:48:20+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: slowq-send.c,v 1.39 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsiddelivery_rateh; x = sccsidgetdomainth; @@ -3820,6 +3822,9 @@ getversion_slowq_send_c() /* * $Log: slowq-send.c,v $ + * Revision 1.39 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.38 2024-02-08 20:48:20+05:30 Cprogrammer * fixed multiplication result converted to larger type (codeql) * diff --git a/indimail-mta-x/slowq-start.c b/indimail-mta-x/slowq-start.c index a7727ff5cc..f97d7beda4 100644 --- a/indimail-mta-x/slowq-start.c +++ b/indimail-mta-x/slowq-start.c @@ -1,5 +1,8 @@ /* * $Log: slowq-start.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2022-04-04 00:52:04+05:30 Cprogrammer * Use QUEUE_BASE, queue_base control for setting base directory of queue * @@ -51,7 +54,7 @@ die() * return 0 if user is not present in the list */ int -check_user(char *userlist, char *user) +check_user(char *userlist, const char *user) { char *ptr1, *ptr2; @@ -113,13 +116,14 @@ closepipes() int main(int argc, char **argv) { - char *set_supplementary_groups, *ptr; + char *set_supplementary_groups; + const char *ptr; gid_t *gidset; int ngroups; - char *(qsargs[]) = { "slowq-send", 0, 0}; - char *(qcargs[]) = { "qmail-clean", 0, 0, 0}; - char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0, 0}; - char *(qrargs[]) = { "qmail-rspawn", 0, 0}; + const char *(qsargs[]) = { "slowq-send", 0, 0}; + const char *(qcargs[]) = { "qmail-clean", 0, 0, 0}; + const char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0, 0}; + const char *(qrargs[]) = { "qmail-rspawn", 0, 0}; set_supplementary_groups = env_get("USE_SETGROUPS"); if (chdir("/") == -1) @@ -211,7 +215,7 @@ main(int argc, char **argv) die(); close23456(); closepipes(); - execvp(*qlargs, qlargs); /*- qmail-lspawn */ + execvp(*qlargs, (char **) qlargs); /*- qmail-lspawn */ die(); } switch (fork()) @@ -235,7 +239,7 @@ main(int argc, char **argv) die(); close23456(); closepipes(); - execvp(*qrargs, qrargs); /*- qmail-rspawn */ + execvp(*qrargs, (char **) qrargs); /*- qmail-rspawn */ die(); } switch (fork()) @@ -260,7 +264,7 @@ main(int argc, char **argv) close23456(); closepipes(); qcargs[2] = "slowq-send"; /*- pass qmail-send as argument for the ps command */ - execvp(*qcargs, qcargs); /*- qmail-clean */ + execvp(*qcargs, (char **) qcargs); /*- qmail-clean */ die(); } if (check_user(set_supplementary_groups, "qmails")) { @@ -288,7 +292,7 @@ main(int argc, char **argv) if (fd_copy(6, pi6[0]) == -1) die(); closepipes(); - execvp(*qsargs, qsargs); /*- slowq-send */ + execvp(*qsargs, (char **) qsargs); /*- slowq-send */ die(); /*- Not reached */ return(0); @@ -297,7 +301,7 @@ main(int argc, char **argv) void getversion_slowq_start_c() { - static char *x = "$Id: slowq-start.c,v 1.7 2022-04-04 00:52:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: slowq-start.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/slurpclose.c b/indimail-mta-x/slurpclose.c index e02a0ea854..f53aa902ff 100644 --- a/indimail-mta-x/slurpclose.c +++ b/indimail-mta-x/slurpclose.c @@ -1,5 +1,8 @@ /* * $Log: slurpclose.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2004-10-22 20:30:28+05:30 Cprogrammer * added RCS id * @@ -45,7 +48,7 @@ slurpclose(fd, sa, bufsize) void getversion_slurpclose_c() { - static char *x = "$Id: slurpclose.c,v 1.5 2004-10-22 20:30:28+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: slurpclose.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/smtp_plugin.c b/indimail-mta-x/smtp_plugin.c index d1625a0d1e..7cf13e1362 100644 --- a/indimail-mta-x/smtp_plugin.c +++ b/indimail-mta-x/smtp_plugin.c @@ -1,5 +1,8 @@ /* * $Log: smtp_plugin.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2011-07-08 13:49:10+05:30 Cprogrammer * define stubs as static * @@ -20,21 +23,21 @@ */ static int -from_plug_1(char *remoteip, char *from, char **mesg) +from_plug_1(const char *remoteip, const char *from, char **mesg) { *mesg = "530 denied by plugin (#5.7.1)\r\n"; return (0); } static int -rcpt_plug_1(char *remoteip, char *from, char *rcpt, char **mesg) +rcpt_plug_1(const char *remoteip, const char *from, const char *rcpt, char **mesg) { *mesg = "530 denied by plugin (#5.7.1)\r\n"; return (0); } static int -data_plug_1(char *local, char *remoteip, char *remotehost, char *remoteinfo, char **mesg) +data_plug_1(const char *local, const char *remoteip, const char *remotehost, const char *remoteinfo, char **mesg) { *mesg = "530 denied by plugin (#5.7.1)\r\n"; return (0); diff --git a/indimail-mta-x/smtp_plugin.h b/indimail-mta-x/smtp_plugin.h index 5efc307b71..fe11bc50cb 100644 --- a/indimail-mta-x/smtp_plugin.h +++ b/indimail-mta-x/smtp_plugin.h @@ -1,5 +1,8 @@ /* * $Log: smtp_plugin.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2011-04-13 20:44:52+05:30 Cprogrammer * added data function * @@ -11,9 +14,9 @@ #define SMTP_PLUGIN_H typedef struct { - int (*mail_func) (char *, char *, char **); - int (*rcpt_func) (char *, char *, char *, char **); - int (*data_func) (char *, char *, char *, char *, char **); + int (*mail_func) (const char *, const char *, char **); + int (*rcpt_func) (const char *, const char *, const char *, char **); + int (*data_func) (const char *, const char *, const char *, const char *, char **); } PLUGIN; #endif diff --git a/indimail-mta-x/smtpd.c b/indimail-mta-x/smtpd.c index 26f9d93ad8..41bcd1169c 100644 --- a/indimail-mta-x/smtpd.c +++ b/indimail-mta-x/smtpd.c @@ -1,6 +1,6 @@ /* * RCS log at bottom - * $Id: smtpd.c,v 1.323 2024-02-23 21:39:32+05:30 Cprogrammer Exp mbhangui $ + * $Id: smtpd.c,v 1.324 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -140,16 +140,17 @@ static int err_noauth(); static int err_noauthallowed(); #endif static int addrrelay(); -int atrn_queue(char *, char *); +int atrn_queue(const char *, const char *); no_return void _exit(int status); typedef struct passwd PASSWD; typedef unsigned int my_uint; typedef unsigned long my_ulong; typedef struct constmap CONSTMAP; +typedef const char c_char; #ifdef TLS static int secure_auth = 0; -static char *servercert, *clientca, *clientcrl; +static c_char *servercert, *clientca, *clientcrl; static stralloc ssl_option = {0}, certfile = {0}, cafile = {0}, crlfile = {0}, saciphers = {0}; static char *ciphers; static int smtps = 0; @@ -157,8 +158,8 @@ static SSL *ssl = NULL; static struct strerr *se; #endif static int tr_success = 0; -static char *revision = "$Revision: 1.323 $"; -static char *protocol = "SMTP"; +static c_char *revision = "$Revision: 1.324 $"; +static c_char *protocol = "SMTP"; static stralloc proto = { 0 }; static stralloc Revision = { 0 }; static stralloc greeting = { 0 }; @@ -195,7 +196,7 @@ static stralloc libfn = { 0 }; #ifdef BATV static stralloc batvkey = { 0 }; -static char *batvFn = NULL; +static c_char *batvFn = NULL; static int batvok; static int batvkeystale = 7; /*- accept batvkey for a week */ static int batvkeystaleok; @@ -210,11 +211,11 @@ static char isbounce; static char strnum[FMT_ULONG]; static char accept_buf[FMT_ULONG]; -char *localhost; -static char *remoteip, *remotehost, *remoteinfo, *relayclient, *nodnscheck, *fakehelo; -static char *hostname, *bouncemail, *requireauth, *localip, *greyip; +const char *localhost; +static c_char *remoteip, *remotehost, *remoteinfo, *relayclient, *nodnscheck, *fakehelo; +static c_char *hostname, *bouncemail, *requireauth, *localip, *greyip; #ifdef IPV6 -static char *remoteip4; +static c_char *remoteip4; #endif static char **childargs; @@ -251,7 +252,7 @@ struct qmail qqt; static int greetdelay = 0; static int greetdelayok; -static char *errStr = 0; +static c_char *errStr = 0; /*- badmailfrom */ static int bmfok = 0; @@ -259,8 +260,8 @@ static stralloc bmf = { 0 }; static CONSTMAP mapbmf; static int bmpok = 0; static stralloc bmp = { 0 }; -static char *bmfFn = NULL; -static char *bmfFnp = NULL; +static c_char *bmfFn = NULL; +static c_char *bmfFnp = NULL; /*- badrcptto */ static int rcpok = 0; @@ -268,8 +269,8 @@ static stralloc rcp = { 0 }; static CONSTMAP maprcp; static int brpok = 0; static stralloc brp = { 0 }; -static char *rcpFn = NULL; -static char *rcpFnp = NULL; +static c_char *rcpFn = NULL; +static c_char *rcpFnp = NULL; /*- goodrcptto */ static int gdrcptok = 0; @@ -277,31 +278,31 @@ static stralloc gdrcpt = { 0 }; static CONSTMAP mapgdrcpt; static int gdrcptpok = 0; static stralloc gdrcptp = { 0 }; -static char *gdrcptFn = NULL; -static char *gdrcptFnp = NULL; +static c_char *gdrcptFn = NULL; +static c_char *gdrcptFnp = NULL; /*- blackholedsender */ static int bhsndrok = 0; static stralloc bhsndr = { 0 }; static CONSTMAP mapbhsndr; -static char *bhsndFn = NULL; +static c_char *bhsndFn = NULL; /*- blackholedrcpt */ static int bhrcptok = 0; static stralloc bhrcpt = { 0 }; static CONSTMAP mapbhrcpt; -static char *bhrcptFn = NULL; +static c_char *bhrcptFn = NULL; /*- spamignore */ static int spsndrok = 0; static stralloc spsndr = { 0 }; static CONSTMAP mapspsndr; -static char *spsndrFn = NULL; +static c_char *spsndrFn = NULL; /*- accesslist */ static int acclistok = 0; static stralloc acclist = { 0 }; -static char *accFn = NULL; +static c_char *accFn = NULL; /*- RELAYCLIENT Check Variables */ static int relayclientsok = 0; @@ -322,26 +323,26 @@ static CONSTMAP maprmf; static int nodnschecksok = 0; static stralloc nodnschecks = { 0 }; static CONSTMAP mapnodnschecks; -static char *nodnsFn = NULL; +static c_char *nodnsFn = NULL; /*- badip Check */ -static char *dobadipcheck = NULL; -static char *badipFn = NULL; +static c_char *dobadipcheck = NULL; +static c_char *badipFn = NULL; static int briok = 0; static stralloc bri = { 0 }; static stralloc ipaddr = { 0 }; static CONSTMAP mapbri; /*- badhost Check */ -static char *badhostFn = NULL; -static char *dobadhostcheck = NULL; +static c_char *badhostFn = NULL; +static c_char *dobadhostcheck = NULL; static int brhok = 0; static stralloc brh = { 0 }; static CONSTMAP mapbrh; /*- Helo Check */ -static char *dohelocheck = NULL; -static char *badheloFn = NULL; +static c_char *dohelocheck = NULL; +static c_char *badheloFn = NULL; static int badhelook = 0; static stralloc badhelo = { 0 }; static CONSTMAP maphelo; @@ -373,7 +374,7 @@ static int maxrcptcountok; /*- Russel Nelson's Virus signature */ static int sigsok = 0; -static char *sigsFn = 0; +static c_char *sigsFn = 0; static int sigsok_orig = 0; static stralloc sigs = { 0 }; @@ -381,13 +382,13 @@ static stralloc sigs = { 0 }; static int atrnaccok = 0; static stralloc atrnaccess = { 0 }; -static char *virus_desc; +static c_char *virus_desc; static int bodyok = 0; static int bodyok_orig = 0; static stralloc body = { 0 }; -static char *bodyFn = NULL; -static char *content_desc; +static c_char *bodyFn = NULL; +static c_char *content_desc; #ifdef SMTP_PLUGIN PLUGIN **plug = (PLUGIN **) 0; void **plughandle; @@ -398,7 +399,7 @@ static int old_client_bug = 0; static int convertbarelf; struct authcmd { - char *text; + const char *text; int (*fun) (); } authcmds[] = { {"login", auth_login}, @@ -426,7 +427,7 @@ struct authcmd { /*- misc */ static stralloc sa = { 0 }; -static stralloc domBuf = { 0 }; +static stralloc tmpBuf = { 0 }; #ifdef SMTPUTF8 static int smtputf8 = 0, smtputf8_enable = 0; #endif @@ -456,7 +457,7 @@ va_dcl { int i; va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H int what; #endif @@ -488,7 +489,7 @@ va_dcl break; } while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; if (substdio_puts(&sserr, str) == -1) @@ -506,15 +507,15 @@ logflush() void #ifdef HAVE_STDARG_H -out(char *s1, ...) +out(const char *s1, ...) #else out(va_alist) #endif { va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H - char *s1; + const char *s1; #endif #ifdef HAVE_STDARG_H @@ -552,7 +553,7 @@ flush_io() } no_return void -die_read(char *str, int flag) +die_read(const char *str, int flag) { logerr(1, tr_success ? "read error after mail queue" : "read error", NULL); if (str) @@ -590,7 +591,7 @@ die_read(char *str, int flag) } no_return void -die_write(char *str, int flag) +die_write(const char *str, int flag) { static int i; @@ -702,7 +703,7 @@ safewrite(int fd, char *buf, int len) } no_return void -die_nohelofqdn(char *arg) +die_nohelofqdn(const char *arg) { logerr(1, "non-FQDN HELO: ", arg, "\n", NULL); logflush(); @@ -712,7 +713,7 @@ die_nohelofqdn(char *arg) } void -err_localhelo(char *l, char *lip, char *arg) +err_localhelo(const char *l, const char *lip, const char *arg) { logerr(1, "invalid HELO greeting: HELO <", arg, "> for local ", l, ", ", lip, "\n", NULL); out("451 invalid HELO greeting for local (#4.3.0)\r\n", NULL); @@ -721,7 +722,7 @@ err_localhelo(char *l, char *lip, char *arg) } void -err_badhelo(char *arg1, char *arg2) +err_badhelo(const char *arg1, const char *arg2) { logerr(1, "Invalid HELO greeting: HELO <", arg1, "> FQDN <", arg2, ">\n", NULL); logflush(); @@ -785,7 +786,7 @@ die_nomem() } no_return void -die_custom(char *arg) +die_custom(const char *arg) { logerr(1, arg, "\n", NULL); logflush(); @@ -796,7 +797,7 @@ die_custom(char *arg) #ifdef BATV void -err_batv(char *arg1, char *arg2, char *arg3) +err_batv(const char *arg1, const char *arg2, const char *arg3) { logerr(1, arg1, NULL); if (arg2) @@ -810,7 +811,7 @@ err_batv(char *arg1, char *arg2, char *arg3) #endif no_return void -die_control(char *fn) +die_control(const char *fn) { logerr(1, "unable to read controls", NULL); if (fn) @@ -832,7 +833,7 @@ die_ipme() } no_return void -die_plugin(char *arg1, char *arg2, char *arg3, char *arg4) +die_plugin(const char *arg1, const char *arg2, const char *arg3, const char *arg4) { logerr(1, ": ", NULL); out("451 ", NULL); @@ -870,7 +871,7 @@ die_logfilter() } void -err_addressmatch(char *errstr, char *fn) +err_addressmatch(const char *errstr, const char *fn) { logerr(1, "address_match: ", fn, ": ", errstr, "\n", NULL); logflush(); @@ -889,7 +890,7 @@ straynewline() } int -addrallowed(char *rcpt) +addrallowed(const char *rcpt) { int r; @@ -903,7 +904,7 @@ addrallowed(char *rcpt) } void -log_fifo(char *arg1, char *arg2, unsigned long size, stralloc *line) +log_fifo(const char *arg1, const char *arg2, unsigned long size, stralloc *line) { int logfifo, match; char *fifo_name; @@ -987,9 +988,10 @@ log_fifo(char *arg1, char *arg2, unsigned long size, stralloc *line) } void -log_trans(char *mfrom, char *recipients, int rcpt_len, char *authuser, int notify) +log_trans(const char *mfrom, const char *recipients, int rcpt_len, const char *authuser, int notify) { - char *ptr, *p; + const char *ptr; + char *p; int idx, i; static stralloc tmpLine = { 0 }; @@ -1030,8 +1032,8 @@ log_trans(char *mfrom, char *recipients, int rcpt_len, char *authuser, int notif if (!(p = env_get("TLS_PROVIDER"))) logerr(0, "No", NULL); else { - i = str_chr(p, ','); - if (p[i]) { + i = str_chr(p, ','); + if (p[i]) { p[i] = 0; logerr(0, p, NULL); p[i] = ','; @@ -1042,8 +1044,8 @@ log_trans(char *mfrom, char *recipients, int rcpt_len, char *authuser, int notif if (!(p = env_get("TLS_PROVIDER"))) logerr(0, "No", NULL); else { - i = str_chr(p, ','); - if (p[i]) { + i = str_chr(p, ','); + if (p[i]) { p[i] = 0; logerr(0, p, NULL); p[i] = ','; @@ -1060,9 +1062,11 @@ log_trans(char *mfrom, char *recipients, int rcpt_len, char *authuser, int notif } void -err_queue(char *mfrom, char *recipients, int rcpt_len, char *authuser, char *qqx, int permanent, unsigned long qp) +err_queue(const char *mfrom, const char *recipients, int rcpt_len, + const char *authuser, const char *qqx, int permanent, unsigned long qp) { - char *ptr, *p; + const char *ptr; + char *p; int idx, i; char size[FMT_ULONG]; static stralloc tmpLine = { 0 }; @@ -1100,8 +1104,8 @@ err_queue(char *mfrom, char *recipients, int rcpt_len, char *authuser, char *qqx if (!(p = env_get("TLS_PROVIDER"))) logerr(0, "No", NULL); else { - i = str_chr(p, ','); - if (p[i]) { + i = str_chr(p, ','); + if (p[i]) { p[i] = 0; logerr(0, p, NULL); p[i] = ','; @@ -1112,8 +1116,8 @@ err_queue(char *mfrom, char *recipients, int rcpt_len, char *authuser, char *qqx if (!(p = env_get("TLS_PROVIDER"))) logerr(0, "No", NULL); else { - i = str_chr(p, ','); - if (p[i]) { + i = str_chr(p, ','); + if (p[i]) { p[i] = 0; logerr(0, p, NULL); p[i] = ','; @@ -1131,7 +1135,7 @@ void msg_notify() { unsigned long qp; - char *qqx; + const char *qqx; char buf[DATE822FMT]; struct datetime dt; @@ -1209,7 +1213,7 @@ err_hops() } void -err_hmf(char *arg1, int arg2) +err_hmf(const char *arg1, int arg2) { if (arg2) logerr(1, "Non-existing DNS_MX: MAIL ", NULL); @@ -1302,7 +1306,7 @@ err_spf() #endif void -err_hostaccess(char *arg) +err_hostaccess(const char *arg) { logerr(1, "Invalid SENDER host IP address: MAIL from <", arg, ">\n", NULL); logflush(); @@ -1311,10 +1315,10 @@ err_hostaccess(char *arg) } void -log_virus(char *arg1, char *arg2, char *arg3, int len, int blackhole) +log_virus(const char *arg1, const char *arg2, const char *arg3, int len, int blackhole) { int idx; - char *ptr; + const char *ptr; for (ptr = arg3 + 1, idx = 0; idx < len; idx++) { if (!arg3[idx]) { @@ -1363,7 +1367,7 @@ smtp_badip() } void -smtp_badhost(char *arg) +smtp_badhost(const char *arg) { logerr(1, "BAD HOST ", remotehost, "\n", NULL); logflush(); @@ -1423,7 +1427,7 @@ smtp_ptr() } void -log_rules(char *arg1, char *arg2, int arg3, int arg4) +log_rules(const char *arg1, const char *arg2, int arg3, int arg4) { strnum[fmt_ulong(strnum, arg3)] = 0; logerr(1, arg4 == 0 ? "Setting EnvRule No " : "Setting DomainQueue Rule No ", strnum, ": MAIL from <", arg1, NULL); @@ -1441,7 +1445,7 @@ err_relay() } void -err_unimpl(char *arg) +err_unimpl(const char *arg) { if (!case_diffs(arg, "unimplemented")) out("502 unimplemented (#5.5.1)\r\n", NULL); @@ -1475,7 +1479,7 @@ err_wantrcpt() } void -err_bhsndr(char *arg1) +err_bhsndr(const char *arg1) { logerr(1, "Blackholed SENDER address: MAIL ", arg1, "\n", NULL); logflush(); @@ -1484,7 +1488,7 @@ err_bhsndr(char *arg1) } void -err_bhrcpt(char *arg2, char *arg3) +err_bhrcpt(const char *arg2, const char *arg3) { logerr(1, "Blackholed RECIPIENT address: MAIL from <", arg2, "> RCPT ", arg3, "\n", NULL); logflush(); @@ -1493,7 +1497,7 @@ err_bhrcpt(char *arg2, char *arg3) } no_return void -err_maps(char *from, char *reason) +err_maps(const char *from, const char *reason) { logerr(1, "Blackholed SENDER address: MAIL from <", from, "> Reason ", reason, "\n", NULL); logflush(); @@ -1503,7 +1507,7 @@ err_maps(char *from, char *reason) } void -err_mrc(char *arg1, char *arg2) +err_mrc(const char *arg1, const char *arg2) { logerr(1, "Too many RECIPIENTS: MAIL from <", arg1, "> Last RCPT <", arg2, ">\n", NULL); logflush(); @@ -1512,7 +1516,7 @@ err_mrc(char *arg1, char *arg2) } void -smtp_noop(char *arg) +smtp_noop(const char *arg) { if (arg && *arg) { out("501 invalid parameter syntax (#5.3.2)\r\n", NULL); @@ -1549,7 +1553,7 @@ smtp_noop(char *arg) } void -smtp_vrfy(char *arg) +smtp_vrfy(const char *arg) { if (no_vrfy) { err_unimpl("unimplimented"); @@ -1603,7 +1607,7 @@ err_child() } void -err_library(char *arg) +err_library(const char *arg) { if (arg) { logerr(1, arg, "\n", NULL); @@ -1760,7 +1764,7 @@ err_authrequired() } void -err_transaction(char *arg) +err_transaction(const char *arg) { out("503 no ", arg, " during mail transaction (#5.5.0)\r\n", NULL); flush(); @@ -1801,7 +1805,7 @@ err_input() } void -err_mailbox(char *arg1, char *arg2, char *arg3) +err_mailbox(const char *arg1, const char *arg2, const char *arg3) { logerr(1, "Invalid RECIPIENT address: MAIL from <", arg1, "> RCPT <", arg2, "> state <", arg3, ">\n", NULL); @@ -1812,7 +1816,7 @@ err_mailbox(char *arg1, char *arg2, char *arg3) } void -err_rcpt_errcount(char *arg1, int count) +err_rcpt_errcount(const char *arg1, int count) { strnum[fmt_ulong(strnum, count)] = 0; logerr(1, "Too many Invalid RECIPIENTS (", strnum, "): MAIL from <", @@ -1834,7 +1838,7 @@ err_greytimeout() } no_return void -err_grey_tmpfail(char *arg) +err_grey_tmpfail(const char *arg) { logerr(1, "greylisting temporary failure: ", NULL); if (arg) @@ -1873,7 +1877,7 @@ int flagblackhole; stralloc Desc = { 0 }; int -sigscheck(stralloc *line, char **desc, int in_header) +sigscheck(stralloc *line, const char **desc, int in_header) { int i, j, k, len, pos1, pos2, header_check, body_check; char *ptr; @@ -2056,8 +2060,9 @@ load_virtual() int check_user_sql(char *rcpt, int len) { - char *ptr, *errstr; - void *(*inquery) (char, char *, char *); + char *ptr; + const char *errstr; + void *(*inquery) (char, const char *, const char *); if (!(ptr = load_virtual())) return -1; @@ -2122,7 +2127,7 @@ dnscheck(char *address, int len, int noat) } void -log_etrn(char *arg1, char *arg2) +log_etrn(const char *arg1, const char *arg2) { logerr(1, "ETRN ", arg1, NULL); if (arg2) @@ -2132,7 +2137,7 @@ log_etrn(char *arg1, char *arg2) } void -log_atrn(char *arg1, char *arg2, char *arg3) +log_atrn(const char *arg1, const char *arg2, const char *arg3) { logerr(1, "ATRN ", arg1, NULL); if (arg2) @@ -2146,7 +2151,7 @@ log_atrn(char *arg1, char *arg2, char *arg3) void greet_extra() { - char *ptr; + const char *ptr; char buf[DATE822FMT]; int i; struct datetime dt; @@ -2172,7 +2177,7 @@ greet_extra() } void -smtp_respond(char *code) +smtp_respond(const char *code) { int i, j, do_greet; static int d = -1; @@ -2220,7 +2225,7 @@ sigterm() void smtp_help(char *arg) { - char *ptr; + const char *ptr; if (no_help) { err_unimpl("help"); @@ -2296,7 +2301,7 @@ smtp_quit(char *arg) } int -badipcheck(char *arg) +badipcheck(const char *arg) { /*- badip */ if (!stralloc_copys(&ipaddr, arg) || @@ -2355,7 +2360,7 @@ badhostcheck() } void -dohelo(char *arg) +dohelo(const char *arg) { int i; @@ -2450,8 +2455,8 @@ greetdelay_check(int delay) } void -open_control_once(int *open_flag, int *open_flagp, char **fn, char **fn_p, - char *envstr, char *envstr_p, char *cfn, char *cfn_p, +open_control_once(int *open_flag, int *open_flagp, const char **fn, const char **fn_p, + const char *envstr, const char *envstr_p, const char *cfn, const char *cfn_p, stralloc *sfn, struct constmap *mapvar, stralloc *sfn_p) { char *x; @@ -2487,7 +2492,7 @@ open_control_once(int *open_flag, int *open_flagp, char **fn, char **fn_p, } void -open_control_once_int(int *val, int *openok, char *envstr, char *cfn, int neg_allowed) +open_control_once_int(int *val, int *openok, const char *envstr, const char *cfn, int neg_allowed) { char *x; @@ -2600,7 +2605,7 @@ open_control_files1() void open_control_files2() { - char *x; + const char *x; #ifdef HAVESRS int r; #endif @@ -3031,7 +3036,7 @@ smtp_ehlo(char *arg) out(" [", remoteip, "]", NULL); out("\r\n", NULL); if (hostname && *hostname && childargs && *childargs) { - char *no_auth_login, *no_auth_plain, *no_cram_md5, + const char *no_auth_login, *no_auth_plain, *no_cram_md5, *no_cram_sha1, *no_cram_sha224, *no_cram_sha256, *no_cram_sha384, *no_cram_sha512, *no_cram_ripemd, *no_digest_md5; @@ -3275,7 +3280,7 @@ check_batv_sig() char kdate[] = "0000"; #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_MD_CTX *mdctx; - const EVP_MD *md = 0; + EVP_MD *md = 0; unsigned char md5digest[EVP_MAX_MD_SIZE]; unsigned int md_len; #else @@ -3357,8 +3362,8 @@ check_batv_sig() int pop_bef_smtp(char *mfrom) { - char *ptr, *errstr; - void *(*inquery) (char, char *, char *); + const char *ptr, *errstr; + void *(*inquery) (char, const char *, const char *); if (!(ptr = load_virtual())) return 1; @@ -3387,10 +3392,10 @@ pop_bef_smtp(char *mfrom) * domain in the mailfrom or the authenticated username. */ int -domain_compare(char *dom1, char *dom2) +domain_compare(const char *dom1, const char *dom2) { - char *ptr, *tmpdom1, *tmpdom2, *errstr; - void *(*inquery) (char, char *, char *); + const char *ptr, *tmpdom1, *tmpdom2, *errstr; + void *(*inquery) (char, const char *, const char *); if (!hasvirtual) { if (str_diff(dom1, dom2)) { @@ -3526,10 +3531,10 @@ mailfrom_parms(char *arg) static int f_envret = 0, d_envret = 0, a_envret = 0; int -check_sender(void *(*inquery) (char, char *, char *), char *lib_fn, +check_sender(void *(*inquery) (char, const char *, const char *), const char *lib_fn, int in_rcpt1, int in_rcpt2) { - char *x; + const char *x; PASSWD *pw; int at, isLocal; int *u_not_found, *i_inactive; @@ -3643,7 +3648,8 @@ check_sender(void *(*inquery) (char, char *, char *), char *lib_fn, x = env_get("MASQUERADE"); if ((!x || (x && *x)) && authd) { int at1, at2, iter_pass, flag; - char *dom1, *dom2, *allowed; + const char *dom1, *dom2; + char *allowed; if (mailfrom.s[at1 = str_rchr(mailfrom.s, '@')]) { dom1 = mailfrom.s + at1 + 1; @@ -3655,9 +3661,9 @@ check_sender(void *(*inquery) (char, char *, char *), char *lib_fn, /*- this loop will do two passes */ for (flag = 0, iter_pass = 0;; iter_pass++) { if (x && *x) /*- allow x first and if it does not match, allow remoteinfo */ - allowed = iter_pass ? remoteinfo : x; + allowed = iter_pass ? (char *) remoteinfo : (char *) x; else { - allowed = remoteinfo; + allowed = (char *) remoteinfo; iter_pass++; } /*- @@ -3714,7 +3720,7 @@ check_sender(void *(*inquery) (char, char *, char *), char *lib_fn, void smtp_mail(char *arg) { - char *x, *ptr; + const char *x, *ptr; int ret, i, in_rcpt1 = -1, in_rcpt2 = -1; #ifdef SMTP_PLUGIN char *mesg; @@ -3722,7 +3728,7 @@ smtp_mail(char *arg) #ifdef USE_SPF int r; #endif - void *(*inquery) (char, char *, char *); + void *(*inquery) (char, const char *, const char *); /*- * If this is the second session restore original environment. @@ -4459,7 +4465,7 @@ stralloc boundary = { 0 }; */ void -put(char *ch) +put(const char *ch) { char *cp, *cpstart, *cpafter; unsigned int len; @@ -4778,7 +4784,7 @@ static void create_logfilter() { int fd; - char *tmpdir, *x; + const char *tmpdir, *x; static stralloc tmpFile = { 0 }; if (env_get("LOGFILTER")) { @@ -4806,7 +4812,7 @@ smtp_data(char *arg) { int hops, j; unsigned long qp; - char *qqx, *x; + const char *qqx, *x; #ifdef SMTP_PLUGIN int i; char *mesg; @@ -4975,44 +4981,48 @@ smtp_data(char *arg) err_size(mailfrom.s, rcptto.s, rcptto.len); return; } - j = str_rchr(qqx, '\n'); - if (qqx[j] && qqx[j + 1]) { + if (!stralloc_copys(&tmpBuf, qqx) || + !stralloc_0(&tmpBuf)) + die_nomem(); + tmpBuf.len--; + j = str_rchr(tmpBuf.s, '\n'); + if (tmpBuf.s[j] && tmpBuf.s[j + 1]) { /*- * handle multi line output due to custom error patch * use the last line for the error message */ - if (*(qqx + j + 1) == 'D') { + if (*(tmpBuf.s + j + 1) == 'D') { out("554 ", NULL); - out(qqx + j + 2, "\r\n", NULL); - qqx[j] = '\0'; + out(tmpBuf.s + j + 2, "\r\n", NULL); + tmpBuf.s[j] = '\0'; j = 1; } else - if (*(qqx + j + 1) == 'Z') { + if (*(tmpBuf.s + j + 1) == 'Z') { out("451 ", NULL); - out(qqx + j + 2, "\r\n", NULL); - qqx[j] = '\0'; + out(tmpBuf.s + j + 2, "\r\n", NULL); + tmpBuf.s[j] = '\0'; j = 0; } else { out("451 ", NULL); - out(qqx + j + 1, "\r\n", NULL); - qqx[j] = '\0'; + out(tmpBuf.s + j + 1, "\r\n", NULL); + tmpBuf.s[j] = '\0'; j = 0; } - out(qqx, "\r\n", NULL); + out(tmpBuf.s, "\r\n", NULL); } else { - if (qqx[j] == '\n') - qqx[j] = '\0'; - if (*qqx == 'D') { + if (tmpBuf.s[j] == '\n') + tmpBuf.s[j] = '\0'; + if (*tmpBuf.s == 'D') { j = 1; out("554 ", NULL); } else { j = 0; out("451 ", NULL); } - out(qqx + 1, "\r\n", NULL); + out(tmpBuf.s + 1, "\r\n", NULL); } flush(); - err_queue(mailfrom.s, rcptto.s, rcptto.len, authd ? remoteinfo : 0, qqx + 1, j, qp); + err_queue(mailfrom.s, rcptto.s, rcptto.len, authd ? remoteinfo : 0, tmpBuf.s + 1, j, qp); return; } @@ -5325,13 +5335,13 @@ static stralloc scram_method; static int gs_callback_err; PASSWD * -get_scram_record(char *u, int *mech, int *iter, char **salt, char **stored_key, +get_scram_record(const char *u, int *mech, int *iter, char **salt, char **stored_key, char **server_key, char **hexsaltpw, char **cleartxt, char **saltedpw) { int i; - char *ptr, *err; + const char *ptr, *err; int *u_not_found, *i_inactive; - void *(*inquery) (char, char *, char *); + void *(*inquery) (char, const char *, const char *); gsasl_pw = (PASSWD *) NULL; if (!hasvirtual) @@ -5428,7 +5438,7 @@ is_scram_method(int mech) } static int -get_user_details(Gsasl_session *sctx, char **u, int *mech, int *iter, +get_user_details(Gsasl_session *sctx, const char **u, int *mech, int *iter, char **salt, char **stored_key, char **server_key, char **hexsaltpw, char **cleartxt, char **saltedpw) { @@ -5463,7 +5473,7 @@ get_user_details(Gsasl_session *sctx, char **u, int *mech, int *iter, } void -err_scram(char *err_code1, char *err_code2, char *mesg, char *str) +err_scram(const char *err_code1, const char *err_code2, const char *mesg, const char *str) { logerr(1, mesg, NULL); if (str) @@ -5544,7 +5554,8 @@ gs_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop) { int rc = GSASL_NO_CALLBACK; static int mech, iter = 4096; - static char *u, *salt, *stored_key, *server_key, *hexsaltpw, + static const char *u; + static char *salt, *stored_key, *server_key, *hexsaltpw, *cleartxt, *saltedpw; static int i = -1; #ifdef TLS @@ -6508,7 +6519,8 @@ void mta_access(char *atrnaddr, int *reject, int *temp) { int r, atpos, lcount, wildcard, len; - char *ptr, *cptr, *errstr; + const char *ptr, *errstr; + char *cptr; *reject = *temp = 1; a_user.len = domain.len = 0; @@ -6532,7 +6544,7 @@ mta_access(char *atrnaddr, int *reject, int *temp) a_user.len--; for (lcount = len = 0, ptr = atrnaccess.s; len < atrnaccess.len;) { len += (str_len(ptr) + 1); - for (cptr = ptr;*cptr && *cptr != ':';cptr++); + for (cptr = (char *) ptr; *cptr && *cptr != ':'; cptr++); if (*cptr == ':') *cptr = 0; else { @@ -6568,12 +6580,13 @@ mta_access(char *atrnaddr, int *reject, int *temp) void indimail_virt_access(char *arg, char **dptr, int *reject, int *temp) { - char *ptr, *errstr, *user_tmp, *domain_tmp; + const char *ptr, *errstr; + char *user_tmp, *domain_tmp; int r, end_flag; void (*iclose) (void); char *(*show_atrn_map) (char **, char **); - int (*atrn_access) (char *, char *); - int (*parse_email) (char *, stralloc *, stralloc *); + int (*atrn_access) (const char *, const char *); + int (*parse_email) (const char *, stralloc *, stralloc *); *reject = *temp = 1; if (!(ptr = load_virtual())) @@ -6590,7 +6603,7 @@ indimail_virt_access(char *arg, char **dptr, int *reject, int *temp) err_library(errstr); return; } - domBuf.len = 0; + tmpBuf.len = 0; for (; *arg && !isalnum((int) *arg); arg++); if (*arg) *dptr = arg; @@ -6604,22 +6617,22 @@ indimail_virt_access(char *arg, char **dptr, int *reject, int *temp) if (!(ptr = (*show_atrn_map) (&user_tmp, &domain_tmp))) break; if (end_flag) { - if (!stralloc_cats(&domBuf, " ")) { + if (!stralloc_cats(&tmpBuf, " ")) { (*iclose) (); die_nomem(); } } - if (!stralloc_cats(&domBuf, ptr)) { + if (!stralloc_cats(&tmpBuf, ptr)) { (*iclose) (); die_nomem(); } end_flag = 1; } /*- for (user_tmp = a_user.s, domain_tmp = domain.s, end_flag = 0;;) */ - if (!stralloc_0(&domBuf)) { + if (!stralloc_0(&tmpBuf)) { (*iclose) (); die_nomem(); } - *dptr = domBuf.s; + *dptr = tmpBuf.s; } if (!valid_hname(*dptr)) { out("501 invalid parameter syntax (#5.3.2)\r\n", NULL); @@ -7053,7 +7066,7 @@ struct commands submcommands[] = { #ifdef SMTP_PLUGIN void -load_plugin(char *library, char *plugin_symb, int j) +load_plugin(const char *library, const char *plugin_symb, int j) { PLUGIN *(*func) (void); char *error; @@ -7078,12 +7091,12 @@ load_plugin(char *library, char *plugin_symb, int j) void qmail_smtpd(int argc, char **argv, char **envp) { - char *ptr, *errstr; + const char *ptr, *errstr; struct commands *cmdptr; int i, port; #ifdef SMTP_PLUGIN int j, len; - char *start_plugin, *plugin_symb, *plugindir; + const char *start_plugin, *plugin_symb, *plugindir; static stralloc plugin = { 0 }; #endif @@ -7353,6 +7366,9 @@ addrrelay() /* * $Log: smtpd.c,v $ + * Revision 1.324 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.323 2024-02-23 21:39:32+05:30 Cprogrammer * sanitized variable names for badmailfrom, badrcptto, blackholedrcpt, blackholedsender, spamignore * removed blachole*pattern, spamignorepattern @@ -7779,10 +7795,10 @@ addrrelay() * */ -char * +const char * getversion_smtpd_c() { - static char *x = "$Id: smtpd.c,v 1.323 2024-02-23 21:39:32+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: smtpd.c,v 1.324 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; return revision + 11; diff --git a/indimail-mta-x/socket_tcp.c b/indimail-mta-x/socket_tcp.c index 9120549d25..e990e42710 100644 --- a/indimail-mta-x/socket_tcp.c +++ b/indimail-mta-x/socket_tcp.c @@ -1,5 +1,8 @@ /* * $Log: socket_tcp.c,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2005-06-15 22:35:58+05:30 Cprogrammer * added RCS version information * @@ -24,7 +27,7 @@ socket_tcp4(void) void getversion_socket_tcp4_c() { - static char *x = "$Id: socket_tcp.c,v 1.2 2005-06-15 22:35:58+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: socket_tcp.c,v 1.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/socket_tcp6.c b/indimail-mta-x/socket_tcp6.c index 5566a6950a..6628fbb0bc 100644 --- a/indimail-mta-x/socket_tcp6.c +++ b/indimail-mta-x/socket_tcp6.c @@ -1,5 +1,8 @@ /* * $Log: socket_tcp6.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2018-05-30 23:26:21+05:30 Cprogrammer * moved noipv6 variable to variables.c * @@ -55,7 +58,7 @@ socket_tcp6(void) void getversion_socket_tcp6_c() { - static char *x = "$Id: socket_tcp6.c,v 1.3 2018-05-30 23:26:21+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: socket_tcp6.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sorted.c b/indimail-mta-x/sorted.c index 3df67f368b..d26b4aebd2 100644 --- a/indimail-mta-x/sorted.c +++ b/indimail-mta-x/sorted.c @@ -1,5 +1,8 @@ /* * $Log: sorted.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-11-22 23:12:09+05:30 Cprogrammer * removed supression of ANSI C proto * @@ -56,7 +59,7 @@ sorted_insert(sl, sa) void getversion_sorted_c() { - static char *x = "$Id: sorted.c,v 1.3 2020-11-22 23:12:09+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sorted.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sortedtest.c b/indimail-mta-x/sortedtest.c index 0102b195a1..8f6871100c 100644 --- a/indimail-mta-x/sortedtest.c +++ b/indimail-mta-x/sortedtest.c @@ -1,5 +1,8 @@ /* * $Log: sortedtest.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2008-06-03 23:24:09+05:30 Cprogrammer * Initial revision * @@ -41,7 +44,7 @@ main(int argc, char **argv) void getversion_sortedtest_c() { - static char *x = "$Id: sortedtest.c,v 1.1 2008-06-03 23:24:09+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: sortedtest.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/spawn-filter.c b/indimail-mta-x/spawn-filter.c index ee24c3eda8..ae717cbeb1 100644 --- a/indimail-mta-x/spawn-filter.c +++ b/indimail-mta-x/spawn-filter.c @@ -1,5 +1,5 @@ /* - * $Id: spawn-filter.c,v 1.89 2024-02-07 23:21:22+05:30 Cprogrammer Exp mbhangui $ + * $Id: spawn-filter.c,v 1.90 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -32,12 +32,12 @@ #include "buffer_defs.h" static int mkTempFile(int); -static int run_mailfilter(char *, char *, char *, char *, char **); -static void log_spam(char *, char *, char *, stralloc *); -static int redirect_mail(char *, char *, char *, char *); +static int run_mailfilter(const char *, const char *, const char *, const char *, char **); +static void log_spam(const char *, const char *, const char *, stralloc *); +static int redirect_mail(const char *, const char *, const char *, const char *); static void create_logfilter(); -static int check_size(char *); -static void set_environ(char *, char *, char *, char *, char *); +static int check_size(const char *); +static void set_environ(const char *, const char *, const char *, const char *, const char *); extern dtype delivery; static int spfok = 0; @@ -51,7 +51,7 @@ static stralloc QueueBase = { 0 }; static stralloc q = { 0 }; static void -log_spam(char *arg1, char *arg2, char *size, stralloc *line) +log_spam(const char *arg1, const char *arg2, const char *size, stralloc *line) { int logfifo, match; char *fifo_name; @@ -119,7 +119,7 @@ log_spam(char *arg1, char *arg2, char *size, stralloc *line) } static void -set_environ(char *host, char *ext, char *qqeh, char *sender_p, char *recipient_p) +set_environ(const char *host, const char *ext, const char *qqeh, const char *sender_p, const char *recipient_p) { if (!env_put2("DOMAIN", host) || !env_put2("_EXT", ext) || !env_put2("_QQEH", qqeh) || !env_put2("_SENDER", sender_p) || @@ -129,7 +129,7 @@ set_environ(char *host, char *ext, char *qqeh, char *sender_p, char *recipient_p } static int -run_mailfilter(char *domain, char *ext, char *qqeh, char *mailprog, char **argv) +run_mailfilter(const char *domain, const char *ext, const char *qqeh, const char *mailprog, char **argv) { char strnum[FMT_ULONG]; pid_t filt_pid; @@ -249,7 +249,7 @@ static int mkTempFile(int seekfd) { char inbuf[2048], outbuf[2048], strnum[FMT_ULONG]; - char *tmpdir; + const char *tmpdir; static stralloc tmpFile = {0}; struct substdio _ssin; struct substdio _ssout; @@ -293,7 +293,7 @@ static void create_logfilter() { int fd; - char *tmpdir; + const char *tmpdir; char strnum[FMT_ULONG]; static stralloc tmpFile = { 0 }; @@ -318,7 +318,7 @@ create_logfilter() } static int -redirect_mail(char *notifyaddress, char *domain, char *ext, char *qqeh) +redirect_mail(const char *notifyaddress, const char *domain, const char *ext, const char *qqeh) { char *(args[7]); char *qbase; @@ -366,11 +366,11 @@ redirect_mail(char *notifyaddress, char *domain, char *ext, char *qqeh) report(111, "spawn-filter: out of memory. (#4.3.0)", 0, 0, 0, 0, 0); if (!env_put(Queuedir.s)) report(111, "spawn-filter: out of memory. (#4.3.0)", 0, 0, 0, 0, 0); - args[1] = "-a"; - args[2] = "-s"; - args[3] = "-f"; - args[4] = "\"\""; - args[5] = notifyaddress; + args[1] = (char *) "-a"; + args[2] = (char *) "-s"; + args[3] = (char *) "-f"; + args[4] = (char *) "\"\""; + args[5] = (char *) notifyaddress; args[6] = 0; if (!stralloc_copys(&q, auto_prefix) || !stralloc_catb(&q, "/bin/qmail-inject", 17) || @@ -389,7 +389,7 @@ redirect_mail(char *notifyaddress, char *domain, char *ext, char *qqeh) } static int -check_size(char *size) +check_size(const char *size) { char *x; unsigned long databytes = -1, msgsize; @@ -427,7 +427,7 @@ static char *setup_qargs(char t) int main(int argc, char **argv) { - char *ptr, *mailprog, *domain, *errStr = 0, *size = "0", *qqeh, + const char *ptr, *mailprog, *domain, *errStr = 0, *size = "0", *qqeh, *ext, *spamfilterprog, *notifyaddress, *rejectspam, *spf_fn; char sizebuf[FMT_ULONG]; int at, len, wstat, filt_exitcode, ret, i, @@ -689,7 +689,7 @@ main(int argc, char **argv) void getversion_qmail_spawn_filter_c() { - static char *x = "$Id: spawn-filter.c,v 1.89 2024-02-07 23:21:22+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: spawn-filter.c,v 1.90 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidreporth; x = sccsidgetdomainth; @@ -700,6 +700,9 @@ getversion_qmail_spawn_filter_c() /* * $Log: spawn-filter.c,v $ + * Revision 1.90 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.89 2024-02-07 23:21:22+05:30 Cprogrammer * updated error messages * exit 100 on wrong usage diff --git a/indimail-mta-x/spawn.c b/indimail-mta-x/spawn.c index e91a956f9f..139d0c13cf 100644 --- a/indimail-mta-x/spawn.c +++ b/indimail-mta-x/spawn.c @@ -1,5 +1,5 @@ /* - * $Id: spawn.c,v 1.35 2024-02-09 16:09:04+05:30 Cprogrammer Exp mbhangui $ + * $Id: spawn.c,v 1.36 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -100,7 +100,7 @@ okwrite(int fd, char *buf, ssize_t n) } static void -err(char *s) +err(const char *s) { char ch; @@ -371,7 +371,7 @@ QSPAWN(int argc, char **argv) { char ch; #ifdef ENABLE_VIRTUAL_PKG - char *ptr; + const char *ptr; #endif int i, r, nfds; fd_set rfds; @@ -471,7 +471,7 @@ QSPAWN(int argc, char **argv) byte_copy(d[i].output.s + d[i].output.len, r, inbuf); d[i].output.len += r; if (truncreport_SPAWN > 100 && d[i].output.len > truncreport_SPAWN) { - char *truncmess = "\nError report too long, sorry.\n"; + const char *truncmess = "\nError report too long, sorry.\n"; d[i].output.len = truncreport_SPAWN - str_len(truncmess) - 3; stralloc_cats(&d[i].output, truncmess); } @@ -485,7 +485,7 @@ QSPAWN(int argc, char **argv) static void /*- for ident command */ getversion_spawn_c() { - static char *x = "$Id: spawn.c,v 1.35 2024-02-09 16:09:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: spawn.c,v 1.36 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } @@ -500,6 +500,9 @@ main(int argc, char **argv) /* * $Log: spawn.c,v $ + * Revision 1.36 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.35 2024-02-09 16:09:04+05:30 Cprogrammer * convert env variable name to upper case in set_env_variables * convert '-' in env variable name to '_' in set_env_variables diff --git a/indimail-mta-x/spf.c b/indimail-mta-x/spf.c index 00282be3e4..50f4051fa1 100644 --- a/indimail-mta-x/spf.c +++ b/indimail-mta-x/spf.c @@ -1,5 +1,5 @@ /* - * $Id: spf.c,v 1.25 2023-09-24 19:35:55+05:30 Cprogrammer Exp mbhangui $ + * $Id: spf.c,v 1.26 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifdef USE_SPF #include @@ -69,8 +69,9 @@ extern char *localhost; extern stralloc spflocal, spfguess, spfexp; +typedef const char c_char; static stralloc sender_fqdn, explanation, expdomain, errormsg; -static char *received; +static c_char *received; static int recursion; static ip_addr ip; #ifdef IPV6 @@ -78,7 +79,7 @@ static ip6_addr ip6; static int ipv6use; #endif -static int spf_ptr(char *spec, char *mask); +static int spf_ptr(const char *spec, const char *mask); static int spflookup(stralloc * domain); static void @@ -118,7 +119,7 @@ hdr_none() } static void -hdr_unknown_msg(char *e) +hdr_unknown_msg(const char *e) { if (!stralloc_copys(&errormsg, e)) return; @@ -126,7 +127,7 @@ hdr_unknown_msg(char *e) } static void -hdr_ext(char *e) +hdr_ext(const char *e) { if (!stralloc_copys(&errormsg, e)) return; @@ -140,7 +141,7 @@ hdr_syntax() } static void -hdr_error(char *e) +hdr_error(const char *e) { if (!stralloc_copys(&errormsg, e)) return; @@ -182,7 +183,7 @@ matchip6(ip6_addr *net, int mask, ip6_addr *i6) } static int -getipmask(char *mask, int *ip4mask, int *ip6mask) +getipmask(const char *mask, int *ip4mask, int *ip6mask) { unsigned long r; int pos; @@ -210,7 +211,7 @@ getipmask(char *mask, int *ip4mask, int *ip6mask) } static int -getip4mask(char *mask) +getip4mask(const char *mask) { unsigned long r; int pos; @@ -225,7 +226,7 @@ getip4mask(char *mask) } static int -getip6mask(char *mask) +getip6mask(const char *mask) { unsigned long r; int pos; @@ -240,7 +241,7 @@ getip6mask(char *mask) } #else static int -getipmask(char *mask, int ipv6) +getipmask(const char *mask, int ipv6) { unsigned long r; int pos; @@ -347,12 +348,12 @@ spfget(stralloc *spf, stralloc *domain_v) } int -spfsubst(stralloc *expand, char *spec, char *domain_p) +spfsubst(stralloc *expand, const char *spec, const char *domain_p) { - static char hexdigits[] = "0123456789abcdef"; + static c_char hexdigits[] = "0123456789abcdef"; static stralloc sa = { 0 }; char ch; - char *split = "."; + const char *split = "."; int digits = -1, urlencode = 0, reverse = 0, start = expand->len, i, pos; @@ -534,7 +535,7 @@ spfsubst(stralloc *expand, char *spec, char *domain_p) } int -spfexpand(stralloc *sa_p, char *spec, char *domain_p) +spfexpand(stralloc *sa_p, const char *spec, const char *domain_p) { char *p; char append; @@ -545,7 +546,7 @@ spfexpand(stralloc *sa_p, char *spec, char *domain_p) if (!stralloc_readyplus(sa_p, 0)) return 0; sa_p->len = 0; - for (p = spec; *p; p++) { + for (p = (char *) spec; *p; p++) { append = *p; if (*p == '%') { p++; @@ -582,7 +583,7 @@ spfexpand(stralloc *sa_p, char *spec, char *domain_p) } static int -spf_include(char *spec, char *mask) +spf_include(const char *spec, const char *mask) { int r; static stralloc sa = { 0 }; @@ -608,7 +609,7 @@ spf_include(char *spec, char *mask) } static int -spf_a(char *spec, char *mask) +spf_a(const char *spec, const char *mask) { static ipalloc ia = { 0 }; static stralloc sa = { 0 }; @@ -671,7 +672,7 @@ spf_a(char *spec, char *mask) } static int -spf_mx(char *spec, char *mask) +spf_mx(const char *spec, const char *mask) { static stralloc sa = { 0 }; static ipalloc ia = { 0 }; @@ -731,7 +732,7 @@ spf_mx(char *spec, char *mask) } static int -spf_ptr(char *spec, char *mask) +spf_ptr(const char *spec, const char *mask) { int len = str_len(spec), r, j, k, pos; static ipalloc ia = { 0 }; @@ -852,7 +853,7 @@ spf_ptr(char *spec, char *mask) #ifdef IPV6 static int -spf_ip6(char *spec, char *mask) +spf_ip6(const char *spec, const char *mask) { ip6_addr net; int ipmask; @@ -867,7 +868,7 @@ spf_ip6(char *spec, char *mask) } static int -spf_ip(char *spec, char *mask) +spf_ip(const char *spec, const char *mask) { ip_addr net; int ipmask; @@ -881,7 +882,7 @@ spf_ip(char *spec, char *mask) } #else static int -spf_ip(char *spec, char *mask) +spf_ip(const char *spec, const char *mask) { ip_addr net; int ipmask = getipmask(mask, 0); @@ -896,7 +897,7 @@ spf_ip(char *spec, char *mask) #endif static int -spf_exists(char *spec, char *mask) +spf_exists(const char *spec, const char *mask) { static stralloc sa = { 0 }; static ipalloc ia = { 0 }; @@ -924,8 +925,8 @@ spf_exists(char *spec, char *mask) static struct mechanisms { - char *mechanism; - int (*func) (char *spec, char *mask); + const char *mechanism; + int (*func) (const char *spec, const char *mask); unsigned int takes_spec:1; unsigned int takes_mask:1; unsigned int expands:1; @@ -949,7 +950,7 @@ static struct mechanisms }; static int -spfmech(char *mechanism, char *spec, char *mask, char *domain_p) +spfmech(const char *mechanism, const char *spec, const char *mask, const char *domain_p) { struct mechanisms *mech; int r, pos; @@ -988,7 +989,7 @@ spfmech(char *mechanism, char *spec, char *mask, char *domain_p) static struct default_aliases { - char *alias; + const char *alias; int defret; } default_aliases[] = { {"allow", SPF_OK}, @@ -1275,7 +1276,7 @@ spflookup(stralloc *domain_s) } int -spfcheck(char *remoteip) +spfcheck(const char *remoteip) { int pos, r; static stralloc domain = {0}; @@ -1377,13 +1378,16 @@ spfinfo(stralloc *sa_p) void getversion_spf_c() { - static char *x = "$Id: spf.c,v 1.25 2023-09-24 19:35:55+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: spf.c,v 1.26 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: spf.c,v $ + * Revision 1.26 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.25 2023-09-24 19:35:55+05:30 Cprogrammer * fix for empty spf explanation * diff --git a/indimail-mta-x/spf.h b/indimail-mta-x/spf.h index 15a3a0286f..e8b61e9957 100644 --- a/indimail-mta-x/spf.h +++ b/indimail-mta-x/spf.h @@ -1,5 +1,8 @@ /* * $Log: spf.h,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-09-24 09:34:28+05:30 Cprogrammer * removed reference to dead SPF explanation pages * @@ -37,7 +40,7 @@ #define SPF_DEFEXP "" #endif -int spfcheck(char *); +int spfcheck(const char *); int spfexplanation(stralloc *); int spfinfo(stralloc *); diff --git a/indimail-mta-x/spfquery.c b/indimail-mta-x/spfquery.c index 45dc6facb6..d11c499126 100644 --- a/indimail-mta-x/spfquery.c +++ b/indimail-mta-x/spfquery.c @@ -1,5 +1,5 @@ /* - * $Id: spfquery.c,v 1.10 2023-09-24 19:38:38+05:30 Cprogrammer Exp mbhangui $ + * $Id: spfquery.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -11,7 +11,7 @@ #ifdef USE_SPF #include "spf.h" -char *localhost = "localhost"; +const char *localhost = "localhost"; stralloc addr = { 0 }; stralloc helohost = { 0 }; stralloc spflocal = { 0 }; @@ -19,7 +19,7 @@ stralloc spfguess = { 0 }; stralloc spfexp = { 0 }; no_return void -die(int e, char *s) +die(int e, const char *s) { substdio_putsflush(subfderr, s); _exit(e); @@ -146,13 +146,16 @@ main(argc, argv) void getversion_spfquery_c() { - static char *x = "$Id: spfquery.c,v 1.10 2023-09-24 19:38:38+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: spfquery.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: spfquery.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-09-24 19:38:38+05:30 Cprogrammer * exit with return value of spfcheck() * diff --git a/indimail-mta-x/splogger.c b/indimail-mta-x/splogger.c index 8656aac3b1..59d9ca94e7 100644 --- a/indimail-mta-x/splogger.c +++ b/indimail-mta-x/splogger.c @@ -1,5 +1,8 @@ /* * $Log: splogger.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-11-24 13:48:27+05:30 Cprogrammer * removed exit.h * @@ -105,7 +108,7 @@ main(argc, argv) void getversion_splogger_c() { - static char *x = "$Id: splogger.c,v 1.5 2020-11-24 13:48:27+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: splogger.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sql-database.c b/indimail-mta-x/sql-database.c index 7c6ac260b8..a680d06abd 100644 --- a/indimail-mta-x/sql-database.c +++ b/indimail-mta-x/sql-database.c @@ -1,5 +1,8 @@ /* * $Log: sql-database.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2023-02-14 09:19:46+05:30 Cprogrammer * renamed auto_uidv to auto_uidi, auto_gidv to auto_gidi * @@ -44,7 +47,7 @@ #define WARN "sql-database: warn: " void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -62,7 +65,7 @@ flush() } static int -create_db_table(MYSQL *conn, char *table_name, char **error) +create_db_table(MYSQL *conn, const char *table_name, const char *error[]) { static stralloc sql = { 0 }; @@ -87,7 +90,7 @@ create_db_table(MYSQL *conn, char *table_name, char **error) } static int -insert_db(MYSQL *conn, char *fn, char *table_name, int replace, char **errStr) +insert_db(MYSQL *conn, const char *fn, const char *table_name, int replace, const char *errStr[]) { int i, num = 0, total = 0, m_error, match, fd; @@ -188,7 +191,7 @@ insert_db(MYSQL *conn, char *fn, char *table_name, int replace, char **errStr) return (total); } -char *usage = +const char *usage = "usage: sql-database [-Sr] [-s mysql_host -u user -p password -d database -t table_name] filename\n" " -S (skip)\n" " -r (replace table)"; @@ -197,7 +200,8 @@ int main(int argc, char **argv) { int fd, opt, skip_load = 0, replace = 0; - char *dbserver, *user, *pass, *dbname, *table_name, *tname, *errStr; + char *tname; + const char *dbserver, *user, *pass, *dbname, *table_name, *errStr; stralloc fn = {0}, str = {0}; struct stat statbuf; MYSQL *conn; @@ -330,7 +334,7 @@ main(int argc, char **argv) void getversion_sql_database_c() { - static char *x = "$Id: sql-database.c,v 1.4 2023-02-14 09:19:46+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sql-database.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sqlmatch.c b/indimail-mta-x/sqlmatch.c index 8122fcffc8..f312f29f89 100644 --- a/indimail-mta-x/sqlmatch.c +++ b/indimail-mta-x/sqlmatch.c @@ -1,5 +1,5 @@ /* - * $Id: sqlmatch.c,v 1.14 2022-10-09 23:02:04+05:30 Cprogrammer Exp mbhangui $ + * $Id: sqlmatch.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifdef USE_SQL #include "hasmysql.h" @@ -32,9 +32,10 @@ stralloc dbtable = { 0 }; MYSQL *db_mysql = (MYSQL *) 0; int -connect_sqldb(char *fn, MYSQL **conn, char **table_name, char **error) +connect_sqldb(const char *fn, MYSQL **conn, char **table_name, const char *error[]) { - char *x, *m_timeout; + char *x; + const char *m_timeout; int fd, i = 0; unsigned int next, xlen, mysql_timeout; struct stat st; @@ -231,7 +232,7 @@ connect_sqldb(char *fn, MYSQL **conn, char **table_name, char **error) } int -create_sqltable(MYSQL *conn, char *table_name, char **error) +create_sqltable(MYSQL *conn, const char *table_name, const char *error[]) { static stralloc sql = { 0 }; @@ -256,7 +257,7 @@ create_sqltable(MYSQL *conn, char *table_name, char **error) } static int -query_db(MYSQL *conn, char *addr, unsigned long *row_count, unsigned long *tmval, char **errStr) +query_db(MYSQL *conn, const char *addr, unsigned long *row_count, unsigned long *tmval, const char *errStr[]) { MYSQL_RES *res; @@ -328,7 +329,7 @@ query_db(MYSQL *conn, char *addr, unsigned long *row_count, unsigned long *tmval } int -sqlmatch(char *fn, char *addr, int len, char **errStr) +sqlmatch(const char *fn, const char *addr, int len, const char *errStr[]) { static stralloc controlfile = { 0 }; int cntrl_ok; @@ -369,7 +370,7 @@ sqlmatch_close_db(void) #else #warning "MySQL libs required for -DUSE_SQL. sqlmatch will always return false" int -sqlmatch(char *fn, char *addr, int len, char **errStr) +sqlmatch(const char *fn, const char *addr, int len, const char *errStr[]) { return (0); } @@ -377,7 +378,7 @@ sqlmatch(char *fn, char *addr, int len, char **errStr) #else /*- #ifdef USE_SQL */ #warning "not compiled with -DUSE_SQL" int -sqlmatch(char *fn, char *addr, int len, char **errStr) +sqlmatch(const char *fn, const char *addr, int len, const char *errStr[]) { return (0); } @@ -392,13 +393,16 @@ sqlmatch_close_db(void) void getversion_sqlmatch_c() { - static char *x = "$Id: sqlmatch.c,v 1.14 2022-10-09 23:02:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sqlmatch.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: sqlmatch.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2022-10-09 23:02:04+05:30 Cprogrammer * renamed check_db() to query_db() * moved RCS log to bottom diff --git a/indimail-mta-x/sqlmatch.h b/indimail-mta-x/sqlmatch.h index 68cbacaffd..91ae4f142b 100644 --- a/indimail-mta-x/sqlmatch.h +++ b/indimail-mta-x/sqlmatch.h @@ -1,5 +1,8 @@ /* * $Log: sqlmatch.h,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2022-10-09 23:02:35+05:30 Cprogrammer * removed function check_db() * @@ -48,9 +51,9 @@ #endif #ifdef HAS_MYSQL -extern int create_sqltable(MYSQL *, char *, char **); -extern int connect_sqldb(char *, MYSQL **, char **, char **); +extern int create_sqltable(MYSQL *, const char *, const char *error[]); +extern int connect_sqldb(const char *, MYSQL **, char **, const char *error[]); #endif -extern int sqlmatch(char *, char *, int, char **); +extern int sqlmatch(const char *, const char *, int, const char *errstr[]); extern void sqlmatch_close_db(void); #endif diff --git a/indimail-mta-x/srs.c b/indimail-mta-x/srs.c index d1adb9bceb..11488e9bad 100644 --- a/indimail-mta-x/srs.c +++ b/indimail-mta-x/srs.c @@ -1,5 +1,8 @@ /* * $Log: srs.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-10-02 21:25:29+05:30 Cprogrammer * fix srs_result len due to stralloc_0() * @@ -123,7 +126,7 @@ srs_error_str(int code) int -srsforward(char *address) +srsforward(const char *address) { int x = 0; char srsaddress[1000]; @@ -174,7 +177,7 @@ srsforward(char *address) } int -srsreverse(char *srsaddress) +srsreverse(const char *srsaddress) { int x = 0; char address[1000]; @@ -221,7 +224,7 @@ srsreverse(char *srsaddress) void getversion_srs_c() { - static char *x = "$Id: srs.c,v 1.5 2023-10-02 21:25:29+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: srs.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/srs.h b/indimail-mta-x/srs.h index 38e949a155..230f41008f 100644 --- a/indimail-mta-x/srs.h +++ b/indimail-mta-x/srs.h @@ -1,5 +1,8 @@ /* * $Log: srs.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2022-10-12 19:15:32+05:30 Cprogrammer * added srs_setup() function * @@ -14,7 +17,7 @@ extern stralloc srs_result; extern stralloc srs_error; extern int srs_setup(int); -extern int srsforward(char *); -extern int srsreverse(char *); +extern int srsforward(const char *); +extern int srsreverse(const char *); #endif diff --git a/indimail-mta-x/srsfilter.c b/indimail-mta-x/srsfilter.c index e2e558dccf..92df1e91d6 100644 --- a/indimail-mta-x/srsfilter.c +++ b/indimail-mta-x/srsfilter.c @@ -1,5 +1,8 @@ /* * $Log: srsfilter.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-03-08 20:06:55+05:30 Cprogrammer * discard double, triple bounces * @@ -141,7 +144,8 @@ do_control() int main(int argc, char **argv) { - char *ext2, *host, *sender, *qqx; + char *ext2, *host, *sender; + const char *qqx; char inbuf[SUBSTDIO_INSIZE], outbuf[1], num[FMT_ULONG]; substdio ssin = SUBSTDIO_FDBUF(read, 0, inbuf, sizeof inbuf); substdio ssout = SUBSTDIO_FDBUF(mywrite, -1, outbuf, sizeof outbuf); @@ -221,7 +225,7 @@ main(argc, argv) void getversion_srsfilter_c() { - static char *x = "$Id: srsfilter.c,v 1.5 2023-03-08 20:06:55+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: srsfilter.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sslerator.c b/indimail-mta-x/sslerator.c index 87fbbcf67a..7ea101b321 100644 --- a/indimail-mta-x/sslerator.c +++ b/indimail-mta-x/sslerator.c @@ -1,5 +1,5 @@ /* - * $Id: sslerator.c,v 1.12 2023-08-20 18:50:17+05:30 Cprogrammer Exp mbhangui $ + * $Id: sslerator.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #ifdef TLS #include @@ -424,9 +424,7 @@ main(int argc, char **argv) #include #define FATAL "sslerator: fatal: " int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { strerr_warn2(FATAL, "SSL support not detected. HAVE_SSL not defined", 0); return (1); @@ -436,13 +434,16 @@ main(argc, argv) void getversion_sslerator_c() { - static char *x = "$Id: sslerator.c,v 1.12 2023-08-20 18:50:17+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sslerator.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: sslerator.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2023-08-20 18:50:17+05:30 Cprogrammer * let default ciphers be set by tls_init() * use TLS_CIPHER_LIST for tlsv1_2 and below, TLS_CIPHER_SUITE for tlsv1_3 and above diff --git a/indimail-mta-x/starttls.c b/indimail-mta-x/starttls.c index 3558ea43f4..9d3b6bce89 100644 --- a/indimail-mta-x/starttls.c +++ b/indimail-mta-x/starttls.c @@ -1,5 +1,5 @@ /* - * $Id: starttls.c,v 1.18 2024-01-23 01:23:41+05:30 Cprogrammer Exp mbhangui $ + * $Id: starttls.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include "hastlsa.h" #if defined(HASTLSA) && defined(TLS) @@ -55,7 +55,7 @@ GEN_ALLOC_readyplus(saa, stralloc, sa, len, a, 10, saa_readyplus) static int smtpfd; static const char *ssl_err_str = NULL; static struct ip_mx partner; -static char *partner_fqdn = NULL; +static const char *partner_fqdn = NULL; static SSL *ssl; static stralloc rhost = { 0 }; /*- host ip to which qmail-remote ultimately connects */ static stralloc smtptext = { 0 }; @@ -88,7 +88,7 @@ ssl_exit(int status) } void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -117,7 +117,7 @@ die(int e) } void -logerr(char *str) +logerr(const char *str) { if (!str || !*str) return; @@ -129,7 +129,7 @@ logerr(char *str) } void -logerrf(char *str) +logerrf(const char *str) { if (!str || !*str) return; @@ -286,7 +286,7 @@ outsmtptext() */ no_return void #ifdef HAVE_STDARG_H -quit(int code, int e, char *prepend, ...) +quit(int code, int e, const char *prepend, ...) #else #include quit(va_alist) @@ -294,10 +294,10 @@ va_dcl #endif { va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H int code, e; - char *prepend; + const char *prepend; #endif #ifdef HAVE_STDARG_H @@ -306,7 +306,7 @@ va_dcl va_start(ap); code = va_arg(ap, int); e = va_arg(ap, int); - prepend = va_arg(ap, char *); + prepend = va_arg(ap, const char *); #endif substdio_putflush(&smtpto, "QUIT\r\n", 6); if (verbose == 2) @@ -315,7 +315,7 @@ va_dcl outhost(); while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; logerr(str); @@ -327,7 +327,7 @@ va_dcl } no_return void -tls_quit(const char *s1, char *s2, char *s3, char *s4, char *s5, stralloc *peer_sa) +tls_quit(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, stralloc *peer_sa) { char ch; int i, state; @@ -493,7 +493,7 @@ temp_oserr() stralloc sa = { 0 }; int -get_tlsa_rr(char *domain, int mxhost, int port) +get_tlsa_rr(const char *domain, int mxhost, int port) { int j; unsigned long r; @@ -633,7 +633,7 @@ ehlo() } int -do_dane_validation(char *host, int port) +do_dane_validation(const char *host, int port) { static ipalloc ip = { 0 }; char *err_str = NULL, *servercert = NULL; @@ -929,13 +929,16 @@ unsigned long smtpcode() { return(550);} void getversion_starttls_c() { - static char *x = "$Id: starttls.c,v 1.18 2024-01-23 01:23:41+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: starttls.c,v 1.19 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: starttls.c,v $ + * Revision 1.19 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.18 2024-01-23 01:23:41+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/starttls.h b/indimail-mta-x/starttls.h index 4afc197f97..2fb38c5860 100644 --- a/indimail-mta-x/starttls.h +++ b/indimail-mta-x/starttls.h @@ -1,5 +1,8 @@ /* * $Log: starttls.h,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2024-01-23 01:23:45+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * @@ -18,17 +21,18 @@ #include "buffer_defs.h" #ifndef lint -static char sccsidstarttlsh[] = "$Id: starttls.h,v 1.3 2024-01-23 01:23:45+05:30 Cprogrammer Exp mbhangui $"; +static const char sccsidstarttlsh[] = "$Id: starttls.h,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif -void die_control(char *, char *); -void out(char *); +void die_control(const char *, const char *); +void out(const char *); void die_nomem(); -void logerr(char *); -void logerrf(char *); +void logerr(const char *); +void logerrf(const char *); void flush(); -int do_dane_validation(char *, int); -int get_dane_records(char *); +int do_dane_validation(const char *, int); +int get_dane_records(const char *); +int get_tlsa_rr(const char *, int, int); extern stralloc sa; extern stralloc save; diff --git a/indimail-mta-x/strsalloc.c b/indimail-mta-x/strsalloc.c index 530756ab3d..a3c6839682 100644 --- a/indimail-mta-x/strsalloc.c +++ b/indimail-mta-x/strsalloc.c @@ -1,5 +1,8 @@ /* * $Log: strsalloc.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-11-22 23:12:15+05:30 Cprogrammer * removed supression of ANSI C proto * @@ -27,7 +30,7 @@ GEN_ALLOC_append(strsalloc, stralloc, sa, len, a, 10, strsalloc_readyplus, strsa void getversion_strsalloc_c() { - static char *x = "$Id: strsalloc.c,v 1.5 2020-11-22 23:12:15+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: strsalloc.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/strset.c b/indimail-mta-x/strset.c index 67d4c6131e..0e004cec70 100644 --- a/indimail-mta-x/strset.c +++ b/indimail-mta-x/strset.c @@ -1,5 +1,8 @@ /* * $Log: strset.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-05-11 10:58:31+05:30 Cprogrammer * fixed shadowing of global variables by local variables * @@ -16,8 +19,7 @@ #include "alloc.h" uint32 -strset_hash(s) - char *s; +strset_hash(const char *s) { unsigned char ch; uint32 h; @@ -31,8 +33,7 @@ strset_hash(s) } int -strset_init(set) - strset *set; +strset_init(strset *set) { int h; set->mask = 15; @@ -61,9 +62,7 @@ strset_init(set) } char * -strset_in(set, s) - strset *set; - char *s; +strset_in(strset *set, const char *s) { uint32 h; strset_list *sl; @@ -85,9 +84,7 @@ strset_in(set, s) } int -strset_add(set, s) - strset *set; - char *s; +strset_add(strset *set, const char *s) { uint32 h; int n; @@ -152,7 +149,7 @@ strset_add(set, s) h &= set->mask; sl->next = set->first[h]; set->first[h] = n; - set->x[n] = s; + set->x[n] = (char *) s; set->n = n + 1; return 1; } @@ -160,7 +157,7 @@ strset_add(set, s) void getversion_strset_c() { - static char *x = "$Id: strset.c,v 1.3 2020-05-11 10:58:31+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: strset.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/strset.h b/indimail-mta-x/strset.h index f9f7b062be..89551b208c 100644 --- a/indimail-mta-x/strset.h +++ b/indimail-mta-x/strset.h @@ -1,5 +1,8 @@ /* * $Log: strset.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-03-28 23:49:51+05:30 Cprogrammer * minor code beautification * @@ -28,9 +31,9 @@ typedef struct char **x; /*- x[i] is entry i */ } strset; -uint32 strset_hash(char *); +uint32 strset_hash(const char *); int strset_init(strset *); -char *strset_in(strset *, char *); -int strset_add(strset *, char *); +char *strset_in(strset *, const char *); +int strset_add(strset *, const char *); #endif diff --git a/indimail-mta-x/surblfilter.c b/indimail-mta-x/surblfilter.c index 5f443654ca..dd65c808ad 100644 --- a/indimail-mta-x/surblfilter.c +++ b/indimail-mta-x/surblfilter.c @@ -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-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -81,7 +81,7 @@ static int numanswers; static char name[MAXDNAME]; void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -91,7 +91,7 @@ out(char *str) } void -print_debug(char *arg1, char *arg2, char *arg3) +print_debug(const char *arg1, const char *arg2, const char *arg3) { if (!debug) return; @@ -122,14 +122,14 @@ flush() } void -logerr(char *s) +logerr(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); } void -logerrf(char *s) +logerrf(const char *s) { if (substdio_puts(&sserr, s) == -1) _exit(1); @@ -138,7 +138,7 @@ logerrf(char *s) } no_return void -my_error(char *s1, char *s2, int exit_val) +my_error(const char *s1, const char *s2, int exit_val) { logerr(s1); if (s2) { @@ -345,7 +345,7 @@ char * dns_text(char *dn) { int r; - + switch (r = dns_txtplus(dn)) { case DNS_MEM: @@ -362,7 +362,7 @@ uri_decode(char *str, size_t str_len, char **strend) { size_t i = 0, j = 0, found; int pasthostname = 0; - char *str_bits = "\r\n\t \'\"<>()"; + const char *str_bits = "\r\n\t \'\"<>()"; for (i = 0; i < str_len; i++, j++) { if (str[i] == '%' || (!pasthostname && str[i] == '=')) { @@ -767,7 +767,7 @@ checkuri(char **ouri, char **text, size_t textlen) print_debug(uri, ": not blacklisted", 0); break; case 1: - *text = "No reason given"; + *text = (char *) "No reason given"; blacklisted = 1; print_debug(uri, ": blacklisted. reason - ", *text); break; @@ -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 $"; + const char *x = "$Id: surblfilter.c,v 1.20 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } /* * $Log: surblfilter.c,v $ + * Revision 1.20 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.19 2024-01-23 01:23:51+05:30 Cprogrammer * include buffer_defs.h for buffer size definitions * diff --git a/indimail-mta-x/syncdir.c b/indimail-mta-x/syncdir.c index b666b01896..44c8b997a0 100644 --- a/indimail-mta-x/syncdir.c +++ b/indimail-mta-x/syncdir.c @@ -1,5 +1,8 @@ /* * $Log: syncdir.c,v $ + * Revision 1.13 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2022-04-06 09:19:56+05:30 Cprogrammer * added SYS_FDATASYNC * @@ -234,7 +237,7 @@ rename(const char *oldpath, const char *newpath) void getversion_syncdir_c() { - static char *x = "$Id: syncdir.c,v 1.12 2022-04-06 09:19:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: syncdir.c,v 1.13 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/sys-checkpwd.c b/indimail-mta-x/sys-checkpwd.c index edf21fe6ed..cfaaa55544 100644 --- a/indimail-mta-x/sys-checkpwd.c +++ b/indimail-mta-x/sys-checkpwd.c @@ -1,5 +1,5 @@ /* - * $Id: sys-checkpwd.c,v 1.21 2024-04-30 08:28:37+05:30 Cprogrammer Exp mbhangui $ + * $Id: sys-checkpwd.c,v 1.22 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * * Test method * printf "login\0pass\0\0\x01\0" >/tmp/input @@ -40,7 +40,7 @@ static int debug; void -print_error(char *str) +print_error(const char *str) { subprintf(subfdout, "454-%s: %s (#4.3.0)\r\n", str, error_str(errno)); if (substdio_flush(subfdout) == -1) @@ -48,7 +48,7 @@ print_error(char *str) } static int -runcmmd(char *cmmd) +runcmmd(const char *cmmd) { char **argv; int status, i, werr, retval; @@ -146,7 +146,6 @@ pipe_exec(char **argv, char *tmpbuf, int len, int restore) strerr_die3sys(111, FATAL, "exec: ", argv[1]); } - int main(int argc, char **argv) { @@ -262,7 +261,7 @@ main(int argc, char **argv) strerr_die4sys(111, FATAL, "setuid: uid(", strnum, "):"); if (env_get("DEBUG_LOGIN")) { i = str_rchr(argv[0], '/'); - ptr = get_authmethod(auth_method); + ptr = (char *) get_authmethod(auth_method); subprintf(subfderr, "%s: uid=%u, login=%s, challenge=%s, response=%s, encrypted=%s, CRAM=%s AUTH=%s", argv[0][i] ? argv[0] + i + 1 : argv[0], @@ -283,7 +282,7 @@ main(int argc, char **argv) } else if (debug) { i = str_rchr(argv[0], '/'); - ptr = get_authmethod(auth_method); + ptr = (char *) get_authmethod(auth_method); subprintf(subfderr, "%s: uid=%u, login=%s, CRAM=%s AUTH=%s", argv[0][i] ? argv[0] + i + 1 : argv[0], getuid(), login, enable_cram ? "Yes" : "No", ptr); @@ -326,7 +325,7 @@ main(int argc, char **argv) void getversion_sys_checkpwd_c() { - static char *x = "$Id: sys-checkpwd.c,v 1.21 2024-04-30 08:28:37+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: sys-checkpwd.c,v 1.22 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidmakeargsh; x++; @@ -335,6 +334,9 @@ getversion_sys_checkpwd_c() /* * $Log: sys-checkpwd.c,v $ + * Revision 1.22 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.21 2024-04-30 08:28:37+05:30 Cprogrammer * display in logs if userpw, shadow is enabled for encrypted password lookup * diff --git a/indimail-mta-x/tablematch.c b/indimail-mta-x/tablematch.c index 60994a7108..17331912c9 100644 --- a/indimail-mta-x/tablematch.c +++ b/indimail-mta-x/tablematch.c @@ -1,5 +1,8 @@ /* * $Log: tablematch.c,v $ + * Revision 1.11 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.10 2023-01-03 17:45:14+05:30 Cprogrammer * Set hints.ai_socktype to SOCK_STREAM * @@ -68,7 +71,7 @@ my_strchr(char *str, char ch) -*/ int -matchinet(char *ip, char *token, char flag) +matchinet(const char *ip, const char *token, char flag) { char field1[8]; char field2[8]; @@ -93,7 +96,7 @@ matchinet(char *ip, char *token, char flag) if (inet_addr(token) != INADDR_NONE) return (0); else - for (match = idx1 = 0, ptr1 = token, ptr2 = ip; idx1 < 4 && match == idx1; idx1++) { + for (match = idx1 = 0, ptr1 = (char *) token, ptr2 = (char *) ip; idx1 < 4 && match == idx1; idx1++) { /*- IP Address in control file */ for (cptr = field1; *ptr1 && *ptr1 != '.'; *cptr++ = *ptr1++); *cptr = 0; @@ -194,15 +197,16 @@ matchinet(char *ip, char *token, char flag) * - indimail.org is allowed from any ip address (no IP restriction for indimail.org) */ int -tablematch(char *filename, char *ip, char *domain) +tablematch(const char *filename, const char *ip, const char *domain) { int len, count, nullflag, dmatch, imatch, exact_domain_match, exact_ip_match; + const char *x; char *ptr, *cptr; static stralloc hostacc = { 0 }; - if (!(ptr = env_get("HOSTACCESS"))) - ptr = filename; - if ((count = control_readfile(&hostacc, ptr, 0)) == -1) + if (!(x = env_get("HOSTACCESS"))) + x = filename; + if ((count = control_readfile(&hostacc, x, 0)) == -1) return (-1); if (!count) /*- allow access if control file is absent */ return (1); @@ -254,7 +258,7 @@ tablematch(char *filename, char *ip, char *domain) void getversion_tablematch_c() { - static char *x = "$Id: tablematch.c,v 1.10 2023-01-03 17:45:14+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tablematch.c,v 1.11 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/tablematch.h b/indimail-mta-x/tablematch.h index 2e4ae34250..e568dcd9c6 100644 --- a/indimail-mta-x/tablematch.h +++ b/indimail-mta-x/tablematch.h @@ -1,5 +1,8 @@ /* * $Log: tablematch.h,v $ + * Revision 1.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2009-08-29 15:27:05+05:30 Cprogrammer * added flag argument to tablematch() * @@ -9,6 +12,6 @@ */ #ifndef _TABLEMAT_H #define _TABLEMAT_H -int tablematch(char *, char *, char *); -int matchinet(char *, char *, char); +int tablematch(const char *, const char *, const char *); +int matchinet(const char *, const char *, char); #endif diff --git a/indimail-mta-x/tcp-env.c b/indimail-mta-x/tcp-env.c index 1e4c8d039b..51d7dedda8 100644 --- a/indimail-mta-x/tcp-env.c +++ b/indimail-mta-x/tcp-env.c @@ -1,5 +1,8 @@ /* * $Log: tcp-env.c,v $ + * Revision 1.15 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.14 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -333,7 +336,7 @@ main(int argc, char **argv) void getversion_tcp_env_c() { - static char *x = "$Id: tcp-env.c,v 1.14 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tcp-env.c,v 1.15 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/tcpto.c b/indimail-mta-x/tcpto.c index 384d86aa38..d9c3c9aa31 100644 --- a/indimail-mta-x/tcpto.c +++ b/indimail-mta-x/tcpto.c @@ -1,5 +1,8 @@ /* * $Log: tcpto.c,v $ + * Revision 1.17 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.16 2022-10-18 09:24:42+05:30 Cprogrammer * converted function proto to ansic * @@ -265,7 +268,7 @@ tcpto_err(struct ip_mx *ix, int flagerr, int max_tolerance) void getversion_tcpto_c() { - static char *x = "$Id: tcpto.c,v 1.16 2022-10-18 09:24:42+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tcpto.c,v 1.17 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; diff --git a/indimail-mta-x/tcpto_clean.c b/indimail-mta-x/tcpto_clean.c index 22b20e5d5f..c14e3cb716 100644 --- a/indimail-mta-x/tcpto_clean.c +++ b/indimail-mta-x/tcpto_clean.c @@ -1,5 +1,8 @@ /* * $Log: tcpto_clean.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2005-06-29 20:54:53+05:30 Cprogrammer * size of buffer changed to TCPTO_BUFSIZ * @@ -42,7 +45,7 @@ tcpto_clean() /*- running from queue/mess */ void getversion_tcpto_clean_c() { - static char *x = "$Id: tcpto_clean.c,v 1.7 2005-06-29 20:54:53+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: tcpto_clean.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/test-recipients.c b/indimail-mta-x/test-recipients.c index fd54203936..e16ff22713 100644 --- a/indimail-mta-x/test-recipients.c +++ b/indimail-mta-x/test-recipients.c @@ -1,5 +1,5 @@ /* - * $Id: test-recipients.c,v 1.3 2023-08-14 08:38:33+05:30 Cprogrammer Exp mbhangui $ + * $Id: test-recipients.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -33,10 +33,10 @@ safewrite(int fd, char *buf, int len) return r; } -char * +const char * load_virtual() { - char *ptr, *errstr; + const char *ptr, *errstr; int i; /*- load virtual package library */ @@ -63,7 +63,7 @@ load_virtual() int check_recipient_sql(char *addr, int len) { - char *ptr, *errstr; + const char *ptr, *errstr; void *(*inquery) (char, char *, char *); if (!(ptr = load_virtual())) diff --git a/indimail-mta-x/tests/test-indimail-mta b/indimail-mta-x/tests/test-indimail-mta index 8619d6da6e..5bddfa153e 100755 --- a/indimail-mta-x/tests/test-indimail-mta +++ b/indimail-mta-x/tests/test-indimail-mta @@ -3548,7 +3548,7 @@ test_restart_service_using_svc() test_multilog() { t1=$(date +"%s.%4N") - grep "HELO <$HOSTNAME> MAIL from <$user@$HOSTNAME> RCPT <$user@$HOSTNAME> AUTH Size: .* TLS=TLSv1.3" $logdir/smtpd/current >/dev/null + grep "HELO <.*> MAIL from <$user@$HOSTNAME> RCPT <$user@$HOSTNAME> AUTH Size: .* TLS=TLSv1.3" $logdir/smtpd/current >/dev/null if [ $? -eq 0 ] ; then t2=$(date +"%s.%4N") secs=$(echo $t1 $t2 | awk '{printf("%0.4f\n", $2-$1)}') diff --git a/indimail-mta-x/testzero.c b/indimail-mta-x/testzero.c index f168f22eb7..2482e0001c 100644 --- a/indimail-mta-x/testzero.c +++ b/indimail-mta-x/testzero.c @@ -1,5 +1,8 @@ /* * $Log: testzero.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -54,7 +57,7 @@ main(int argc, char **argv) void getversion_testzero_c() { - static char *x = "$Id: testzero.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: testzero.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/timeoutconn.c b/indimail-mta-x/timeoutconn.c index 805fce6f18..2c9c32714c 100644 --- a/indimail-mta-x/timeoutconn.c +++ b/indimail-mta-x/timeoutconn.c @@ -1,5 +1,8 @@ /* * $Log: timeoutconn.c,v $ + * Revision 1.18 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.17 2022-11-24 08:49:54+05:30 Cprogrammer * converted function declaration to ansic * @@ -74,7 +77,7 @@ socket_bind4(int s, char *bound, ip_addr *ipr) int iplen; stralloc routes = { 0 }; struct constmap bindroutes; - char *bindroute = (char *) 0; + const char *bindroute = (char *) 0; *bound = 0; /*- Right, do we actually have any bind routes? */ @@ -122,7 +125,7 @@ socket_bind6(int s, char *bound, ip6_addr *ipr) int iplen; stralloc routes = { 0 }; struct constmap bindroutes; - char *bindroute = (char *) 0; + const char *bindroute = (char *) 0; *bound = 0; /*- Right, do we actually have any bind routes? */ @@ -379,7 +382,7 @@ timeoutconn4(int s, ip_addr *ipr, union v46addr *ipl, unsigned int port, int tim void getversion_timeoutconn_c() { - static char *x = "$Id: timeoutconn.c,v 1.17 2022-11-24 08:49:54+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: timeoutconn.c,v 1.18 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/tlsacheck.c b/indimail-mta-x/tlsacheck.c index dbd54fbd78..54e23bb77b 100644 --- a/indimail-mta-x/tlsacheck.c +++ b/indimail-mta-x/tlsacheck.c @@ -1,5 +1,8 @@ /* * $Log: tlsacheck.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2018-05-27 22:14:32+05:30 mbhangui * added defintions for qmail-daned modes * @@ -50,7 +53,8 @@ scan_ip_port(daneip, defaultip, defaultport, ipp, portp) int n; unsigned long port; /* long because of scan_ulong */ #ifdef IPV6 - char *ptr, *ip_a; + char *ptr; + const char *ip_a; #endif #ifdef IPV6 @@ -63,7 +67,7 @@ scan_ip_port(daneip, defaultip, defaultport, ipp, portp) port = defaultport; } else { ip_a = (*daneip == '@' && !*(daneip + 1)) ? defaultip : daneip; - for (ptr = ip_a;*ptr;ptr++) { + for (ptr = (char *) ip_a; *ptr; ptr++) { if (*ptr == '@' && scan_ulong(ptr + 1, &port)) { *portp = port; break; @@ -178,7 +182,7 @@ tlsacheck(daneip, domain, qOru, rbuf, timeoutfn, errfn) void (*timeoutfn) (), (*errfn) (); /*- errfn must _exit */ { int r, len = 0, timeout = DANETIMEOUT; - char *ptr; + const char *ptr; char strnum[FMT_ULONG], z[IPFMT]; unsigned long port; union v46addr ip; @@ -261,7 +265,7 @@ tlsacheck(daneip, domain, qOru, rbuf, timeoutfn, errfn) void getversion_tlsacheck_c() { - static char *x = "$Id: tlsacheck.c,v 1.3 2018-05-27 22:14:32+05:30 mbhangui Exp mbhangui $"; + const char *x = "$Id: tlsacheck.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/tlsarralloc.c b/indimail-mta-x/tlsarralloc.c index 62721c45ec..21605e932c 100644 --- a/indimail-mta-x/tlsarralloc.c +++ b/indimail-mta-x/tlsarralloc.c @@ -1,5 +1,8 @@ /* * $Log: tlsarralloc.c,v $ + * Revision 1.5 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-11-22 23:12:18+05:30 Cprogrammer * removed supression of ANSI C proto * @@ -23,7 +26,7 @@ GEN_ALLOC_append(tlsarralloc,struct tlsa_rdata,rr,len,a,10,tlsarralloc_readyplus void getversion_tlsarralloc_c() { - static char *x = "$Id: tlsarralloc.c,v 1.4 2020-11-22 23:12:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tlsarralloc.c,v 1.5 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/todo-proc.c b/indimail-mta-x/todo-proc.c index f8e5891b33..4d28ffb774 100644 --- a/indimail-mta-x/todo-proc.c +++ b/indimail-mta-x/todo-proc.c @@ -1,5 +1,5 @@ /* - * $Id: todo-proc.c,v 1.67 2023-12-23 23:56:26+05:30 Cprogrammer Exp mbhangui $ + * $Id: todo-proc.c,v 1.68 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -53,8 +53,9 @@ #define SLEEP_SYSFAIL 123 #define CHUNK_SIZE 1 -static stralloc percenthack = { 0 }; +typedef const char c_char; typedef struct constmap cmap; +static stralloc percenthack = { 0 }; static cmap mappercenthack; static cmap maplocals; @@ -69,12 +70,12 @@ static char mypid[FMT_ULONG]; /*- if qmail-send.c changes this has to be updated */ #define CHANNELS 2 -static char *chanaddr[CHANNELS] = { "local/", "remote/" }; +static c_char *chanaddr[CHANNELS] = { "local/", "remote/" }; static int flagexittodo = 0; static int flagdetached = 0; /*- allow todo-proc to stop sending new jobs to qmail-send */ -static char *queuedesc; -static char *argv0 = "todo-proc"; +static c_char *queuedesc; +static c_char *argv0 = "todo-proc"; static datetime_sec recent, nexttodorun; static stralloc fn = { 0 }; @@ -124,7 +125,7 @@ clockid_t clock_id; void #ifdef HAVE_STDARG_H -todo_log(char *s1, ...) +todo_log(const char *s1, ...) #else todo_log(va_alist) va_dcl @@ -132,16 +133,16 @@ va_dcl { int pos; va_list ap; - char *str; + const char *str; #ifndef HAVE_STDARG_H - char *s1; + const char *s1; #endif #ifdef HAVE_STDARG_H va_start(ap, s1); #else va_start(ap); - s1 = va_arg(ap, char *); + s1 = va_arg(ap, const char *); #endif pos = comm_buf.len; @@ -150,7 +151,7 @@ va_dcl goto fail; while (1) { - str = va_arg(ap, char *); + str = va_arg(ap, const char *); if (!str) break; if (!stralloc_cats(&comm_buf, str)) @@ -191,7 +192,7 @@ nomem() } void -pausedir(char *dir) +pausedir(const char *dir) { todo_log("alert: ", argv0, ": ", queuedesc, ": unable to opendir ", dir, ", sleeping...\n", NULL); sleep(10); @@ -238,13 +239,11 @@ fnmake_chanaddr(unsigned long id, int c) * taken from qmail-send.c */ int -rewrite(char *recip) +rewrite(const char *recip) { - int i; - int j; - char *x; + int i, j, at; + const char *x; static stralloc addr = { 0 }; - int at; if (!stralloc_copys(&rwline, "T") || !stralloc_copys(&addr, recip)) @@ -340,7 +339,7 @@ void comm_write(unsigned long id, int local, int remote) { int pos; - char *s; + const char *s; if (flagdetached) return; @@ -735,7 +734,7 @@ void log_stat(unsigned long id, size_t bytes) { char *ptr; - char *mode; + const char *mode; strnum1[fmt_ulong(strnum1 + 1, id) + 1] = 0; strnum2[fmt_ulong(strnum2 + 1, bytes) + 1] = 0; @@ -1432,7 +1431,7 @@ main(int argc, char **argv) void getversion_qmail_todo_c() { - static char *x = "$Id: todo-proc.c,v 1.67 2023-12-23 23:56:26+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: todo-proc.c,v 1.68 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -1440,6 +1439,9 @@ getversion_qmail_todo_c() /* * $Log: todo-proc.c,v $ + * Revision 1.68 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.67 2023-12-23 23:56:26+05:30 Cprogrammer * handle qmail-clean termination * diff --git a/indimail-mta-x/tokenize.c b/indimail-mta-x/tokenize.c index 15ea5fcd82..b219dc1443 100644 --- a/indimail-mta-x/tokenize.c +++ b/indimail-mta-x/tokenize.c @@ -1,5 +1,8 @@ /* * $Log: tokenize.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-08-29 23:27:08+05:30 Cprogrammer * define functions as noreturn * @@ -102,7 +105,7 @@ main() void getversion_tokenize_c() { - static char *x = "$Id: tokenize.c,v 1.3 2021-08-29 23:27:08+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tokenize.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/trigger.c b/indimail-mta-x/trigger.c index 67443d8165..7d9391d081 100644 --- a/indimail-mta-x/trigger.c +++ b/indimail-mta-x/trigger.c @@ -1,5 +1,8 @@ /* * $Log: trigger.c,v $ + * Revision 1.4 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2022-01-30 09:44:59+05:30 Cprogrammer * added trigger_clear() function to remove lock/trigger from watched fds for select() * @@ -65,7 +68,7 @@ trigger_clear(int *nfds, fd_set *rfds) void getversion_trigger_c() { - static char *x = "$Id: trigger.c,v 1.3 2022-01-30 09:44:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: trigger.c,v 1.4 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/triggerpull.c b/indimail-mta-x/triggerpull.c index 973c2ab8d7..d57f66047b 100644 --- a/indimail-mta-x/triggerpull.c +++ b/indimail-mta-x/triggerpull.c @@ -1,5 +1,8 @@ /* * $Log: triggerpull.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2020-09-16 19:08:30+05:30 Cprogrammer * fix compiler warning for FreeBSD * @@ -34,7 +37,7 @@ triggerpull() void getversion_triggerpull_c() { - static char *x = "$Id: triggerpull.c,v 1.6 2020-09-16 19:08:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: triggerpull.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/typesx.h b/indimail-mta-x/typesx.h index 993c204a6e..ddfa26a57a 100644 --- a/indimail-mta-x/typesx.h +++ b/indimail-mta-x/typesx.h @@ -1,5 +1,8 @@ /* * $Log: typesx.h,v $ + * Revision 2.3 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 2.2 2011-12-05 15:10:27+05:30 Cprogrammer * added RCS id * @@ -8,7 +11,7 @@ #define MISC_TYPES_H #ifndef lint -static char sccsidtypesxh[] = "$Id: typesx.h,v 2.2 2011-12-05 15:10:27+05:30 Cprogrammer Stab mbhangui $"; +static const char sccsidtypesxh[] = "$Id: typesx.h,v 2.3 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif #include diff --git a/indimail-mta-x/uacl.c b/indimail-mta-x/uacl.c index d183916078..264fb690ae 100644 --- a/indimail-mta-x/uacl.c +++ b/indimail-mta-x/uacl.c @@ -1,5 +1,8 @@ /* * $Log: uacl.c,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2023-10-24 20:10:30+05:30 Cprogrammer * use matchregex.h from /usr/include/qmail * @@ -111,7 +114,7 @@ die_usage() } no_return void -die_regex(char *str) +die_regex(const char *str) { substdio_puts(subfderr, "uacl: regex failed: "); substdio_puts(subfderr, str); @@ -147,7 +150,7 @@ main(int argc, char **argv) void getversion_uacl_c() { - static char *x = "$Id: uacl.c,v 1.9 2023-10-24 20:10:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: uacl.c,v 1.10 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidwildmath; x++; diff --git a/indimail-mta-x/udpclient.c b/indimail-mta-x/udpclient.c index 9aff9e36c6..9e34a84ac1 100644 --- a/indimail-mta-x/udpclient.c +++ b/indimail-mta-x/udpclient.c @@ -1,5 +1,8 @@ /* * $Log: udpclient.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2022-05-10 20:56:17+05:30 Cprogrammer * use headers from standard include path * @@ -32,12 +35,12 @@ #include #include -char *usage = "usage: udpclient [-h host] [-p port] [-r responsesize] [-t timeout] message message ..."; +const char *usage = "usage: udpclient [-h host] [-p port] [-r responsesize] [-t timeout] message message ..."; #define FATAL "udpclient: fatal: " void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -114,7 +117,7 @@ main(int argc, char **argv) void getversion_udpclient_c() { - static char *x = "$Id: udpclient.c,v 1.7 2022-05-10 20:56:17+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: udpclient.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/udplogger.c b/indimail-mta-x/udplogger.c index ba0e581bf3..bbe4cf2b3c 100644 --- a/indimail-mta-x/udplogger.c +++ b/indimail-mta-x/udplogger.c @@ -1,5 +1,8 @@ /* * $Log: udplogger.c,v $ + * Revision 1.8 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2023-01-04 00:15:14+05:30 Cprogrammer * removed __USE_GNU * @@ -92,7 +95,7 @@ die_write() } void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -110,7 +113,7 @@ flush() } void -logerr(char *str) +logerr(const char *str) { if (!str || !*str) return; @@ -120,7 +123,7 @@ logerr(char *str) } void -logerrf(char *str) +logerrf(const char *str) { if (!str || !*str) return; @@ -164,7 +167,7 @@ main(int argc, char **argv) char strnum[FMT_ULONG]; unsigned long timeout; char *ipaddr = 0; - char *usage = "usage: udplogger [-t timeout] [-p port] ipaddr:port"; + const char *usage = "usage: udplogger [-t timeout] [-p port] ipaddr:port"; char serv[FMT_ULONG]; #if defined(LIBC_HAS_IP6) && defined(IPV6) int noipv6 = 0; @@ -396,7 +399,7 @@ main(int argc, char **argv) void getversion_udplogger_c() { - static char *x = "$Id: udplogger.c,v 1.7 2023-01-04 00:15:14+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: udplogger.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/variables.c b/indimail-mta-x/variables.c index a405866a76..05f55f7b1d 100644 --- a/indimail-mta-x/variables.c +++ b/indimail-mta-x/variables.c @@ -1,5 +1,8 @@ /* * $Log: variables.c,v $ + * Revision 1.6 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2018-05-30 23:26:40+05:30 Cprogrammer * moved noipv6 variable to variables.c * @@ -13,9 +16,9 @@ * added RCS log * */ -char *queuedir; -char *controldir; -char *certdir; +const char *queuedir; +const char *controldir; +const char *certdir; #include "haveip6.h" #ifdef LIBC_HAS_IP6 @@ -27,7 +30,7 @@ int noipv6 = 1; void getversion_variables_c() { - static char *x = "$Id: variables.c,v 1.5 2018-05-30 23:26:40+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: variables.c,v 1.6 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/variables.h b/indimail-mta-x/variables.h index 616cf3ade1..28dccbe5fd 100644 --- a/indimail-mta-x/variables.h +++ b/indimail-mta-x/variables.h @@ -1,5 +1,8 @@ /* * $Log: variables.h,v $ + * Revision 1.10 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2022-04-04 11:17:50+05:30 Cprogrammer * added use_fdatasync to turn on fdatasync() instead of fsync() * @@ -25,9 +28,10 @@ #ifndef VARIABLES_H #define VARIABLES_H -extern char *queuedir; -extern char *controldir; -extern char *certdir; +typedef const char c_char; +extern c_char *queuedir; +extern c_char *controldir; +extern c_char *certdir; extern int use_fsync, use_fdatasync, use_syncdir; extern int noipv6; diff --git a/indimail-mta-x/whois.c b/indimail-mta-x/whois.c index d44f8384c6..64d29356a2 100644 --- a/indimail-mta-x/whois.c +++ b/indimail-mta-x/whois.c @@ -1,5 +1,8 @@ /* * $Log: whois.c,v $ + * Revision 1.7 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2023-07-13 02:49:30+05:30 Cprogrammer * replaced logerr(), logerrf() with subprintf() * @@ -40,14 +43,14 @@ #define FATAL "whois: fatal: " int get_whois_data(char *); -int whois_query(char *, char *, stralloc *); +int whois_query(const char *, char *, stralloc *); static int verbose; static stralloc whois_server = {0}, response_1 = {0}, response_2 = {0}, message = {0}; void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -207,12 +210,12 @@ get_whois_data(char *domain) * Perform a whois query to a server and record the response */ int -whois_query(char *server, char *query, stralloc *response) +whois_query(const char *server, char *query, stralloc *response) { char buffer[1500]; int sock, read_size; - if ((sock = tcpopen(server, "nicname", 0)) == -1) + if ((sock = tcpopen(server, (char *) "nicname", 0)) == -1) strerr_die4sys(111, FATAL, "tcpopen: ", server, ": "); if (verbose) { subprintf(subfderr, "querying %s for %s\n", server, query); @@ -239,7 +242,7 @@ whois_query(char *server, char *query, stralloc *response) void getversion_whois_c() { - static char *x = "$Id: whois.c,v 1.6 2023-07-13 02:49:30+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: whois.c,v 1.7 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/indimail-mta-x/wildmat.c b/indimail-mta-x/wildmat.c index 29324003dc..9e8423a9db 100644 --- a/indimail-mta-x/wildmat.c +++ b/indimail-mta-x/wildmat.c @@ -39,7 +39,7 @@ /*- Match text and p, return TRUE, FALSE, or ABORT. */ static int -DoMatch(register char *text, register char *p) +DoMatch(register const char *text, register const char *p) { register int last; register int matched; @@ -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') @@ -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 $"; + const char *x = "$Id: wildmat.c,v 1.8 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x = sccsidwildmath; x++; diff --git a/indimail-mta-x/wildmat.h b/indimail-mta-x/wildmat.h index 6c31ff212a..c5f903dbf3 100644 --- a/indimail-mta-x/wildmat.h +++ b/indimail-mta-x/wildmat.h @@ -1,5 +1,8 @@ /* * $Log: wildmat.h,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2021-05-23 06:35:07+05:30 Cprogrammer * Initial revision * @@ -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 const char sccsidwildmath[] = "$Id: wildmat.h,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; #endif #ifndef TRUE @@ -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 diff --git a/indimail-mta-x/yearcal.c b/indimail-mta-x/yearcal.c index 20e7f7c15e..cdbcf167d7 100644 --- a/indimail-mta-x/yearcal.c +++ b/indimail-mta-x/yearcal.c @@ -1,5 +1,8 @@ /* * $Log: yearcal.c,v $ + * Revision 1.2 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2016-01-28 23:42:18+05:30 Cprogrammer * Initial revision * @@ -8,7 +11,7 @@ #include #include "caldate.h" -char *montab[] = { +const char *montab[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -66,7 +69,7 @@ main(argc, argv) void getversion_yearcal_c() { - static char *x = "$Id: yearcal.c,v 1.1 2016-01-28 23:42:18+05:30 Cprogrammer Stab mbhangui $"; + const char *x = "$Id: yearcal.c,v 1.2 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/libdkim2-x/create_rpm b/libdkim2-x/create_rpm index 7a8cdcb073..e02b589cd4 100755 --- a/libdkim2-x/create_rpm +++ b/libdkim2-x/create_rpm @@ -1,5 +1,8 @@ #!/bin/sh # $Log: create_rpm,v $ +# Revision 1.7 2024-05-09 23:24:51+05:30 Cprogrammer +# use x.y for release +# # Revision 1.6 2023-07-07 20:59:31+05:30 Cprogrammer # renamed libdkim to libdkim2 # @@ -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-09 23:24:51+05:30 Cprogrammer Exp mbhangui $ # curdir=`pwd` version=$(cat conf-version) @@ -107,23 +110,19 @@ 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 .. @@ -131,16 +130,16 @@ if [ $copy_src -eq 1 ] ; then 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 @@ -148,6 +147,7 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then cd .. fi fi + dist=`uname -r |cut -d . -f4` if [ $verbose -eq 0 ] ; then echo "rpmbuild -ba $clean --quiet /tmp/$name.spec" rpmbuild -ba $clean --quiet /tmp/$name.spec @@ -158,22 +158,22 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then 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 diff --git a/libdkim2-x/dkim.cpp b/libdkim2-x/dkim.cpp index fad254ec2c..c1504e620b 100644 --- a/libdkim2-x/dkim.cpp +++ b/libdkim2-x/dkim.cpp @@ -124,10 +124,10 @@ SignThisHeader(const char *szHeader) return 1; } -unsigned int str_chr(char *s, int c) +unsigned int str_chr(const char *s, int c) { char ch; - char *t; + const char *t; ch = c; t = s; @@ -240,7 +240,7 @@ void dkim_error(int e) { const char *ptr; - + if ((ptr = dkim_error_str(e, 0))) fprintf(stderr, "%s\n", ptr); return; @@ -251,28 +251,28 @@ dkim_error(int e) */ void writeHeader(int ret, int resDKIMSSP, int resDKIMADSP, int useSSP, int useADSP ) { - char *dkimStatus, *sspStatus, *adspStatus; + const char *dkimStatus, *sspStatus, *adspStatus; - sspStatus = adspStatus = (char *) ""; - dkimStatus = (char *) dkim_error_str(ret, 1); + sspStatus = adspStatus = ""; + dkimStatus = dkim_error_str(ret, 1); if (useSSP && resDKIMSSP != -1) { switch(resDKIMSSP) { case DKIM_SSP_ALL: - sspStatus = (char *) "all;"; + sspStatus = "all;"; break; case DKIM_SSP_STRICT: - sspStatus = (char *) "strict;"; + sspStatus = "strict;"; break; case DKIM_SSP_SCOPE: - sspStatus = (char *) "out of scope;"; + sspStatus = "out of scope;"; break; case DKIM_SSP_TEMPFAIL: - sspStatus = (char *) "temporary failure;"; + sspStatus = "temporary failure;"; break; case DKIM_SSP_UNKNOWN: default: - sspStatus = (char *) "unknown;"; + sspStatus = "unknown;"; break; } } @@ -280,20 +280,20 @@ void writeHeader(int ret, int resDKIMSSP, int resDKIMADSP, int useSSP, int useAD switch(resDKIMADSP) { case DKIM_ADSP_ALL: - adspStatus = (char *) "all;"; + adspStatus = "all;"; break; case DKIM_ADSP_DISCARDABLE: - adspStatus = (char *) "discardable;"; + adspStatus = "discardable;"; break; case DKIM_ADSP_SCOPE: - adspStatus = (char *) "out of scope;"; + adspStatus = "out of scope;"; break; case DKIM_ADSP_TEMPFAIL: - adspStatus = (char *) "temporary failure;"; + adspStatus = "temporary failure;"; break; case DKIM_ADSP_UNKNOWN: default: - adspStatus = (char *) "unknown;"; + adspStatus = "unknown;"; break; } } @@ -354,7 +354,7 @@ ParseTagValues(char *list, char *letters[], char *values[]) } int -GetSSP(char *domain, int *bTesting) +GetSSP(const char *domain, int *bTesting) { char *query, *results; char *tags[] = { (char *) "dkim", (char *) "t", (char *) 0}; @@ -427,7 +427,7 @@ GetSSP(char *domain, int *bTesting) } int -GetADSP(char *domain) +GetADSP(const char *domain) { char *query, *results; char *tags[] = {(char *) "dkim", (char *) 0}; @@ -848,7 +848,7 @@ main(int argc, char **argv) if (ret < 0 || ret == DKIM_3PS_SIGNATURE) { if (useADSP) { char *domain; - + if ((domain = DKIMVerifyGetDomain(&ctxt))) resDKIMADSP = GetADSP(domain); if (sCount > 0) { @@ -909,13 +909,16 @@ main(int argc, char **argv) void getversion_dkim_c() { - static char *x = (char *) "$Id: dkim.cpp,v 1.36 2024-01-06 21:26:06+05:30 Cprogrammer Exp mbhangui $"; + static char *x = (char *) "$Id: dkim.cpp,v 1.37 2024-05-07 12:55:27+05:30 Cprogrammer Exp mbhangui $"; x++; } /* * $Log: dkim.cpp,v $ + * Revision 1.37 2024-05-07 12:55:27+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.36 2024-01-06 21:26:06+05:30 Cprogrammer * added new error code DKIM_BAD_IDENTITY for invalid identity domain (i= tag) * diff --git a/libdkim2-x/dkim.h b/libdkim2-x/dkim.h index ee36e45c19..79441ffaeb 100644 --- a/libdkim2-x/dkim.h +++ b/libdkim2-x/dkim.h @@ -157,10 +157,10 @@ typedef struct DKIMVerifyDetails_t { int DKIM_CALL DKIMSignInit(DKIMContext *pSignContext, DKIMSignOptions *pOptions); int DKIM_CALL DKIMSignProcess(DKIMContext *pSignContext, char *szBuffer, int nBufLength); -int DKIM_CALL DKIMSignGetSig(DKIMContext *pSignContext, char *szPrivKey, char *szSignature, int nSigLength); -int DKIM_CALL DKIMSignGetSig2(DKIMContext *pSignContext, char *szPrivKey, char **pszSignature); +int DKIM_CALL DKIMSignGetSig(DKIMContext *pSignContext, const char *szPrivKey, char *szSignature, int nSigLength); +int DKIM_CALL DKIMSignGetSig2(DKIMContext *pSignContext, const char *szPrivKey, char **pszSignature); void DKIM_CALL DKIMSignFree(DKIMContext *pSignContext); -char *DKIM_CALL DKIMSignGetDomain(DKIMContext *pSignContext); +const char *DKIM_CALL DKIMSignGetDomain(DKIMContext *pSignContext); int DKIM_CALL DKIMVerifyInit(DKIMContext *pVerifyContext, DKIMVerifyOptions *pOptions); int DKIM_CALL DKIMVerifyProcess(DKIMContext *pVerifyContext, char *szBuffer, int nBufLength); @@ -169,7 +169,7 @@ int DKIM_CALL DKIMVerifyGetDetails(DKIMContext *pVerifyContext, int *nSigCount char *DKIM_CALL DKIMVerifyGetDomain(DKIMContext *pVerifyContext); void DKIM_CALL DKIMVerifyFree(DKIMContext *pVerifyContext); char *DKIM_CALL DKIMVersion(); -char *DKIM_CALL DKIMGetErrorString(int ErrorCode); +const char *DKIM_CALL DKIMGetErrorString(int ErrorCode); int DKIM_CALL DKIMSignReplaceSelector(DKIMContext *pSignContext, DKIMSignOptions *pOptions); int DKIM_CALL DKIMSignReplaceHash(DKIMContext *pSignContext, DKIMSignOptions *pOptions); #include "macros.h" @@ -179,6 +179,9 @@ int DKIM_CALL DKIMSignReplaceHash(DKIMContext *pSignContext, DKIMSignOptions * /* * $Log: dkim.h,v $ + * Revision 1.16 2024-05-07 12:55:54+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.15 2024-01-09 19:14:43+05:30 Cprogrammer * re-arranged DKIM error codes * diff --git a/libdkim2-x/dkimfuncs.cpp b/libdkim2-x/dkimfuncs.cpp index d6f535885c..8a6ca31b26 100644 --- a/libdkim2-x/dkimfuncs.cpp +++ b/libdkim2-x/dkimfuncs.cpp @@ -1,5 +1,8 @@ /* * $Log: dkimfuncs.cpp,v $ + * Revision 1.7 2024-05-07 12:55:50+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.6 2023-02-01 18:02:03+05:30 Cprogrammer * new function DKIMSignReplaceHash to alter current Hash method * @@ -19,21 +22,21 @@ * Initial revision * * - * Copyright 2005 Alt-N Technologies, Ltd. + * Copyright 2005 Alt-N Technologies, Ltd. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * This code incorporates intellectual property owned by Yahoo! and licensed + * This code incorporates intellectual property owned by Yahoo! and licensed * pursuant to the Yahoo! DomainKeys Patent License Agreement. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. * */ @@ -111,7 +114,7 @@ DKIMSignProcess(DKIMContext *pSignContext, char *szBuffer, int nBufLength) } int DKIM_CALL -DKIMSignGetSig(DKIMContext *pSignContext, char *szPrivKey, char *szSignature, int nSigLength) +DKIMSignGetSig(DKIMContext *pSignContext, const char *szPrivKey, char *szSignature, int nSigLength) { CDKIMSign *pSign = (CDKIMSign *) ValidateContext(pSignContext, true); if (pSign) @@ -120,7 +123,7 @@ DKIMSignGetSig(DKIMContext *pSignContext, char *szPrivKey, char *szSignature, in } int DKIM_CALL -DKIMSignGetSig2(DKIMContext *pSignContext, char *szPrivKey, char **pszSignature) +DKIMSignGetSig2(DKIMContext *pSignContext, const char *szPrivKey, char **pszSignature) { CDKIMSign *pSign = (CDKIMSign *) ValidateContext(pSignContext, true); if (pSign) @@ -128,7 +131,7 @@ DKIMSignGetSig2(DKIMContext *pSignContext, char *szPrivKey, char **pszSignature) return DKIM_INVALID_CONTEXT; } -char *DKIM_CALL +const char *DKIM_CALL DKIMSignGetDomain(DKIMContext *pSignContext) { CDKIMSign *pSign = (CDKIMSign *) ValidateContext(pSignContext, true); @@ -243,7 +246,7 @@ static char *DKIMErrorStrings[-1 - DKIM_MAX_ERROR] = { (char *) "DKIM_BUFFER_TOO_SMALL" }; -char *DKIM_CALL +const char *DKIM_CALL DKIMGetErrorString(int ErrorCode) { if (ErrorCode >= 0 || ErrorCode <= DKIM_MAX_ERROR) @@ -256,7 +259,7 @@ DKIMGetErrorString(int ErrorCode) void getversion_dkimfuncs_cpp() { - static char *x = (char *) "$Id: dkimfuncs.cpp,v 1.6 2023-02-01 18:02:03+05:30 Cprogrammer Exp mbhangui $"; + static char *x = (char *) "$Id: dkimfuncs.cpp,v 1.7 2024-05-07 12:55:50+05:30 Cprogrammer Exp mbhangui $"; x++; } diff --git a/libdkim2-x/dkimsign.cpp b/libdkim2-x/dkimsign.cpp index ca5ccf3828..3d14dc5fb2 100644 --- a/libdkim2-x/dkimsign.cpp +++ b/libdkim2-x/dkimsign.cpp @@ -585,7 +585,7 @@ void CDKIMSign::AddFoldedValueToSig(const string &sValue, char cbrk) /* * GetSig - compute hash and return signature header in szSignature */ -int CDKIMSign::GetSig(char *szPrivKey, char *szSignature, unsigned int nSigLength) +int CDKIMSign::GetSig(const char *szPrivKey, char *szSignature, unsigned int nSigLength) { if (szPrivKey == NULL) return DKIM_BAD_PRIVATE_KEY; @@ -605,7 +605,7 @@ int CDKIMSign::GetSig(char *szPrivKey, char *szSignature, unsigned int nSigLengt /* * GetSig - compute hash and return signature header in szSignature */ -int CDKIMSign::GetSig2(char *szPrivKey, char **pszSignature) +int CDKIMSign::GetSig2(const char *szPrivKey, char **pszSignature) { if (szPrivKey == NULL) return DKIM_BAD_PRIVATE_KEY; @@ -644,7 +644,7 @@ bool CDKIMSign::IsRequiredHeader(const string &sTag) } int -CDKIMSign::ConstructSignature(char *szPrivKey, int nSigAlg) +CDKIMSign::ConstructSignature(const char *szPrivKey, int nSigAlg) { string sSignedSig, sTemp; unsigned char *sig = NULL; @@ -790,7 +790,8 @@ CDKIMSign::ConstructSignature(char *szPrivKey, int nSigAlg) BIO_free_all(b64); return DKIM_OUT_OF_MEMORY; } - BIO_flush(b64); + if (BIO_flush(b64) <= 0) + return DKIM_OUT_OF_MEMORY; len = nHashLen * 2; if (!(buf = new char[len])) { BIO_free_all(b64); @@ -839,7 +840,7 @@ CDKIMSign::ConstructSignature(char *szPrivKey, int nSigAlg) #endif } - if (!(bio = BIO_new_mem_buf(szPrivKey, -1))) + if (!(bio = BIO_new_mem_buf((char *) szPrivKey, -1))) return DKIM_OUT_OF_MEMORY; if (!(pkey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL))) { BIO_free(bio); @@ -905,7 +906,8 @@ CDKIMSign::ConstructSignature(char *szPrivKey, int nSigAlg) BIO_free_all(b64); return DKIM_OUT_OF_MEMORY; } - BIO_flush(b64); + if (BIO_flush(b64) <= 0) + return DKIM_OUT_OF_MEMORY; OPENSSL_free(sig); len = siglen * 2; if (!(buf = new char[len])) { @@ -926,7 +928,7 @@ CDKIMSign::ConstructSignature(char *szPrivKey, int nSigAlg) } int -CDKIMSign::AssembleReturnedSig(char *szPrivKey) +CDKIMSign::AssembleReturnedSig(const char *szPrivKey) { int nRet; @@ -990,13 +992,19 @@ CDKIMSign::AssembleReturnedSig(char *szPrivKey) void getversion_dkimsign_cpp() { - static char *x = (char *) "$Id: dkimsign.cpp,v 1.27 2023-11-20 10:09:06+05:30 Cprogrammer Exp mbhangui $"; + static char *x = (char *) "$Id: dkimsign.cpp,v 1.29 2024-05-07 15:23:33+05:30 Cprogrammer Exp mbhangui $"; x++; } /* * $Log: dkimsign.cpp,v $ + * Revision 1.29 2024-05-07 15:23:33+05:30 Cprogrammer + * fix for rhel7, sles12 + * + * Revision 1.28 2024-05-07 12:56:03+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.27 2023-11-20 10:09:06+05:30 Cprogrammer * exclude Arc-Authentication-Results header from signing * diff --git a/libdkim2-x/dkimsign.h b/libdkim2-x/dkimsign.h index b4ded1e74c..f43630b70e 100644 --- a/libdkim2-x/dkimsign.h +++ b/libdkim2-x/dkimsign.h @@ -31,8 +31,8 @@ class CDKIMSign:public CDKIMBase { int Init(DKIMSignOptions *pOptions); void ReplaceSelector(DKIMSignOptions *pOptions); void ReplaceHash(DKIMSignOptions *pOptions); - int GetSig(char *szPrivKey, char *szSignature, unsigned int nSigLength); - int GetSig2(char *szPrivKey, char **pszSignature); + int GetSig(const char *szPrivKey, char *szSignature, unsigned int nSigLength); + int GetSig2(const char *szPrivKey, char **pszSignature); virtual int ProcessHeaders(void); virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF); enum CKDKIMConstants { OptimalHeaderLineLength = 65 }; @@ -50,8 +50,8 @@ class CDKIMSign:public CDKIMBase { void AddInterTagSpace(int nSizeOfNextTag); void AddFoldedValueToSig(const string &sValue, char cbrk); bool IsRequiredHeader(const string &sTag); - int ConstructSignature(char *szPrivKey, int nSigAlg); - int AssembleReturnedSig(char *szPrivKey); + int ConstructSignature(const char *szPrivKey, int nSigAlg); + int AssembleReturnedSig(const char *szPrivKey); #if OPENSSL_VERSION_NUMBER >= 0x10100000L EVP_MD_CTX *m_Hdr_ietf_sha1ctx = NULL; /* the header hash for ietf sha1 */ EVP_MD_CTX *m_Bdy_ietf_sha1ctx = NULL; /* the body hash for ietf sha1 */ @@ -100,6 +100,9 @@ class CDKIMSign:public CDKIMBase { /* * $Log: dkimsign.h,v $ + * Revision 1.12 2024-05-07 12:56:06+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.11 2023-02-04 18:06:15+05:30 Cprogrammer * fixed formatting * diff --git a/libdkim2-x/dkimverify.cpp b/libdkim2-x/dkimverify.cpp index 5cf47f88ce..3c7ef56645 100644 --- a/libdkim2-x/dkimverify.cpp +++ b/libdkim2-x/dkimverify.cpp @@ -471,7 +471,7 @@ CDKIMVerify::GetResults(int *sCount, int *sSize) } } #if OPENSSL_VERSION_NUMBER >= 0x10101000L - else + else if (EVP_PKEY_base_id(i->m_pSelector->PublicKey) == EVP_PKEY_ED25519) { res = EVP_DigestVerifyInit(i->m_Msg_ctx, NULL, NULL, NULL, i->m_pSelector->PublicKey); /* late initialization */ @@ -779,7 +779,7 @@ ParseUnsigned(const char *s, unsigned long *result) /*- - * ParseDKIMSignature - Parse a DKIM-Signature header field + * ParseDKIMSignature - Parse a DKIM-Signature header field * The received DKIM header includes two cryptographic relevant informations: * * a) The 'body hash' => bh=[sha1|sha256] - values[12] @@ -977,7 +977,7 @@ CDKIMVerify::ParseDKIMSignature(const string &sHeader, SignatureInfo &sig) bool HasFrom = false, HasSubject = false; RemoveSWSP(values[4]); /*- header names shouldn't have spaces in them so this should be ok... */ char *s = strtok_r(values[4], ":", &saveptr); - + while (s != NULL) { if (_stricmp(s, "From") == 0) HasFrom = true; @@ -1301,13 +1301,16 @@ CDKIMVerify::GetDomain(void) void getversion_dkimverify_cpp() { - static char *x = (char *) "$Id: dkimverify.cpp,v 1.34 2024-01-06 21:27:45+05:30 Cprogrammer Exp mbhangui $"; + static char *x = (char *) "$Id: dkimverify.cpp,v 1.35 2024-05-07 12:56:13+05:30 Cprogrammer Exp mbhangui $"; x++; } /* * $Log: dkimverify.cpp,v $ + * Revision 1.35 2024-05-07 12:56:13+05:30 Cprogrammer + * removed extra wsp + * * Revision 1.34 2024-01-06 21:27:45+05:30 Cprogrammer * use DKIM_BAD_IDENTITY code for invalid identity (i= tag) * diff --git a/libdkim2-x/dns.cpp b/libdkim2-x/dns.cpp index 1117946bf9..3ac9f350ed 100644 --- a/libdkim2-x/dns.cpp +++ b/libdkim2-x/dns.cpp @@ -1,5 +1,8 @@ /* * $Log: dns.cpp,v $ + * Revision 1.14 2024-05-07 12:56:24+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.13 2021-07-20 23:20:18+05:30 Cprogrammer * removed use of register * @@ -71,7 +74,7 @@ static int numanswers; static char name[MAXDNAME]; static int -resolve(char *domain, int type) +resolve(const char *domain, int type) { int n, i; unsigned char *ptr; @@ -213,7 +216,7 @@ findtxt(int wanttype, int *txt_strlen) } static int -dns_txtplus(char *domain) +dns_txtplus(const char *domain) { int r, len, total; char *ptr; @@ -277,10 +280,10 @@ dns_txtplus(char *domain) * Note that it never returns NULL. */ char * -dns_text(char *dn) +dns_text(const char *dn) { int r; - + switch (r = dns_txtplus(dn)) { case DNS_MEM: @@ -337,7 +340,7 @@ DNSGetTXT(const char *domain, char *buffer, int maxlen) void getversion_dkimdns_cpp() { - static char *x = (char *) "$Id: dns.cpp,v 1.13 2021-07-20 23:20:18+05:30 Cprogrammer Exp mbhangui $"; + static char *x = (char *) "$Id: dns.cpp,v 1.14 2024-05-07 12:56:24+05:30 Cprogrammer Exp mbhangui $"; x++; } diff --git a/libdkim2-x/dns.h b/libdkim2-x/dns.h index c3f1bd9a16..22712d4bc6 100644 --- a/libdkim2-x/dns.h +++ b/libdkim2-x/dns.h @@ -1,5 +1,8 @@ /* * $Log: dns.h,v $ + * Revision 1.5 2024-05-07 12:56:28+05:30 Cprogrammer + * use const char * instead of char * + * * Revision 1.4 2017-05-16 12:40:39+05:30 Cprogrammer * define DNS_SOFT, DNS_HARD and DNS_MEM * @@ -51,4 +54,4 @@ // Pass in the FQDN to get the TXT record int DNSGetTXT(const char *szFQDN, char *Buffer, int nBufLen); -char *dns_text(char *szFQDN); +char *dns_text(const char *szFQDN); diff --git a/libdkim2-x/doc/ChangeLog b/libdkim2-x/doc/ChangeLog index 196b65f4f0..434a04858a 100644 --- a/libdkim2-x/doc/ChangeLog +++ b/libdkim2-x/doc/ChangeLog @@ -63,6 +63,8 @@ Release 1.7-1.1 Start 01/02/2023 End 09/01/2024 - 09/01/2024 21. dkim.h: re-arranged DKIM error codes. - 03/02/2024 - indimail-mta-3.0.7 +- 09/05/2024 +22. fix discarded-qualifier compiler warnings * Mon Jan 30 2023 13:14:56 +0000 Manvendra Bhangui 1.6-1.1%{?dist} Release 1.6 Start 27/11/2022 End 30/11/2023 diff --git a/ucspi-tcp-x/Makefile b/ucspi-tcp-x/Makefile index 8c9ba5c6a1..26acabe9f3 100644 --- a/ucspi-tcp-x/Makefile +++ b/ucspi-tcp-x/Makefile @@ -499,7 +499,7 @@ makelib upathexec_env.o socket_accept.o socket_bind.o socket_unix.o \ socket_conn.o socket_delay.o socket_listen.o socket_local.o \ socket_bindun.o socket_opts.o socket_opts6.o socket_remote.o \ socket_tcp.o socket_udp.o socket_conn6.o socket_bind6.o \ -socket_accept6.o socket_recv6.o socket_send6.o socket_local6.o \ +socket_accept6.o socket_local6.o \ socket_tcp6.o ip4_fmt.o ip6_fmt.o ip4_bit.o ip6_bit.o ip4_scan.o \ ip6_scan.o socket_getifname.o socket_getifidx.o socket_acceptun.o \ socket_v4mappedprefix.o socket_ip4loopback.o socket_v6any.o \ @@ -509,7 +509,7 @@ socket_conn_un.o timeoutconn_un.o socket_bind.o socket_bindun.o socket_conn.o socket_delay.o \ socket_listen.o socket_local.o socket_opts.o socket_opts6.o \ socket_remote.o socket_tcp.o socket_udp.o socket_conn6.o \ - socket_bind6.o socket_accept6.o socket_recv6.o socket_send6.o \ + socket_bind6.o socket_accept6.o \ socket_local6.o socket_tcp6.o ip4_fmt.o ip6_fmt.o ip4_bit.o \ ip6_bit.o ip4_scan.o ip6_scan.o socket_getifname.o socket_acceptun.o \ socket_getifidx.o socket_v4mappedprefix.o socket_ip4loopback.o \ @@ -536,14 +536,6 @@ socket_accept6.o: \ compile socket_accept6.c socket.h ip6.h haveip6.h conf-ip ./compile `grep -h -v "^#" conf-ip 2>/dev/null` socket_accept6.c -socket_recv6.o: \ -compile socket_recv6.c socket.h ip6.h haveip6.h conf-ip - ./compile `grep -h -v "^#" conf-ip 2>/dev/null` socket_recv6.c - -socket_send6.o: \ -compile socket_send6.c socket.h ip4.h ip6.h haveip6.h conf-ip - ./compile `grep -h -v "^#" conf-ip 2>/dev/null` socket_send6.c - socket_local6.o: \ compile socket_local6.c socket.h haveip6.h ip6.h haveip6.h conf-ip ./compile `grep -h -v "^#" conf-ip 2>/dev/null` socket_local6.c diff --git a/ucspi-tcp-x/TARGETS b/ucspi-tcp-x/TARGETS index e05ec735e9..d5a8af4bb3 100644 --- a/ucspi-tcp-x/TARGETS +++ b/ucspi-tcp-x/TARGETS @@ -153,3 +153,8 @@ dotls.1 upathexec_env.o upathexec_rundl.o upathexec_run.o +socket_acceptun.o +socket_bindun.o +socket_conn_un.o +socket_unix.o +timeoutconn_un.o diff --git a/ucspi-tcp-x/addcr.c b/ucspi-tcp-x/addcr.c index 97b704c5b5..12e261cf4c 100644 --- a/ucspi-tcp-x/addcr.c +++ b/ucspi-tcp-x/addcr.c @@ -1,5 +1,8 @@ /* * $Log: addcr.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-11-27 17:32:07+05:30 Cprogrammer * removed exit.h * @@ -42,7 +45,7 @@ main() void getversion_addcr_c() { - static char *x = "$Id: addcr.c,v 1.2 2020-11-27 17:32:07+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: addcr.c,v 1.3 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/ucspi-tcp-x/argv0.c b/ucspi-tcp-x/argv0.c index 1d55576ddc..e70ac3a489 100644 --- a/ucspi-tcp-x/argv0.c +++ b/ucspi-tcp-x/argv0.c @@ -1,5 +1,8 @@ /* * $Log: argv0.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2021-05-12 20:58:03+05:30 Cprogrammer * use upathexec_run() * @@ -24,7 +27,7 @@ main(int argc, char **argv, char **envp) void getversion_argv0_c() { - static char *x = "$Id: argv0.c,v 1.2 2021-05-12 20:58:03+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: argv0.c,v 1.3 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/ucspi-tcp-x/conf-cc-LINUX b/ucspi-tcp-x/conf-cc-LINUX index 89cdcee22b..9cc713c9a9 100644 --- a/ucspi-tcp-x/conf-cc-LINUX +++ b/ucspi-tcp-x/conf-cc-LINUX @@ -1,2 +1,2 @@ --Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings -Wno-discarded-qualifiers +-Wimplicit -fno-strict-aliasing -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-align -Wwrite-strings diff --git a/ucspi-tcp-x/control.c b/ucspi-tcp-x/control.c index de7112ac4c..19e742b394 100644 --- a/ucspi-tcp-x/control.c +++ b/ucspi-tcp-x/control.c @@ -1,5 +1,8 @@ /* * $Log: control.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:21:35+05:30 Cprogrammer * replaced buffer with substdio * @@ -20,13 +23,12 @@ #include #include "control.h" +typedef const char c_char; static char inbuf[64]; static stralloc line = { 0 }; int -control_readint(i, fn) - int *i; - char *fn; +control_readint(int *i, const char *fn) { unsigned long u; @@ -46,13 +48,11 @@ control_readint(i, fn) } int -control_readline(sa, fn) - stralloc *sa; - char *fn; +control_readline(stralloc *sa, const char *fn) { substdio ss; int fd, match; - static char *controldir; + static c_char *controldir; static stralloc controlfile = {0}; if (*fn != '/' && *fn != '.') { @@ -87,8 +87,7 @@ control_readline(sa, fn) } void -striptrailingwhitespace(sa) - stralloc *sa; +striptrailingwhitespace(stralloc *sa) { while (sa->len > 0) { switch (sa->s[sa->len - 1]) diff --git a/ucspi-tcp-x/control.h b/ucspi-tcp-x/control.h index 9b71cae077..95c113100b 100644 --- a/ucspi-tcp-x/control.h +++ b/ucspi-tcp-x/control.h @@ -1,5 +1,8 @@ /* * $Log: control.h,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2017-03-30 16:19:06+05:30 Cprogrammer * removed control_readfile() * @@ -14,7 +17,7 @@ #define CONTROL_H #include "stralloc.h" -int control_readint(int *, char *); -int control_readline(stralloc *, char *); +int control_readint(int *, const char *); +int control_readline(stralloc *, const char *); void striptrailingwhitespace(stralloc *); #endif diff --git a/ucspi-tcp-x/create_rpm b/ucspi-tcp-x/create_rpm index 24be26afef..dbfb240aa8 100755 --- a/ucspi-tcp-x/create_rpm +++ b/ucspi-tcp-x/create_rpm @@ -1,7 +1,10 @@ #!/bin/sh -# $Log: $ +# $Log: create_rpm,v $ +# Revision 1.1 2024-05-09 22:58:41+05:30 Cprogrammer +# Initial revision # -# $Id: $ +# +# $Id: create_rpm,v 1.1 2024-05-09 22:58:41+05:30 Cprogrammer Exp mbhangui $ # version=$(head -1 conf-version) ucspitcp_version=$(cat ../ucspi-tcp-x/conf-version) @@ -151,28 +154,25 @@ fi dist=`uname -r |cut -d . -f4` if [ -z "$release" ] ; then if [ -f /usr/bin/tcpserver ] ; then - idist=$(rpm -qf /usr/bin/tcpserver|cut -d- -f4|cut -d. -f3) - if [ " $dist" = " $idist" ] ; then - iversion=$(rpm -qf /usr/bin/tcpserver|cut -d- -f3) - if [ "$iversion" = "$version" ] ; then - release=$(rpm -qf /usr/bin/tcpserver | cut -d- -f4 | cut -d. -f2) - release=$(expr $release + 1) - else - release=1 - fi + uversion=$(rpm -qf /usr/bin/tcpserver|cut -d- -f3) + if [ "$uversion" = "$version" ] ; then + t1=$(rpm -qf /usr/bin/tcpserver | cut -d- -f4 | cut -d. -f1) + t2=$(rpm -qf /usr/bin/tcpserver | cut -d- -f4 | cut -d. -f2) + t2=$(expr $t2 + 1) + release="$t1.$t2" else - release=1 + release=0.1 fi else - release=1 + release=0.1 fi fi -echo -n "Build RPM for ucspi-tcp-"$version"-1."$release" (Y/N) - " +echo -n "Build RPM for ucspi-tcp-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then tmprel=`cat ucspi-tcp-x/conf-release 2>/dev/null` - if [ ! " $tmprel" = " 1.$release" ] ; then - echo 1.$release > ucspi-tcp-x/conf-release + if [ ! " $tmprel" = " $release" ] ; then + echo $release > ucspi-tcp-x/conf-release cd ucspi-tcp-x make SYSTEM=$SYSTEM ucspi-tcp.spec cp ucspi-tcp.spec /tmp @@ -192,17 +192,17 @@ if [ " $key" = " Y" -o " $key" = " y" ] ; then fi if [ $? -eq 0 ] ; then /bin/rm -f /tmp/ucspi-tcp.spec - rpm --addsign $rpmbuild/RPMS/$build_arch/ucspi-tcp-"$version"-"1.$release".$dist.$build_arch.rpm - rpm --addsign $rpmbuild/SRPMS/ucspi-tcp-"$version"-"1.$release".$dist.src.rpm - echo -n "RPM lint for ucspi-tcp-"$version"-1."$release" (Y/N) - " + rpm --addsign $rpmbuild/RPMS/$build_arch/ucspi-tcp-"$version"-"$release".$dist.$build_arch.rpm + rpm --addsign $rpmbuild/SRPMS/ucspi-tcp-"$version"-"$release".$dist.src.rpm + echo -n "RPM lint for ucspi-tcp-"$version"-"$release" (Y/N) - " read key if [ " $key" = " Y" -o " $key" = " y" ] ; then ( - echo ucspi-tcp-"$version"-"1.$release".$dist.rpm - rpmlint $rpmbuild/RPMS/$build_arch/ucspi-tcp-"$version"-"1.$release".$dist.$build_arch.rpm + echo ucspi-tcp-"$version"-"$release".$dist.rpm + rpmlint $rpmbuild/RPMS/$build_arch/ucspi-tcp-"$version"-"$release".$dist.$build_arch.rpm echo ------------------------ - echo ucspi-tcp-"$version"-"1.$release".$dist.src.rpm - rpmlint $rpmbuild/SRPMS/ucspi-tcp-"$version"-"1.$release".$dist.src.rpm + echo ucspi-tcp-"$version"-"$release".$dist.src.rpm + rpmlint $rpmbuild/SRPMS/ucspi-tcp-"$version"-"$release".$dist.src.rpm echo ------------------------ ) 2>&1 | less fi diff --git a/ucspi-tcp-x/delcr.c b/ucspi-tcp-x/delcr.c index 41f26bfa78..a6ab9b8f9e 100644 --- a/ucspi-tcp-x/delcr.c +++ b/ucspi-tcp-x/delcr.c @@ -1,5 +1,8 @@ /* * $Log: delcr.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-11-27 17:32:15+05:30 Cprogrammer * removed exit.h * @@ -66,7 +69,7 @@ main() void getversion_delcr_c() { - static char *x = "$Id: delcr.c,v 1.2 2020-11-27 17:32:15+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: delcr.c,v 1.3 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/ucspi-tcp-x/dlnamespace.c b/ucspi-tcp-x/dlnamespace.c index 6b2dc68b27..40ababe79e 100644 --- a/ucspi-tcp-x/dlnamespace.c +++ b/ucspi-tcp-x/dlnamespace.c @@ -1,5 +1,8 @@ /* * $Log: dlnamespace.c,v $ + * Revision 1.13 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2021-07-03 14:03:56+05:30 Cprogrammer * use Lmid_t data type for id instead of unsigned long * @@ -63,7 +66,7 @@ static stralloc namespace = {0}; * -1 - ENOMEM failure */ int -dlnamespace(char *fn, char **envp, Lmid_t *id) +dlnamespace(const char *fn, char **envp, Lmid_t *id) { char *ptr, *cptr, *s; int i, j; @@ -154,7 +157,7 @@ dlnamespace(char *fn, char **envp, Lmid_t *id) } #else int -dlnamespace(char *fn, unsigned long *id) +dlnamespace(const char *fn, unsigned long *id) { if (!id) { errno = EINVAL; @@ -170,7 +173,7 @@ dlnamespace(char *fn, unsigned long *id) void getversion_dlnamespace_c() { - static char *x = "$Id: dlnamespace.c,v 1.12 2021-07-03 14:03:56+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: dlnamespace.c,v 1.13 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/ucspi-tcp-x/dlnamespace.h b/ucspi-tcp-x/dlnamespace.h index d0cfc9d1e3..40111b71ff 100644 --- a/ucspi-tcp-x/dlnamespace.h +++ b/ucspi-tcp-x/dlnamespace.h @@ -1,5 +1,8 @@ /* * $Log: dlnamespace.h,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2021-07-03 14:04:26+05:30 Cprogrammer * use Lmid_t data type for id instead of unsigned long * @@ -16,6 +19,6 @@ #define _GNU_SOURCE #include -int dlnamespace(char *, char **, Lmid_t *); +int dlnamespace(const char *, char **, Lmid_t *); #endif diff --git a/ucspi-tcp-x/dns.h b/ucspi-tcp-x/dns.h index 8176354d82..d778dcda0b 100644 --- a/ucspi-tcp-x/dns.h +++ b/ucspi-tcp-x/dns.h @@ -1,5 +1,8 @@ /* * $Log: dns.h,v $ + * Revision 1.10 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.9 2021-05-12 20:59:50+05:30 Cprogrammer * define arguments as array subscripts to fix gcc 11 warnings * @@ -83,41 +86,39 @@ extern void dns_random_init(char data[128]); extern unsigned int dns_random(unsigned int); extern void dns_sortip(char *, unsigned int); extern void dns_domain_free(char **); -extern int dns_domain_copy(char **, char *); -extern unsigned int dns_domain_length(char *); -extern int dns_domain_equal(char *, char *); -extern int dns_domain_suffix(char *, char *); -extern int dns_domain_fromdot(char **, char *, unsigned int); -extern int dns_domain_todot_cat(stralloc *, char *); -extern unsigned int dns_packet_copy(char *, unsigned int, unsigned int, char *, unsigned int); -extern unsigned int dns_packet_getname(char *, unsigned int, unsigned int, char **); -extern unsigned int dns_packet_skipname(char *, unsigned int, unsigned int); -extern int dns_transmit_start(struct dns_transmit *, char servers[256], int, char *, char qtype[2], unsigned char localip[16]); +extern int dns_domain_copy(char **, const char *); +extern unsigned int dns_domain_length(const char *); +extern int dns_domain_equal(const char *, const char *); +extern int dns_domain_suffix(const char *, const char *); +extern int dns_domain_fromdot(char **, const char *, unsigned int); +extern int dns_domain_todot_cat(stralloc *, const char *); +extern unsigned int dns_packet_copy(const char *, unsigned int, unsigned int, char *, unsigned int); +extern unsigned int dns_packet_getname(const char *, unsigned int, unsigned int, char **); +extern unsigned int dns_packet_skipname(const char *, unsigned int, unsigned int); +extern int dns_transmit_start(struct dns_transmit *, char servers[256], int, const char *, const char qtype[2], unsigned char ip[16]); extern void dns_transmit_free(struct dns_transmit *); extern void dns_transmit_io(struct dns_transmit *, iopause_fd *, struct taia *); extern int dns_transmit_get(struct dns_transmit *, iopause_fd *, struct taia *); extern int dns_resolvconfip(char s[256]); -extern int dns_resolve(char *, char qtype[2]); -extern int dns_ip4_packet(stralloc *, char *, unsigned int); +extern int dns_resolve(const char *, const char qtype[2]); +extern int dns_ip4_packet(stralloc *, const char *, unsigned int); extern int dns_ip4(stralloc *, stralloc *); -extern int dns_name_packet(stralloc *, char *, unsigned int); +extern int dns_name_packet(stralloc *, const char *, unsigned int); extern void dns_name4_domain(char name[DNS_NAME4_DOMAIN], char ip[4]); extern int dns_name4(stralloc *, char ip[4]); -extern int dns_txt_packet(stralloc *, char *, unsigned int); +extern int dns_txt_packet(stralloc *, const char *, unsigned int); extern int rbl_dns_txt(stralloc *, stralloc *); -extern int dns_mx_packet(stralloc *, char *, unsigned int); extern int dns_mx(stralloc *, stralloc *); extern int dns_resolvconfrewrite(stralloc *); extern int dns_ip4_qualify_rules(stralloc *, stralloc *, stralloc *, stralloc *); extern int dns_ip4_qualify(stralloc *, stralloc *, stralloc *); -extern int dns_packet_nameequal(char *, unsigned int, unsigned int, char *, unsigned int, unsigned int); #ifdef LIBC_HAS_IP6 extern int dns_name6(stralloc *, char ip[16]); extern int dns_name6_domain(char name[DNS_NAME6_DOMAIN], char ip[16]); extern void dns_sortip6(char *, unsigned int); -extern unsigned int dns_domain_suffixpos(char *, char *); -extern int dns_ip6_packet(stralloc *, char *, unsigned int); +extern unsigned int dns_domain_suffixpos(const char *, const char *); +extern int dns_ip6_packet(stralloc *, const char *, unsigned int); extern int dns_ip6(stralloc *, stralloc *); extern int dns_ip6_qualify_rules(stralloc *, stralloc *, stralloc *, stralloc *); extern int dns_ip6_qualify(stralloc *, stralloc *, stralloc *); diff --git a/ucspi-tcp-x/dns_dfd.c b/ucspi-tcp-x/dns_dfd.c index 21387755f8..1c707cc125 100644 --- a/ucspi-tcp-x/dns_dfd.c +++ b/ucspi-tcp-x/dns_dfd.c @@ -1,5 +1,8 @@ /* * $Log: dns_dfd.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-08-03 17:22:02+05:30 Cprogrammer * use qmail library * @@ -13,7 +16,7 @@ #include "dns.h" int -dns_domain_fromdot(char **out, char *buf, unsigned int n) +dns_domain_fromdot(char **out, const char *buf, unsigned int n) { char label[63]; unsigned int labellen = 0; /*- <= sizeof label */ diff --git a/ucspi-tcp-x/dns_domain.c b/ucspi-tcp-x/dns_domain.c index f09eae587c..e3f333cf68 100644 --- a/ucspi-tcp-x/dns_domain.c +++ b/ucspi-tcp-x/dns_domain.c @@ -1,5 +1,8 @@ /* * $Log: dns_domain.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:22:06+05:30 Cprogrammer * use qmail library * @@ -17,9 +20,9 @@ #include "dns.h" unsigned int -dns_domain_length(char *dn) +dns_domain_length(const char *dn) { - char *x; + const char *x; unsigned char c; x = dn; @@ -39,7 +42,7 @@ dns_domain_free(char **out) } int -dns_domain_copy(char **out, char *in) +dns_domain_copy(char **out, const char *in) { unsigned int len; char *x; @@ -56,7 +59,7 @@ dns_domain_copy(char **out, char *in) } int -dns_domain_equal(char *dn1, char *dn2) +dns_domain_equal(const char *dn1, const char *dn2) { unsigned int len; @@ -69,13 +72,12 @@ dns_domain_equal(char *dn1, char *dn2) } int -dns_domain_suffix(char *big, char *little) +dns_domain_suffix(const char *big, const char *little) { unsigned char c; - for (;;) - { - if (dns_domain_equal(big,little)) + for (;;) { + if (dns_domain_equal(big, little)) return 1; if (!(c = *big++)) return 0; @@ -84,9 +86,9 @@ dns_domain_suffix(char *big, char *little) } unsigned int -dns_domain_suffixpos(char *big, char *little) +dns_domain_suffixpos(const char *big, const char *little) { - char *orig = big; + const char *orig = big; unsigned char c; for (;;) diff --git a/ucspi-tcp-x/dns_dtda.c b/ucspi-tcp-x/dns_dtda.c index ccbf2b0420..2d0bce561a 100644 --- a/ucspi-tcp-x/dns_dtda.c +++ b/ucspi-tcp-x/dns_dtda.c @@ -1,5 +1,8 @@ /* * $Log: dns_dtda.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-08-03 17:28:50+05:30 Cprogrammer * use qmail library * @@ -11,7 +14,7 @@ #include "dns.h" int -dns_domain_todot_cat(stralloc * out, char *d) +dns_domain_todot_cat(stralloc *out, const char *d) { char ch; char ch2; diff --git a/ucspi-tcp-x/dns_ip.c b/ucspi-tcp-x/dns_ip.c index 22ff2f4325..129290cb7d 100644 --- a/ucspi-tcp-x/dns_ip.c +++ b/ucspi-tcp-x/dns_ip.c @@ -1,5 +1,8 @@ /* * $Log: dns_ip.c,v $ + * Revision 1.8 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2020-08-03 17:22:20+05:30 Cprogrammer * use qmail library * @@ -31,7 +34,7 @@ #include "ip6.h" static int -dns_ip6_packet_add(stralloc *out, char *buf, unsigned int len) +dns_ip6_packet_add(stralloc *out, const char *buf, unsigned int len) { unsigned int pos; char header[16]; @@ -72,7 +75,7 @@ dns_ip6_packet_add(stralloc *out, char *buf, unsigned int len) } int -dns_ip6_packet(stralloc *out, char *buf, unsigned int len) +dns_ip6_packet(stralloc *out, const char *buf, unsigned int len) { if (!stralloc_copys(out, "")) return -1; @@ -144,7 +147,7 @@ dns_ip6(stralloc *out, stralloc *fqdn) } #else int -dns_ip4_packet(stralloc * out, char *buf, unsigned int len) +dns_ip4_packet(stralloc *out, const char *buf, unsigned int len) { unsigned int pos; char header[12]; diff --git a/ucspi-tcp-x/dns_name.c b/ucspi-tcp-x/dns_name.c index 51a1cfdf9e..dc92d5ab48 100644 --- a/ucspi-tcp-x/dns_name.c +++ b/ucspi-tcp-x/dns_name.c @@ -1,5 +1,8 @@ /* * $Log: dns_name.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-08-03 17:22:34+05:30 Cprogrammer * use qmail-library * @@ -27,7 +30,7 @@ static char *q = 0; int -dns_name_packet(stralloc *out, char *buf, unsigned int len) +dns_name_packet(stralloc *out, const char *buf, unsigned int len) { unsigned int pos; char header[12]; diff --git a/ucspi-tcp-x/dns_packet.c b/ucspi-tcp-x/dns_packet.c index cd91b2e594..32681e6272 100644 --- a/ucspi-tcp-x/dns_packet.c +++ b/ucspi-tcp-x/dns_packet.c @@ -1,5 +1,8 @@ /* * $Log: dns_packet.c,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2020-08-03 17:22:53+05:30 Cprogrammer * use qmail library * @@ -14,7 +17,7 @@ #include "dns.h" unsigned int -dns_packet_copy(char *buf, unsigned int len, unsigned int pos, char *out, unsigned int outlen) +dns_packet_copy(const char *buf, unsigned int len, unsigned int pos, char *out, unsigned int outlen) { while (outlen) { @@ -31,7 +34,7 @@ dns_packet_copy(char *buf, unsigned int len, unsigned int pos, char *out, unsign } unsigned int -dns_packet_skipname(char *buf, unsigned int len, unsigned int pos) +dns_packet_skipname(const char *buf, unsigned int len, unsigned int pos) { unsigned char ch; @@ -54,7 +57,7 @@ dns_packet_skipname(char *buf, unsigned int len, unsigned int pos) } unsigned int -dns_packet_getname(char *buf, unsigned int len, unsigned int pos, char **d) +dns_packet_getname(const char *buf, unsigned int len, unsigned int pos, char **d) { unsigned int loop = 0; unsigned int state = 0; diff --git a/ucspi-tcp-x/dns_rcrw.c b/ucspi-tcp-x/dns_rcrw.c index cc73c40634..e00125229a 100644 --- a/ucspi-tcp-x/dns_rcrw.c +++ b/ucspi-tcp-x/dns_rcrw.c @@ -1,5 +1,8 @@ /* * $Log: dns_rcrw.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:23:10+05:30 Cprogrammer * use qmail library * @@ -24,10 +27,8 @@ static int init(stralloc * rules) { char host[256]; - char *x; - int i; - int j; - int k; + const char *x; + int i, j, k; if (!stralloc_copys(rules, "")) return -1; @@ -144,7 +145,7 @@ static struct taia deadline; static stralloc rules = { 0 }; /*- defined if ok */ int -dns_resolvconfrewrite(stralloc * out) +dns_resolvconfrewrite(stralloc *out) { struct taia now; diff --git a/ucspi-tcp-x/dns_resolve.c b/ucspi-tcp-x/dns_resolve.c index e950d2725d..0759165696 100644 --- a/ucspi-tcp-x/dns_resolve.c +++ b/ucspi-tcp-x/dns_resolve.c @@ -1,5 +1,8 @@ /* * $Log: dns_resolve.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:23:15+05:30 Cprogrammer * use qmail library * @@ -21,7 +24,7 @@ struct dns_transmit dns_resolve_tx = { 0 }; int -dns_resolve(char *q, char qtype[2]) +dns_resolve(const char *q, const char qtype[2]) { struct taia stamp; struct taia deadline; diff --git a/ucspi-tcp-x/dns_transmit.c b/ucspi-tcp-x/dns_transmit.c index cb3a893ead..3e5091b6f6 100644 --- a/ucspi-tcp-x/dns_transmit.c +++ b/ucspi-tcp-x/dns_transmit.c @@ -1,5 +1,8 @@ /* * $Log: dns_transmit.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-08-03 17:23:27+05:30 Cprogrammer * use qmail library * @@ -29,7 +32,7 @@ #include "dns.h" static int -serverwantstcp(char *buf, unsigned int len) +serverwantstcp(const char *buf, unsigned int len) { char out[12]; @@ -41,7 +44,7 @@ serverwantstcp(char *buf, unsigned int len) } static int -serverfailed(char *buf, unsigned int len) +serverfailed(const char *buf, unsigned int len) { char out[12]; unsigned int rcode; @@ -58,7 +61,7 @@ serverfailed(char *buf, unsigned int len) } static int -irrelevant(struct dns_transmit *d, char *buf, unsigned int len) +irrelevant(struct dns_transmit *d, const char *buf, unsigned int len) { char out[12]; char *dn; @@ -293,10 +296,10 @@ nexttcp(struct dns_transmit *d) int #ifdef IPV6 dns_transmit_start(struct dns_transmit *d, char servers[256], int flagrecursive, - char *q, char qtype[2], unsigned char localip[16]) + const char *q, const char qtype[2], unsigned char localip[16]) #else dns_transmit_start(struct dns_transmit *d, char servers[64], int flagrecursive, - char *q, char qtype[2], unsigned char localip[4]) + const char *q, const char qtype[2], unsigned char localip[4]) #endif { unsigned int len; diff --git a/ucspi-tcp-x/dns_txt.c b/ucspi-tcp-x/dns_txt.c index d39376079b..13eeae62de 100644 --- a/ucspi-tcp-x/dns_txt.c +++ b/ucspi-tcp-x/dns_txt.c @@ -1,5 +1,8 @@ /* * $Log: dns_txt.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-08-03 17:23:31+05:30 Cprogrammer * use qmail library * @@ -22,7 +25,7 @@ #include "dns.h" int -dns_txt_packet(stralloc * out, char *buf, unsigned int len) +dns_txt_packet(stralloc *out, const char *buf, unsigned int len) { unsigned int pos; char header[12]; diff --git a/ucspi-tcp-x/doc/ChangeLog b/ucspi-tcp-x/doc/ChangeLog index 517fff593c..f05172676e 100644 --- a/ucspi-tcp-x/doc/ChangeLog +++ b/ucspi-tcp-x/doc/ChangeLog @@ -11,6 +11,8 @@ Release @version@-@release@ Start 08/02/2024 End XX/XX/XXXX variable - 29/04/2024 04. trypoll.c, tryshsgr.c: Fix compiler warnings +- 09/05/2024 +05. fix discarded-qualifier compiler warnings * Mon Jan 01 2024 19:01:07 +0000 Manvendra Bhangui 1.1.3-1.1${?dist} Release 1.1.3-1.1 Start 27/04/2023 End 01/01/2024 diff --git a/ucspi-tcp-x/dotls.c b/ucspi-tcp-x/dotls.c index 00b0a4f821..6cb9235160 100644 --- a/ucspi-tcp-x/dotls.c +++ b/ucspi-tcp-x/dotls.c @@ -1,5 +1,5 @@ /* - * $Id: dotls.c,v 1.24 2023-08-20 15:16:12+05:30 Cprogrammer Exp mbhangui $ + * $Id: dotls.c,v 1.25 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $ */ #ifdef TLS #include @@ -40,10 +40,6 @@ #define FATAL "dotls: fatal: " #define HUGECAPATEXT 5000 -#ifndef lint -static char sccsid[] = "$Id: dotls.c,v 1.24 2023-08-20 15:16:12+05:30 Cprogrammer Exp mbhangui $"; -#endif - int do_data(); int do_retr(); int smtp_ehlo(char *, char *, int); @@ -57,11 +53,12 @@ void flush(); struct scommd { - char *text; + const char *text; int (*fun) (char *, char *, int); void (*flush) (void); }; static substdio ssin, ssto, smtpin, smtpto; +typedef const char c_char; typedef unsigned long my_ulong; static my_ulong dtimeout = 300; /*- timeoutdata -D */ static my_ulong ctimeout = 60; /*- timeoutconn -t */ @@ -74,8 +71,8 @@ static stralloc line; static stralloc saciphers; static stralloc tls_server_version, tls_client_version; static char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; -static char *remoteip, *remoteip4; -static char *certdir; +static c_char *remoteip, *remoteip4; +static c_char *certdir; static int linemode = 1, verbosity = 1; no_return void @@ -742,8 +739,8 @@ main(int argc, char **argv) int client_renegotiation = 0; #endif pid_t pid; - char *host = NULL, *ciphers = NULL, - *ptr, *cipherfile = NULL, *tls_method = NULL; + const char *host = NULL, *ciphers = NULL, *cipherfile = NULL, *tls_method = NULL; + char *ptr; SSL *ssl; SSL_CTX *ctx = NULL; enum starttls stls = unknown; @@ -847,7 +844,7 @@ main(int argc, char **argv) set_certdir(certdir); if (!certfile.len) { if (!(ptr = env_get("TLS_CERTFILE"))) - ptr = client_mode ? "clientcert.pem" : "servercert.pem"; + ptr = client_mode ? (char *) "clientcert.pem" : (char *) "servercert.pem"; if (*ptr != '.' && *ptr != '/') { if (!stralloc_copys(&certfile, certdir) || !stralloc_append(&certfile, "/")) @@ -859,7 +856,7 @@ main(int argc, char **argv) } if (!cafile.len) { if (!(ptr = env_get("CLIENTCA"))) - ptr = "clientca.pem"; + ptr = (char *) "clientca.pem"; if (*ptr != '.' && *ptr != '/') { if (!stralloc_copys(&cafile, certdir) || !stralloc_append(&cafile, "/")) @@ -873,7 +870,7 @@ main(int argc, char **argv) } if (!crlfile.len) { if (!(ptr = env_get("CLIENTCRL"))) - ptr = "clientca.pem"; + ptr = (char *) "clientca.pem"; if (*ptr != '.' && *ptr != '/') { if (!stralloc_copys(&crlfile, certdir) || !stralloc_append(&crlfile, "/")) @@ -1069,14 +1066,13 @@ main(int argc, char **argv) _exit(0); } -#ifndef lint void -getversion_sslclient_c() +getversion_dotls_c() { - if (write(1, sccsid, 0) == -1) - ; + const char *x = "$Id: dotls.c,v 1.25 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; + + x++; } -#endif #else #warning "not compiled with -DTLS" #include "substdio.h" @@ -1097,6 +1093,9 @@ main(int argc, char **argv) /* * $Log: dotls.c,v $ + * Revision 1.25 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.24 2023-08-20 15:16:12+05:30 Cprogrammer * use TLS_CIPHER_LIST, TLS_CIPHER_SUITE to set ciphers * diff --git a/ucspi-tcp-x/fixcrio.c b/ucspi-tcp-x/fixcrio.c index 920f566aa0..ca1e50f953 100644 --- a/ucspi-tcp-x/fixcrio.c +++ b/ucspi-tcp-x/fixcrio.c @@ -1,5 +1,8 @@ /* * $Log: fixcrio.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-30 12:47:59+05:30 Cprogrammer * define funtions as noreturn * @@ -170,7 +173,7 @@ main(int argc, char **argv, char **envp) void getversion_fixcrio_c() { - static char *x = "$Id: fixcrio.c,v 1.4 2021-08-30 12:47:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: fixcrio.c,v 1.5 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/ucspi-tcp-x/installer.c b/ucspi-tcp-x/installer.c index 2054709e01..33f9199ad0 100644 --- a/ucspi-tcp-x/installer.c +++ b/ucspi-tcp-x/installer.c @@ -1,5 +1,5 @@ /* - * $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $ + * $Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $ * taken from ezmlm-0.54 */ #include @@ -64,7 +64,7 @@ get_octal(mode_t mode) } void -print_info(const char *str, char *source, char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) +print_info(const char *str, const char *source, const char *dest, mode_t mode, uid_t uid, gid_t gid, unsigned long size) { struct passwd *pw; struct group *gr; @@ -669,7 +669,7 @@ main(int argc, char **argv) void getversion_installer_c() { - static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $"; + static const char *x = "$Id: installer.c,v 1.27 2024-05-09 22:03:17+05:30 mbhangui Exp mbhangui $"; if (x) x++; @@ -677,6 +677,9 @@ getversion_installer_c() /* * $Log: installer.c,v $ + * Revision 1.27 2024-05-09 22:03:17+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer * fixed displaying size variable * fixed allocation of zerobuf variable diff --git a/ucspi-tcp-x/ip4.h b/ucspi-tcp-x/ip4.h index 4f49e72a9b..ce6daef05c 100644 --- a/ucspi-tcp-x/ip4.h +++ b/ucspi-tcp-x/ip4.h @@ -1,5 +1,8 @@ /* * $Log: ip4.h,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-05-12 21:02:24+05:30 Cprogrammer * define arguments as array subscripts to fix gcc 11 warnings * @@ -20,7 +23,7 @@ #define IP4_H extern char ip4loopback[4]; /* = {127,0,0,1}; */ -unsigned int rblip4_scan(char *, char ip[4]); +unsigned int rblip4_scan(const char *, char ip[4]); unsigned int ip4_fmt(char *, char ip[4]); #define IP4_FMT 20 diff --git a/ucspi-tcp-x/ip4_bit.c b/ucspi-tcp-x/ip4_bit.c index 208c6f1452..0d92a55531 100644 --- a/ucspi-tcp-x/ip4_bit.c +++ b/ucspi-tcp-x/ip4_bit.c @@ -1,5 +1,8 @@ /* * $Log: ip4_bit.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-08-03 17:23:58+05:30 Cprogrammer * use qmail library * @@ -29,7 +32,7 @@ getaddressasbit(char *ip, int prefix, stralloc *ip4string) int count, i, sufcount = 0, pos = 0, len, posl; unsigned long num; #ifdef BITSUBSTITUTION - char *letterarray = "abcdefghijklmnopqrstuvwxyz123456"; + const char *letterarray = "abcdefghijklmnopqrstuvwxyz123456"; #endif len = byte_chr(ip, str_len(ip), '/'); diff --git a/ucspi-tcp-x/ip4_scan.c b/ucspi-tcp-x/ip4_scan.c index 4a250120e0..2244929b01 100644 --- a/ucspi-tcp-x/ip4_scan.c +++ b/ucspi-tcp-x/ip4_scan.c @@ -1,5 +1,8 @@ /* * $Log: ip4_scan.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:24:09+05:30 Cprogrammer * use qmail library * @@ -14,7 +17,7 @@ #include "ip4.h" unsigned int -rblip4_scan(char *s, char ip[4]) +rblip4_scan(const char *s, char ip[4]) { unsigned int i; unsigned int len; diff --git a/ucspi-tcp-x/ip6.h b/ucspi-tcp-x/ip6.h index 1363f565c6..595b7f3638 100644 --- a/ucspi-tcp-x/ip6.h +++ b/ucspi-tcp-x/ip6.h @@ -1,5 +1,8 @@ /* * $Log: ip6.h,v $ + * Revision 1.8 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.7 2021-05-12 21:02:30+05:30 Cprogrammer * define arguments as array subscripts to fix gcc 11 warnings * @@ -28,12 +31,12 @@ #include #include -unsigned int rblip6_scan(char *, char ip[16]); +unsigned int rblip6_scan(const char *, char ip[16]); unsigned int ip6_fmt(char *, char ip[16]); unsigned int ip6_fmt_exp(char *, char ip[16]); unsigned int ip6_fmt_flat(char *, char ip[16]); int ip6tobitstring(char *, stralloc *, unsigned int); -unsigned int ip6_expandaddr(char *src, stralloc *destination); +unsigned int ip6_expandaddr(const char *src, stralloc *destination); unsigned int ip6_compactaddr(char *s, char ip[16]); /* diff --git a/ucspi-tcp-x/ip6_expandaddr.c b/ucspi-tcp-x/ip6_expandaddr.c index 4dac25cc3f..db2f60a31a 100644 --- a/ucspi-tcp-x/ip6_expandaddr.c +++ b/ucspi-tcp-x/ip6_expandaddr.c @@ -1,5 +1,8 @@ /* * $Log: ip6_expandaddr.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-08-03 17:24:27+05:30 Cprogrammer * use qmail library * @@ -28,7 +31,7 @@ */ unsigned int -ip6_expandaddr(char *src, stralloc *destination) +ip6_expandaddr(const char *src, stralloc *destination) { stralloc addresstemp = { 0 }; char ip6[16] = { 0 }; diff --git a/ucspi-tcp-x/ip6_scan.c b/ucspi-tcp-x/ip6_scan.c index 6c6b07f62a..d368f786e7 100644 --- a/ucspi-tcp-x/ip6_scan.c +++ b/ucspi-tcp-x/ip6_scan.c @@ -1,5 +1,8 @@ /* * $Log: ip6_scan.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2020-08-03 17:24:44+05:30 Cprogrammer * use qmail library * @@ -30,7 +33,7 @@ */ unsigned int -rblip6_scan(char *s, char ip[16]) +rblip6_scan(const char *s, char ip[16]) { unsigned int i; unsigned int len = 0; @@ -40,7 +43,7 @@ rblip6_scan(char *s, char ip[16]) int prefixlen = 0; int suffixlen = 0; - if ((i = rblip4_scan((char *) s, ip + 12))) { + if ((i = rblip4_scan(s, ip + 12))) { unsigned char *c = V4mappedprefix; if (byte_equal((char *) ip + 12, 4, (char *) V6any)) c = V6any; @@ -63,7 +66,7 @@ rblip6_scan(char *s, char ip[16]) if (!(i = scan_xlong((char *) s, &u))) return 0; if (prefixlen == 12 && s[i] == '.') { /*- the last 4 bytes may be written as IPv4 address */ - if ((i = rblip4_scan((char *) s, ip + 12))) + if ((i = rblip4_scan(s, ip + 12))) return i + len; else return 0; @@ -90,7 +93,7 @@ rblip6_scan(char *s, char ip[16]) break; } if (suffixlen + prefixlen <= 12 && s[i] == '.') { - int j = rblip4_scan((char *) s, suffix + suffixlen); + int j = rblip4_scan(s, suffix + suffixlen); if (j) { suffixlen += 4; len += j; diff --git a/ucspi-tcp-x/load_mysql.c b/ucspi-tcp-x/load_mysql.c index 7dc52a5dce..bc165936b1 100644 --- a/ucspi-tcp-x/load_mysql.c +++ b/ucspi-tcp-x/load_mysql.c @@ -1,5 +1,8 @@ /* * $Log: load_mysql.c,v $ + * Revision 1.13 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.12 2023-04-01 19:27:18+05:30 Cprogrammer * refactored getlibObject function * @@ -50,6 +53,7 @@ #include #include "control.h" +typedef const char c_char; MYSQL *(*in_mysql_init) (MYSQL *); MYSQL *(*in_mysql_real_connect) (MYSQL *, const char *, const char *, const char *, const char *, unsigned int, const char *, unsigned long); const char *(*in_mysql_error) (MYSQL *); @@ -63,14 +67,14 @@ my_ulonglong (*in_mysql_num_rows) (MYSQL_RES *); my_ulonglong (*in_mysql_affected_rows) (MYSQL *); void (*in_mysql_free_result) (MYSQL_RES *); -static char memerr[] = "out of memory"; -static char ctlerr[] = "unable to read controls"; +static c_char memerr[] = "out of memory"; +static c_char ctlerr[] = "unable to read controls"; int use_sql = 0; static stralloc errbuf = { 0 }; static stralloc mysql_libfn = { 0 }; void * -loadLibrary(void **handle, char *libenv, int *errflag, char **errstr) +loadLibrary(void **handle, const char *libenv, int *errflag, const char *errstr[]) { char *ptr; int i; @@ -166,7 +170,7 @@ closeLibrary(void **handle) } void * -getlibObject(char *libenv, void **handle, char *plugin_symb, char **errstr) +getlibObject(const char *libenv, void **handle, const char *plugin_symb, const char *errstr[]) { void *i; char *ptr; @@ -192,10 +196,10 @@ getlibObject(char *libenv, void **handle, char *plugin_symb, char **errstr) } int -initMySQLlibrary(char **errstr) +initMySQLlibrary(const char *errstr[]) { static void *phandle = (void *) 0; - char *ptr; + const char *ptr; int i; if (phandle) @@ -260,7 +264,7 @@ initMySQLlibrary(char **errstr) void getversion_load_mysql_c() { - static char *x = "$Id: load_mysql.c,v 1.12 2023-04-01 19:27:18+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: load_mysql.c,v 1.13 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/ucspi-tcp-x/load_mysql.h b/ucspi-tcp-x/load_mysql.h index de7a7628db..80910d4c4f 100644 --- a/ucspi-tcp-x/load_mysql.h +++ b/ucspi-tcp-x/load_mysql.h @@ -1,5 +1,8 @@ /* * $Log: load_mysql.h,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-03-12 13:53:54+05:30 Cprogrammer * use MYSQL_CONFIG for conditional compilation of mysql code * @@ -39,10 +42,10 @@ extern my_ulonglong (*in_mysql_num_rows)(MYSQL_RES *); extern my_ulonglong (*in_mysql_affected_rows) (MYSQL *); extern void (*in_mysql_free_result) (MYSQL_RES *); -extern void *loadLibrary(void **, char *, int *, char **); -extern void *getlibObject(char *, void **, char *, char **); +extern void *loadLibrary(void **, const char *, int *, const char *[]); +extern void *getlibObject(const char *, void **, const char *, const char *[]); extern void closeLibrary(void **); -extern int initMySQLlibrary(char **); +extern int initMySQLlibrary(const char *[]); #endif #endif diff --git a/ucspi-tcp-x/load_shared.c b/ucspi-tcp-x/load_shared.c index d6069e9c74..bcfb2ce7d3 100644 --- a/ucspi-tcp-x/load_shared.c +++ b/ucspi-tcp-x/load_shared.c @@ -1,5 +1,8 @@ /* * $Log: load_shared.c,v $ + * Revision 1.20 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.19 2021-07-03 14:04:38+05:30 Cprogrammer * use Lmid_t data type for id instead of unsigned long * @@ -70,21 +73,22 @@ #include #include #include +#include #include "upathexec.h" #define FATAL "tcpserver: fatal: " #ifdef HASDLMOPEN -extern void *tcdlmopen(Lmid_t, char *, int); +extern void *tcdlmopen(Lmid_t, const char *, int); #endif void -load_shared(char *file, char **argv, char **envp) +load_shared(const char *file, char **argv, char **envp) { - int argc, split; + int argc, split, len; int (*func) (int, char **, char **); void *handle; - char *error, *fptr; + char *error, *fptr, *file_t; char **ptr; #ifdef HASDLMOPEN char strnum[FMT_ULONG]; @@ -150,10 +154,13 @@ load_shared(char *file, char **argv, char **envp) #endif /*- ifdef HASDLMOPEN */ dlerror(); /*- clear existing error */ /*- use the basename of the shared object as the function to execute */ - split = str_rchr(file, '.'); + if (!(file_t = (char *) alloc((len = str_len(file)) + 1))) + strerr_die2x(111, FATAL, "dlopen: out of memory"); + str_copyb(file_t, file, len + 1); + split = str_rchr(file_t, '.'); if (split) - file[split--] = 0; - for (fptr = file + split;*fptr && *fptr != '/';fptr--); + file_t[split--] = 0; + for (fptr = file_t + split; *fptr && *fptr != '/'; fptr--); if (*fptr == '/') fptr++; #ifdef HASDLMOPEN @@ -163,10 +170,9 @@ load_shared(char *file, char **argv, char **envp) } #endif func = dlsym(handle, fptr); + alloc_free(file_t); if ((error = dlerror())) strerr_die5x(111, FATAL, "dlsym: ", fptr, ": ", error); - if (split) - file[split + 1] = '.'; for (argc = 0,ptr = argv; *ptr; ptr++) argc++; pathexec_dl(argc, argv, envp, func); @@ -188,7 +194,7 @@ load_shared(char *file, char **argv, char **envp) void getversion_load_shared_c() { - static char *x = "$Id: load_shared.c,v 1.19 2021-07-03 14:04:38+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: load_shared.c,v 1.20 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/ucspi-tcp-x/rblsmtpd.c b/ucspi-tcp-x/rblsmtpd.c index 391fffea70..092169f741 100644 --- a/ucspi-tcp-x/rblsmtpd.c +++ b/ucspi-tcp-x/rblsmtpd.c @@ -1,5 +1,8 @@ /* * $Log: rblsmtpd.c,v $ + * Revision 1.25 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.24 2021-08-30 12:47:59+05:30 Cprogrammer * define funtions as noreturn * @@ -100,9 +103,7 @@ #define FATAL "rblsmtpd: fatal: " -#ifndef lint -static char sccsid[] = "$Id: rblsmtpd.c,v 1.24 2021-08-30 12:47:59+05:30 Cprogrammer Exp mbhangui $"; -#endif +typedef const char c_char; no_return void nomem(void) @@ -116,7 +117,7 @@ usage(void) strerr_die1x(100, "usage: rblsmtpd -r base [ -b ] [ -R ] [ -t timeout ] [ -a base ] [-W] [-w delay] smtpd [ arg ... ]"); } -static char *ip_env, *rbl_greeting, *rbl_ehlo; +static c_char *ip_env, *rbl_greeting, *rbl_ehlo; static char pid_str[FMT_ULONG] = "?PID?"; static stralloc addr = { 0 }; static stralloc ip_reverse; @@ -125,7 +126,7 @@ static stralloc ip_reverse; * Idea from Andrew Richards http://free.acrconsulting.co.uk */ void -rbl_out(int should_flush, char *arg) +rbl_out(int should_flush, const char *arg) { substdio_puts(subfderr, "rblsmtpd: "); substdio_puts(subfderr, " pid "); @@ -143,14 +144,13 @@ rbl_out(int should_flush, char *arg) } #ifdef IPV6 -char *tcp_proto; +const char *tcp_proto; #endif void ip_init(void) { - unsigned int i; - unsigned int j; + unsigned int i, j; int flagip6 = 0; #ifdef IPV6 unsigned char remoteip[16]; @@ -678,6 +678,7 @@ main(int argc, char **argv, char **envp) void getversion_rblsmtpd_c() { - if (write(1, sccsid, 0) == -1) - ; + const char *x = "$Id: rblsmtpd.c,v 1.25 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; + + x++; } diff --git a/ucspi-tcp-x/recordio.c b/ucspi-tcp-x/recordio.c index 1c73e5319b..2f81947d04 100644 --- a/ucspi-tcp-x/recordio.c +++ b/ucspi-tcp-x/recordio.c @@ -1,5 +1,8 @@ /* * $Log: recordio.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2021-08-30 12:47:59+05:30 Cprogrammer * define funtions as noreturn * @@ -40,7 +43,7 @@ static int rightlen; static int rightpos; void -record(char *buf, int len, char *direction) /*- 1 <= len <= 256 */ +record(const char *buf, int len, const char *direction) /*- 1 <= len <= 256 */ { int i; @@ -210,7 +213,7 @@ main(int argc, char **argv, char **envp) void getversion_recordio_c() { - static char *x = "$Id: recordio.c,v 1.4 2021-08-30 12:47:59+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: recordio.c,v 1.5 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; } diff --git a/ucspi-tcp-x/rules.c b/ucspi-tcp-x/rules.c index 670145d1a0..fcff61e742 100644 --- a/ucspi-tcp-x/rules.c +++ b/ucspi-tcp-x/rules.c @@ -1,5 +1,8 @@ /* * $Log: rules.c,v $ + * Revision 1.7 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2020-08-03 17:25:50+05:30 Cprogrammer * use qmail library * @@ -62,7 +65,7 @@ dorule(void (*callback) (char *, unsigned int)) } static int -doit(void (*callback) (char *, unsigned int), char *ip, char *host, char *info) +doit(void (*callback) (char *, unsigned int), char *ip, const char *host, const char *info) { int r, p; int ipv6 = str_len(ip) - byte_chr(ip, str_len(ip), ':'); @@ -195,7 +198,7 @@ doit(void (*callback) (char *, unsigned int), char *ip, char *host, char * } int -rules(void (*callback) (char *, unsigned int), int fd, char *ip, char *host, char *info) +rules(void (*callback) (char *, unsigned int), int fd, char *ip, const char *host, const char *info) { int r; cdb_init(&c, fd); diff --git a/ucspi-tcp-x/rules.h b/ucspi-tcp-x/rules.h index 4bf94fd6b3..f2199d6fa8 100644 --- a/ucspi-tcp-x/rules.h +++ b/ucspi-tcp-x/rules.h @@ -1,5 +1,8 @@ /* * $Log: rules.h,v $ + * Revision 1.3 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.2 2005-05-13 23:46:28+05:30 Cprogrammer * code indentation * @@ -13,6 +16,6 @@ #include "stralloc.h" extern stralloc rules_name; -int rules(void (*)(char *, unsigned int), int, char *, char *, char *); +int rules(void (*)(char *, unsigned int), int, char *, const char *, const char *); #endif diff --git a/ucspi-tcp-x/socket.h b/ucspi-tcp-x/socket.h index ecea5db319..dfa8cb6e42 100644 --- a/ucspi-tcp-x/socket.h +++ b/ucspi-tcp-x/socket.h @@ -1,5 +1,8 @@ /* * $Log: socket.h,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-06-18 13:22:33+05:30 Cprogrammer * added unix domain socket functions * @@ -28,17 +31,15 @@ int socket_tcp(void); int socket_udp(void); int socket_unix(void); int socket_connect4(int, char ip[4], uint16); -int socket_connect_un(int, char *); +int socket_connect_un(int, const char *); int socket_connected(int); int socket_bind4(int, char ip[4], uint16); -int socket_bindun(int, char *); +int socket_bindun(int, const char *); int socket_listen(int, int); -int socket_accept4(int, char *, uint16 *); -int socket_acceptun(int, struct sockaddr_un *, char *); -int socket_recv4(int, char *, int, char *, uint16 *); -int socket_send4(int, char *, int, char *, uint16); -int socket_local4(int, char *, uint16 *); -int socket_remote4(int, char *, uint16 *); +int socket_accept4(int, char ip[4], uint16 *); +int socket_acceptun(int, struct sockaddr_un *); +int socket_local4(int, char ip[4], uint16 *); +int socket_remote4(int, char ip[4], uint16 *); void socket_tryreservein(int, int); #ifdef LIBC_HAS_IP6 int socket_tcp6(void); @@ -46,28 +47,10 @@ int socket_udp6(void); int socket_connect6(int, char ip[16], uint16, uint32); int socket_bind6(int, char ip[16], uint16, uint32); int socket_accept6(int, char ip[16], uint16 *, uint32 *); -int socket_recv6(int, char *, unsigned int, char ip[16], uint16 *, uint32 *); -int socket_send6(int, char *, unsigned int, char ip[16], uint16, uint32); int socket_local6(int, char ip[16], uint16 *, uint32 *); int socket_remote6(int, char ip[16], uint16 *, uint32 *); - -/*- enable sending udp packets to the broadcast address */ -int socket_broadcast(int); -/*- join a multicast group on the given interface */ -int socket_mcjoin4(int, char *, char *); -int socket_mcjoin6(int, char *, int); -/*- leave a multicast group on the given interface */ -int socket_mcleave4(int, char *); -int socket_mcleave6(int, char *); -/*- set multicast TTL/hop count for outgoing packets */ -int socket_mcttl4(int, char); -int socket_mcttl6(int, char); -/*- enable multicast loopback */ -int socket_mcloop4(int, char); -int socket_mcloop6(int, char); - char *socket_getifname(uint32); -uint32 socket_getifidx(char *); +uint32 socket_getifidx(const char *); extern int noipv6; #endif diff --git a/ucspi-tcp-x/socket_accept.c b/ucspi-tcp-x/socket_accept.c index ab48ce71f5..ff41f3a563 100644 --- a/ucspi-tcp-x/socket_accept.c +++ b/ucspi-tcp-x/socket_accept.c @@ -1,5 +1,8 @@ /* * $Log: socket_accept.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-08-03 17:26:04+05:30 Cprogrammer * use qmail library * @@ -39,7 +42,7 @@ socket_accept4(int s, char ip[4], uint16 * port) void getversion_socket_accept4_c() { - static char *x = "$Id: socket_accept.c,v 1.4 2020-08-03 17:26:04+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: socket_accept.c,v 1.5 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; return; } diff --git a/ucspi-tcp-x/socket_acceptun.c b/ucspi-tcp-x/socket_acceptun.c index bb56ee5809..be0a7e4b82 100644 --- a/ucspi-tcp-x/socket_acceptun.c +++ b/ucspi-tcp-x/socket_acceptun.c @@ -1,5 +1,8 @@ /* * $Log: socket_acceptun.c,v $ + * Revision 1.2 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-06-16 23:46:22+05:30 Cprogrammer * Initial revision * @@ -7,8 +10,10 @@ #include #include #include "byte.h" +#include "socket.h" + int -socket_acceptun(int s, struct sockaddr_un *un, char *socket_path) +socket_acceptun(int s, struct sockaddr_un *un) { unsigned int dummy = sizeof(struct sockaddr_un); diff --git a/ucspi-tcp-x/socket_bindun.c b/ucspi-tcp-x/socket_bindun.c index 20cde76614..bbbcbb4e39 100644 --- a/ucspi-tcp-x/socket_bindun.c +++ b/ucspi-tcp-x/socket_bindun.c @@ -1,5 +1,8 @@ /* * $Log: socket_bindun.c,v $ + * Revision 1.2 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-06-16 23:47:59+05:30 Cprogrammer * Initial revision * @@ -9,9 +12,10 @@ #include #include "str.h" #include "byte.h" +#include "socket.h" int -socket_bindun(int s, char *socket_path) +socket_bindun(int s, const char *socket_path) { struct sockaddr_un localunaddr; diff --git a/ucspi-tcp-x/socket_conn_un.c b/ucspi-tcp-x/socket_conn_un.c index 30c29c4410..4a214b1f7b 100644 --- a/ucspi-tcp-x/socket_conn_un.c +++ b/ucspi-tcp-x/socket_conn_un.c @@ -1,5 +1,8 @@ /* * $Log: socket_conn_un.c,v $ + * Revision 1.2 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-06-16 23:46:35+05:30 Cprogrammer * Initial revision * @@ -13,7 +16,7 @@ #include "str.h" int -socket_connect_un(int s, char *socket) +socket_connect_un(int s, const char *socket) { struct sockaddr_un sa; diff --git a/ucspi-tcp-x/socket_getifidx.c b/ucspi-tcp-x/socket_getifidx.c index a0a847856e..17c23c8fd3 100644 --- a/ucspi-tcp-x/socket_getifidx.c +++ b/ucspi-tcp-x/socket_getifidx.c @@ -1,5 +1,8 @@ /* * $Log: socket_getifidx.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:26:33+05:30 Cprogrammer * use qmail library * @@ -17,7 +20,7 @@ #include "socket.h" uint32 -socket_getifidx(char *ifname) +socket_getifidx(const char *ifname) { return if_nametoindex(ifname); } diff --git a/ucspi-tcp-x/socket_getifname.c b/ucspi-tcp-x/socket_getifname.c index ce941c2e81..5d8919c1e5 100644 --- a/ucspi-tcp-x/socket_getifname.c +++ b/ucspi-tcp-x/socket_getifname.c @@ -1,5 +1,8 @@ /* * $Log: socket_getifname.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-08-03 17:26:38+05:30 Cprogrammer * use qmail library * @@ -19,7 +22,7 @@ static char ifname[IFNAMSIZ]; -char * +char * socket_getifname(uint32 interface) { char *tmp = if_indextoname(interface, ifname); @@ -27,5 +30,5 @@ socket_getifname(uint32 interface) if (tmp) return tmp; else - return "[unknown]"; + return (char *) "[unknown]"; } diff --git a/ucspi-tcp-x/socket_local.c b/ucspi-tcp-x/socket_local.c index 007b260653..85e8067d0b 100644 --- a/ucspi-tcp-x/socket_local.c +++ b/ucspi-tcp-x/socket_local.c @@ -1,5 +1,8 @@ /* * $Log: socket_local.c,v $ + * Revision 1.5 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.4 2020-08-03 17:26:47+05:30 Cprogrammer * use qmail library * @@ -38,7 +41,7 @@ socket_local4(int s, char ip[4], uint16 * port) void getversion_socket_local4_c() { - static char *x = "$Id: socket_local.c,v 1.4 2020-08-03 17:26:47+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: socket_local.c,v 1.5 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; x++; return; } diff --git a/ucspi-tcp-x/socket_recv6.c b/ucspi-tcp-x/socket_recv6.c deleted file mode 100644 index ed97f8c9fe..0000000000 --- a/ucspi-tcp-x/socket_recv6.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Log: socket_recv6.c,v $ - * Revision 1.4 2020-08-03 17:26:52+05:30 Cprogrammer - * use qmail library - * - * Revision 1.3 2010-04-06 08:59:54+05:30 Cprogrammer - * minor change - * - * Revision 1.2 2005-06-10 12:18:15+05:30 Cprogrammer - * conditional ipv6 compilation - * - * Revision 1.1 2005-06-10 09:02:06+05:30 Cprogrammer - * Initial revision - * - */ -#ifdef IPV6 -#include -#include -#include -#include -#include -#include "socket.h" -#include "ip6.h" - -extern int noipv6; - -int -socket_recv6(int s, char *buf, unsigned int len, char ip[16], uint16 *port, uint32 *scope_id) -{ -#ifdef LIBC_HAS_IP6 - struct sockaddr_in6 sa; -#else - struct sockaddr_in sa; -#endif - unsigned int dummy = sizeof sa; - int r; - - byte_zero((char *) &sa, dummy); - if (-1 == (r = recvfrom(s, buf, len, 0, (struct sockaddr *) &sa, &dummy))) - return -1; -#ifdef LIBC_HAS_IP6 - if (noipv6) { - struct sockaddr_in *sa4 = (struct sockaddr_in *) &sa; - byte_copy(ip, 12, (char *) V4mappedprefix); - byte_copy(ip + 12, 4, (char *) &sa4->sin_addr); - uint16_unpack_big((char *) &sa4->sin_port, port); - return r; - } - byte_copy(ip, 16, (char *) &sa.sin6_addr); - uint16_unpack_big((char *) &sa.sin6_port, port); - if (scope_id) - *scope_id = sa.sin6_scope_id; -#else - byte_copy(ip, 12, (char *) V4mappedprefix); - byte_copy(ip + 12, 4, (char *) &sa.sin_addr); - uint16_unpack_big((char *) &sa.sin_port, port); - if (scope_id) - *scope_id = 0; -#endif - return r; -} -#endif diff --git a/ucspi-tcp-x/socket_send6.c b/ucspi-tcp-x/socket_send6.c deleted file mode 100644 index 3017245538..0000000000 --- a/ucspi-tcp-x/socket_send6.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Log: socket_send6.c,v $ - * Revision 1.3 2020-08-03 17:27:03+05:30 Cprogrammer - * use qmail library - * - * Revision 1.2 2005-06-10 12:18:47+05:30 Cprogrammer - * conditional ipv6 compilation - * - * Revision 1.1 2005-06-10 09:02:11+05:30 Cprogrammer - * Initial revision - * - */ -#ifdef IPV6 -#include -#include -#include -#include -#include -#include -#include "socket.h" -#include "ip4.h" -#include "ip6.h" - -extern int noipv6; - -int -socket_send6(int s, char *buf, unsigned int len, char ip[16], uint16 port, uint32 scope_id) -{ -#ifdef LIBC_HAS_IP6 - struct sockaddr_in6 sa; -#else - struct sockaddr_in sa; -#endif - - byte_zero((char *) &sa, sizeof sa); -#ifdef LIBC_HAS_IP6 - if (noipv6) { - if (ip6_isv4mapped(ip)) - return socket_send4(s, buf, len, ip + 12, port); - if (byte_equal(ip, 16, (char *) V6loopback)) - return socket_send4(s, buf, len, ip4loopback, port); - errno = error_proto; - return -1; - } - sa.sin6_family = AF_INET6; - uint16_pack_big((char *) &sa.sin6_port, port); - byte_copy((char *) &sa.sin6_addr, 16, ip); - return sendto(s, buf, len, 0, (struct sockaddr *) &sa, sizeof sa); -#else - if (ip6_isv4mapped(ip)) - return socket_send4(s, buf, len, ip + 12, port); - if (byte_equal(ip, 16, (char *) V6loopback)) - return socket_send4(s, buf, len, ip4loopback, port); - errno = error_proto; - return -1; -#endif -} -#endif diff --git a/ucspi-tcp-x/socket_tcp.c b/ucspi-tcp-x/socket_tcp.c index 68d34b0f73..28fbc26e38 100644 --- a/ucspi-tcp-x/socket_tcp.c +++ b/ucspi-tcp-x/socket_tcp.c @@ -1,5 +1,8 @@ /* * $Log: socket_tcp.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-06-18 13:23:59+05:30 Cprogrammer * removed not needed include * @@ -20,6 +23,7 @@ #include #include #include +#include "socket.h" int socket_tcp(void) diff --git a/ucspi-tcp-x/socket_unix.c b/ucspi-tcp-x/socket_unix.c index 67928e3637..d05891d605 100644 --- a/ucspi-tcp-x/socket_unix.c +++ b/ucspi-tcp-x/socket_unix.c @@ -1,5 +1,8 @@ /* * $Log: socket_unix.c,v $ + * Revision 1.2 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-06-16 23:46:39+05:30 Cprogrammer * Initial revision * @@ -8,6 +11,7 @@ #include #include #include +#include "socket.h" int socket_unix(void) diff --git a/ucspi-tcp-x/tcdlmopen.c b/ucspi-tcp-x/tcdlmopen.c index 64512688b3..9c0be42c6b 100644 --- a/ucspi-tcp-x/tcdlmopen.c +++ b/ucspi-tcp-x/tcdlmopen.c @@ -1,5 +1,8 @@ /* * $Log: tcdlmopen.c,v $ + * Revision 1.4 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.3 2020-09-16 20:50:12+05:30 Cprogrammer * fixed compiler warnings * @@ -42,7 +45,7 @@ extern void write(int, char *, int); void getversion_tcdlmopen_c() { - static char *x = "$Id: tcdlmopen.c,v 1.3 2020-09-16 20:50:12+05:30 Cprogrammer Exp mbhangui $"; + const char *x = "$Id: tcdlmopen.c,v 1.4 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; if (x) x++; } diff --git a/ucspi-tcp-x/tcpclient.c b/ucspi-tcp-x/tcpclient.c index 58c7097664..4af0be6ece 100644 --- a/ucspi-tcp-x/tcpclient.c +++ b/ucspi-tcp-x/tcpclient.c @@ -1,5 +1,5 @@ /* - * $Id: tcpclient.c,v 1.33 2023-08-20 15:17:12+05:30 Cprogrammer Exp mbhangui $ + * $Id: tcpclient.c,v 1.34 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -50,10 +50,6 @@ #define FATAL "tcpclient: fatal: " -#ifndef lint -static char sccsid[] = "$Id: tcpclient.c,v 1.33 2023-08-20 15:17:12+05:30 Cprogrammer Exp mbhangui $"; -#endif - extern int socket_tcpnodelay(int); no_return void @@ -93,6 +89,7 @@ usage(void) " host port [program]"); } +typedef const char c_char; static int verbosity = 1; static int flagdelay = 1; static int flagremoteinfo = 1; @@ -115,7 +112,7 @@ static char ipstr[IP4_FMT]; static uint16 portlocal; static uint16 portremote; static char *forcelocal; -static char *hostname, *cn_host; +static c_char *hostname, *cn_host; static stralloc addresses; static stralloc moreaddresses; static stralloc tmp; @@ -130,7 +127,7 @@ static char seed[128]; static struct stralloc certfile, cafile, crlfile; struct stralloc saciphers; #endif -static char *af_unix; +static c_char *af_unix; no_return void sigterm() @@ -303,7 +300,7 @@ do_starttls(int sfd, enum starttls stls, char *clientcert, int verbose) if (code != 220) strerr_die2x(111, FATAL, "connected but greeting failed"); /*- issue STARTTLS command and check response */ - if (tlswrite(sfd, "STARTTLS\r\n", 10, dtimeout) == -1) + if (tlswrite(sfd, (char *) "STARTTLS\r\n", 10, dtimeout) == -1) strerr_die2(111, FATAL, "unable to write to network: ", &strerr_tls); if (getln(&ssin, &line, &match, '\n') == -1) strerr_die2(111, FATAL, "getln: read-smtpd: ", &strerr_tls); @@ -320,7 +317,7 @@ do_starttls(int sfd, enum starttls stls, char *clientcert, int verbose) case pop3: if (getln(&ssin, &line, &match, '\n') == -1) strerr_die2(111, FATAL, "getln: read-pop3d: ", &strerr_tls); - if (tlswrite(sfd, "STLS\r\n", 6, dtimeout) == -1) + if (tlswrite(sfd, (char *) "STLS\r\n", 6, dtimeout) == -1) strerr_die2(111, FATAL, "unable to write to network: ", &strerr_tls); if (getln(&ssin, &line, &match, '\n') == -1) strerr_die2(111, FATAL, "getln: read-pop3d: ", &strerr_tls); @@ -340,7 +337,7 @@ int main(int argc, char **argv) { unsigned long u; - char *x; + const char *x; struct stralloc options = {0}; #ifdef IPV6 int fakev4 = 0; @@ -349,8 +346,8 @@ main(int argc, char **argv) #ifdef TLS SSL_CTX *ctx = NULL; SSL *ssl = NULL; - char *certdir, *ciphers = NULL, - *cipherfile = NULL, *tls_method = NULL; + const char *certdir, *cipherfile = NULL, *tls_method = NULL; + char *ciphers = NULL; enum starttls stls = unknown; int match_cn = 0, method; struct stat st; @@ -823,17 +820,19 @@ main(int argc, char **argv) return (0); } -#ifndef lint void getversion_tcpclient_c() { - if (write(1, sccsid, 0) == -1) - ; + const char *x = "$Id: tcpclient.c,v 1.34 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; + + x++; } -#endif /* * $Log: tcpclient.c,v $ + * Revision 1.34 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.33 2023-08-20 15:17:12+05:30 Cprogrammer * use TLS_CIPHER_LIST, TLS_CIPHER_SUITE to set ciphers * diff --git a/ucspi-tcp-x/tcprulescheck.c b/ucspi-tcp-x/tcprulescheck.c index c12b9928df..481998cb9b 100644 --- a/ucspi-tcp-x/tcprulescheck.c +++ b/ucspi-tcp-x/tcprulescheck.c @@ -1,5 +1,8 @@ /* * $Log: tcprulescheck.c,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-08-30 12:47:59+05:30 Cprogrammer * define funtions as noreturn * @@ -67,16 +70,14 @@ main(int argc, char **argv) char *fnrules; int fd; char *ip; - char *info; - char *host; + const char *info, *host; fnrules = argv[1]; if (!fnrules) strerr_die1x(100, "tcprulescheck: usage: tcprulescheck rules.cdb"); - ip = env_get("TCPREMOTEIP"); - if (!ip) - ip = "0.0.0.0"; + if (!(ip = env_get("TCPREMOTEIP"))) + ip = (char *) "0.0.0.0"; info = env_get("TCPREMOTEINFO"); host = env_get("TCPREMOTEHOST"); diff --git a/ucspi-tcp-x/tcpserver.c b/ucspi-tcp-x/tcpserver.c index c9cd57648c..dd9aeb8e45 100644 --- a/ucspi-tcp-x/tcpserver.c +++ b/ucspi-tcp-x/tcpserver.c @@ -1,5 +1,5 @@ /* - * $Id: tcpserver.c,v 1.92 2023-11-26 18:28:05+05:30 Cprogrammer Exp mbhangui $ + * $Id: tcpserver.c,v 1.93 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $ */ #include #include @@ -66,10 +66,7 @@ #include "control.h" #include "auto_home.h" -#ifndef lint -static char sccsid[] = "$Id: tcpserver.c,v 1.92 2023-11-26 18:28:05+05:30 Cprogrammer Exp mbhangui $"; -#endif - +typedef const char c_char; #ifdef IPV6 static int forcev6; static uint32 netif; @@ -78,7 +75,7 @@ typedef unsigned long my_ulong; static int verbosity = 1; static int flagkillopts = 1; static int flagdelay = 1; -static char *banner = ""; +static c_char *banner = ""; static int flagremoteinfo = 1; static int flagremotehost = 1; static int flagparanoid; @@ -147,7 +144,7 @@ struct iptable }; typedef struct iptable IPTABLE; static IPTABLE **IpTable; -static char *af_unix, *pidfile; +static c_char *af_unix, *pidfile; void add_ip(pid_t); void print_ip(); @@ -174,21 +171,21 @@ drop_nomem(void) } void -cats(char *s) +cats(const char *s) { if (!stralloc_cats(&tmp, s)) drop_nomem(); } void -append(char *ch) +append(const char *ch) { if (!stralloc_append(&tmp, ch)) drop_nomem(); } void -safecats(char *s) +safecats(const char *s) { char ch; int i; @@ -212,7 +209,7 @@ safecats(char *s) } void -env(char *s, char *t) +env(const char *s, const char *t) { if (str_equal(s, "MAXPERIP")) scan_ulong(t, &maxperip); @@ -255,7 +252,7 @@ found(char *data, unsigned int datalen) } void -doit_unix(int t, char *hostname) +doit_unix(int t, const char *hostname) { str_copyb(remoteipstr, "0.0.0.0", 8); if (verbosity >= 2) { @@ -283,7 +280,7 @@ doit_unix(int t, char *hostname) } void -doit_tcp(int t, char *hostname) +doit_tcp(int t, const char *hostname) { int j; #ifdef IPV6 @@ -512,8 +509,8 @@ doit_tcp(int t, char *hostname) #include #include -static char * -my_strchr(char *str, char ch) +static const char * +my_strchr(const char *str, char ch) { int i; @@ -524,7 +521,7 @@ my_strchr(char *str, char ch) } int -matchinet(char *ip, char *token) +matchinet(const char *ip, const char *token) { char field1[8], field2[8]; char *ptr, *ptr1, *ptr2, *cptr; @@ -550,7 +547,7 @@ matchinet(char *ip, char *token) if (inet_addr(token) != INADDR_NONE) return (0); else - for (match = idx1 = 0, ptr1 = token, ptr2 = ip; idx1 < 4 && match == idx1; idx1++) { + for (match = idx1 = 0, ptr1 = (char *) token, ptr2 = (char *) ip; idx1 < 4 && match == idx1; idx1++) { /*- IP Address in control file */ for (cptr = field1; *ptr1 && *ptr1 != '.'; *cptr++ = *ptr1++); *cptr = 0; @@ -571,7 +568,7 @@ matchinet(char *ip, char *token) * Network address wildcard match (i.e. * "192.86.2?.12?") */ - for (; (ptr = my_strchr(field1, '?'));) { + for (; (ptr = (char *) my_strchr(field1, '?'));) { lnum = ptr - field1; *ptr = field2[lnum]; } @@ -582,7 +579,7 @@ matchinet(char *ip, char *token) /* * Range match (i.e. "190-193.86.22.11") */ - if ((ptr = my_strchr(field1, '-'))) { + if ((ptr = (char *) my_strchr(field1, '-'))) { *ptr = 0; ptr++; scan_ulong(field1, &lnum); @@ -689,7 +686,7 @@ create_table(MYSQL *mysql) } void -connect_db(char *dbfile) +connect_db(const char *dbfile) { char *x = 0, *m_timeout; int fd, i = 0; @@ -977,7 +974,7 @@ usage(void) } void -printstatus(char *str, pid_t pid, pid_t childpid) +printstatus(const char *str, pid_t pid, pid_t childpid) { int i; #ifdef IPV6 @@ -1325,7 +1322,7 @@ read_provider_data(stralloc *t, int readfd, int writefd) #endif int -check_pid(char *fn) +check_pid(const char *fn) { int i, j; @@ -1357,9 +1354,9 @@ check_pid(char *fn) int main(int argc, char **argv, char **envp) { - char *x, *hostname, *groups = NULL; + const char *x, *hostname, *groups = NULL; #if defined(HAS_MYSQL) - char *dbfile = NULL; + const char *dbfile = NULL; #endif struct servent *se; unsigned long port, ipcount = -1; @@ -1374,8 +1371,8 @@ main(int argc, char **argv, char **envp) #endif #ifdef TLS SSL_CTX *ctx = NULL; - char *certdir = NULL, *ciphers = NULL, - *cipherfile = NULL, *tls_method = NULL; + const char *certdir = NULL, *cipherfile = NULL; + char *ciphers = NULL, *tls_method = NULL; int pi2c[2], pi4c[2], method; int provide_data = 0; pid_t child_pid; @@ -1853,7 +1850,7 @@ main(int argc, char **argv, char **envp) sig_pause(); sig_unblock(sig_child); if (af_unix) - asd = socket_acceptun(sfd, &un, hostname); + asd = socket_acceptun(sfd, &un); else { #if defined(IPV6) && defined(FREEBSD) while (1) { @@ -2011,12 +2008,16 @@ main(int argc, char **argv, char **envp) void getversion_tcpserver_c() { - if (write(1, sccsid, 0) == -1) - ; + const char *x = "$Id: tcpserver.c,v 1.93 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; + + x++; } /* * $Log: tcpserver.c,v $ + * Revision 1.93 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.92 2023-11-26 18:28:05+05:30 Cprogrammer * fixed TCPLOCALPORT not getting set * diff --git a/ucspi-tcp-x/tcpserver_plugin.c b/ucspi-tcp-x/tcpserver_plugin.c index 16b9318461..09fe9e01bd 100644 --- a/ucspi-tcp-x/tcpserver_plugin.c +++ b/ucspi-tcp-x/tcpserver_plugin.c @@ -1,5 +1,8 @@ /* * $Log: tcpserver_plugin.c,v $ + * Revision 1.17 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.16 2021-07-03 14:05:14+05:30 Cprogrammer * use Lmid_t data type for id instead of unsigned long * @@ -50,10 +53,6 @@ * */ -#ifndef lint -static char sccsid[] = "$Id: tcpserver_plugin.c,v 1.16 2021-07-03 14:05:14+05:30 Cprogrammer Exp mbhangui $"; -#endif - #define FATAL "tcpserver: fatal: " #ifdef LOAD_SHARED_OBJECTS @@ -204,6 +203,6 @@ tcpserver_plugin(char **envp) void getversion_tcpserver_plugin_c() { - if (write(1, sccsid, 0) == -1) - ; + const char *x = "$Id: tcpserver_plugin.c,v 1.17 2024-05-09 22:55:54+05:30 mbhangui Exp mbhangui $"; + x++; } diff --git a/ucspi-tcp-x/timeoutconn.h b/ucspi-tcp-x/timeoutconn.h index 11aeb418a9..92d9b7b344 100644 --- a/ucspi-tcp-x/timeoutconn.h +++ b/ucspi-tcp-x/timeoutconn.h @@ -1,5 +1,8 @@ /* * $Log: timeoutconn.h,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2023-06-18 13:24:44+05:30 Cprogrammer * added timeoutconn_un function * @@ -29,6 +32,6 @@ int timeoutconn(int, char ip[4], uint16, unsigned int); #ifdef LIBC_HAS_IP6 int timeoutconn6(int, char ip[16], uint16, unsigned int, uint32); #endif -int timeoutconn_un(int, char *, unsigned int); +int timeoutconn_un(int, const char *, unsigned int); #endif diff --git a/ucspi-tcp-x/timeoutconn_un.c b/ucspi-tcp-x/timeoutconn_un.c index 6134f4b4d9..f53c1e2c9b 100644 --- a/ucspi-tcp-x/timeoutconn_un.c +++ b/ucspi-tcp-x/timeoutconn_un.c @@ -1,5 +1,8 @@ /* * $Log: timeoutconn_un.c,v $ + * Revision 1.2 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.1 2023-06-16 23:47:29+05:30 Cprogrammer * Initial revision * @@ -11,7 +14,7 @@ #include "timeoutconn.h" int -timeoutconn_un(int s, char *socket, unsigned int timeout) +timeoutconn_un(int s, const char *socket, unsigned int timeout) { struct taia now; struct taia deadline; diff --git a/ucspi-tcp-x/trypoll.c b/ucspi-tcp-x/trypoll.c index 92cc4cc86f..2ed2c4f5dd 100644 --- a/ucspi-tcp-x/trypoll.c +++ b/ucspi-tcp-x/trypoll.c @@ -1,5 +1,8 @@ /* * $Log: trypoll.c,v $ + * Revision 1.3 2024-05-09 22:58:51+05:30 Cprogrammer + * added unistd.h + * * Revision 1.2 2008-08-03 18:55:46+05:30 Cprogrammer * poll is broken on Darwin * diff --git a/ucspi-tcp-x/tryshsgr.c b/ucspi-tcp-x/tryshsgr.c index eadd6e12e4..5610fdf308 100644 --- a/ucspi-tcp-x/tryshsgr.c +++ b/ucspi-tcp-x/tryshsgr.c @@ -1,5 +1,8 @@ /* * $Log: tryshsgr.c,v $ + * Revision 1.2 2024-05-09 22:58:59+05:30 Cprogrammer + * added unistd.h + * * Revision 1.1 2003-12-31 19:47:31+05:30 Cprogrammer * Initial revision * diff --git a/ucspi-tcp-x/upathexec.h b/ucspi-tcp-x/upathexec.h index 6dd432a400..46d772059a 100644 --- a/ucspi-tcp-x/upathexec.h +++ b/ucspi-tcp-x/upathexec.h @@ -1,5 +1,8 @@ /* * $Log: upathexec.h,v $ + * Revision 1.6 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.5 2021-06-15 08:24:29+05:30 Cprogrammer * renamed pathexec.. functions to upathexec to avoid clash with libqmail * @@ -19,11 +22,11 @@ #ifndef PATHEXEC_H #define PATHEXEC_H -void upathexec_run(char *, char **, char **); -int upathexec_env(char *, char *); +int upathexec_env(const char *, const char *); +void upathexec_run(const char *, char **, char **); void upathexec(char **); #ifdef LOAD_SHARED_OBJECTS -void load_shared(char *, char **, char **); +void load_shared(const char *, char **, char **); void pathexec_dl(int, char **, char **, int (*) (int, char **, char **)); #endif diff --git a/ucspi-tcp-x/upathexec_env.c b/ucspi-tcp-x/upathexec_env.c index 697f087017..53e3e80ca4 100644 --- a/ucspi-tcp-x/upathexec_env.c +++ b/ucspi-tcp-x/upathexec_env.c @@ -1,5 +1,8 @@ /* * $Log: upathexec_env.c,v $ + * Revision 1.9 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.8 2021-05-12 21:03:20+05:30 Cprogrammer * replaced pathexec with upathexec * @@ -36,7 +39,7 @@ static stralloc plus; static stralloc tmp; int -upathexec_env(char *s, char *t) +upathexec_env(const char *s, const char *t) { if (!s) return 1; diff --git a/ucspi-tcp-x/upathexec_run.c b/ucspi-tcp-x/upathexec_run.c index 3d801e9f20..1039a490e4 100644 --- a/ucspi-tcp-x/upathexec_run.c +++ b/ucspi-tcp-x/upathexec_run.c @@ -1,5 +1,8 @@ /* * $Log: upathexec_run.c,v $ + * Revision 1.7 2024-05-09 22:55:54+05:30 mbhangui + * fix discarded-qualifier compiler warnings + * * Revision 1.6 2021-05-12 21:03:30+05:30 Cprogrammer * replace pathexec with upathexec * @@ -29,9 +32,9 @@ static stralloc tmp; void -upathexec_run(char *file, char **argv, char **envp) +upathexec_run(const char *file, char **argv, char **envp) { - char *path; + const char *path; unsigned int split; int savederrno;