From 1830d4d54020beb3b142f9308e0af0526de2c4d6 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Tue, 11 Sep 2001 14:36:05 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r320, which included commits to RCS files with non-trunk default branches. --- NEWS | 16 + README | 54 +- acconfig.h | 10 +- regen.sh | 3 + src/Makefile.djgpp | 10 +- src/NTMake9x | 19 +- src/NTMakefile | 27 +- src/README-NT | 112 +- src/README-WIN9X | 30 + src/WINNT/afs_setup_utils/NTMakefile | 33 +- src/WINNT/afs_setup_utils/afs_setup_utils.cpp | 4174 +++++++++-------- src/WINNT/afsclass/NTMakefile | 2 + src/WINNT/afsclass/afsclassfn.cpp | 2 +- src/WINNT/afsd/cm_callback.c | 2 +- src/WINNT/afsd/cm_utils.c | 1 + src/WINNT/afsd/fs.c | 2 +- src/WINNT/afsd/krb.h | 8 +- src/WINNT/afsd/smb_ioctl.c | 4 + .../install/InstallShield5/BuildSetup.bat | 8 +- .../InstallShield5/CreateGeneratedFiles.bat | 2 +- .../InstallShield5/CreateISDirTree.bat | 2 +- src/WINNT/install/InstallShield5/Default.shl | 20 + .../install/InstallShield5/GatherFiles.bat | 5 +- .../install/InstallShield5/GenDefault.mda.bat | 12 +- .../install/InstallShield5/GenFileGroups.bat | 8 +- .../install/InstallShield5/GenIS5.ipr.bat | 10 +- .../InstallShield5/HowToSetTheVersion.txt | 127 +- src/WINNT/install/InstallShield5/NTMakefile | 60 +- .../install/InstallShield5/ScatterFiles.bat | 3 +- src/WINNT/install/InstallShield5/setup.rul | 930 +++- src/WINNT/install/Win9x/NTMakeFile | 13 +- src/WINNT/pthread/NTMakefile | 4 +- src/WINNT/win9xpanel/CAfs.cpp | 18 +- src/WINNT/win9xpanel/Change.cpp | 6 - src/WINNT/win9xpanel/NTMakefile | 7 +- src/WINNT/win9xpanel/WinAfsLoad.cpp | 5 +- src/WINNT/win9xpanel/WinAfsLoad.h | 4 +- src/WINNT/win9xpanel/WinAfsLoad.rc | 25 +- src/WINNT/win9xpanel/WinAfsLoadDlg.cpp | 369 +- src/WINNT/win9xpanel/WinAfsLoadDlg.h | 2 + src/WINNT/win9xpanel/cafs.h | 13 +- src/afs/AIX/osi_file.c | 4 +- src/afs/AIX/osi_timeout.c | 4 +- src/afs/AIX/osi_vnodeops.c | 4 +- src/afs/DARWIN/osi_file.c | 4 +- src/afs/DARWIN/osi_module.c | 7 +- src/afs/DARWIN/osi_vfsops.c | 14 +- src/afs/DARWIN/osi_vnodeops.c | 10 +- src/afs/DUX/osi_file.c | 4 +- src/afs/DUX/osi_vfsops.c | 14 +- src/afs/FBSD/osi_file.c | 4 +- src/afs/FBSD/osi_vfsops.c | 14 +- src/afs/HPUX/osi_file.c | 4 +- src/afs/HPUX/osi_vnodeops.c | 16 +- src/afs/IRIX/osi_file.c | 4 +- src/afs/IRIX/osi_groups.c | 4 +- src/afs/IRIX/osi_inode.c | 14 +- src/afs/IRIX/osi_vnodeops.c | 4 +- src/afs/LINUX/osi_alloc.c | 5 +- src/afs/LINUX/osi_groups.c | 6 +- src/afs/LINUX/osi_vfs.h | 15 + src/afs/LINUX/osi_vfsops.c | 15 +- src/afs/SOLARIS/osi_file.c | 4 +- src/afs/SOLARIS/osi_vnodeops.c | 62 +- src/afs/UKERNEL/afs_usrops.c | 8 +- src/afs/VNOPS/afs_vnop_fid.c | 14 +- src/afs/VNOPS/afs_vnop_strategy.c | 6 +- src/afs/VNOPS/afs_vnop_write.c | 6 +- src/afs/afs_buffer.c | 4 +- src/afs/afs_callback.c | 78 +- src/afs/afs_cbqueue.c | 4 +- src/afs/afs_cell.c | 4 +- src/afs/afs_conn.c | 4 +- src/afs/afs_dcache.c | 32 +- src/afs/afs_exporter.c | 4 +- src/afs/afs_init.c | 8 +- src/afs/afs_memcache.c | 24 +- src/afs/afs_nfsclnt.c | 6 +- src/afs/afs_osi.c | 6 +- src/afs/afs_osi_uio.c | 6 +- src/afs/afs_osi_vget.c | 4 +- src/afs/afs_osidnlc.c | 16 +- src/afs/afs_segments.c | 6 +- src/afs/afs_server.c | 32 +- src/afs/afs_stat.c | 9 +- src/afs/afs_user.c | 4 +- src/afs/afs_vcache.c | 16 +- src/afs/afs_volume.c | 10 +- src/afsd/afs.rc.darwin | 1 + src/afsd/afsd.c | 484 +- src/afsmonitor/afsmonitor.c | 70 +- src/afsweb/apache_afs_cache.c | 12 +- src/afsweb/apache_afs_client.c | 36 +- src/afsweb/apache_afs_utils.c | 16 +- src/afsweb/apache_includes/1.2/conf.h | 11 +- src/afsweb/apache_includes/1.3.1/ap_config.h | 13 +- src/afsweb/apache_includes/1.3.6/ap_config.h | 13 +- src/afsweb/apache_includes/conf.h | 11 +- src/afsweb/weblog.c | 18 +- src/audit/audit.c | 10 +- src/auth/cellconfig.c | 20 +- src/auth/ktc.c | 30 +- src/auth/setkey.c | 12 +- src/auth/test/testcellconf.c | 4 +- src/auth/writeconfig.c | 4 +- src/bozo/bnode.c | 12 +- src/bozo/bos.c | 10 +- src/bozo/bosoprocs.c | 26 +- src/bozo/bosserver.c | 4 +- src/bozo/cronbnodeops.c | 4 +- src/bozo/ezbnodeops.c | 4 +- src/bozo/fsbnodeops.c | 4 +- src/bu_utils/fms.c | 6 +- src/bucoord/bc_status.c | 4 +- src/bucoord/commands.c | 37 +- src/bucoord/config.c | 8 +- src/bucoord/dsstub.c | 4 +- src/bucoord/dsvs.c | 23 +- src/bucoord/dump.c | 14 +- src/bucoord/dump_sched.c | 4 +- src/bucoord/expire.c | 6 +- src/bucoord/main.c | 4 +- src/bucoord/restore.c | 20 +- src/bucoord/status.c | 4 +- src/bucoord/tape_hosts.c | 6 +- src/bucoord/ttest.c | 10 +- src/bucoord/ubik_db_if.c | 18 +- src/bucoord/vol_sets.c | 6 +- src/budb/database.c | 6 +- src/budb/db_alloc.c | 6 +- src/budb/db_dump.c | 4 +- src/budb/db_hash.c | 6 +- src/budb/db_text.c | 6 +- src/budb/dbs_dump.c | 6 +- src/budb/ol_verify.c | 12 +- src/budb/procs.c | 20 +- src/budb/server.c | 8 +- src/budb/struct_ops.c | 6 +- src/butc/dbentries.c | 12 +- src/butc/dump.c | 22 +- src/butc/list.c | 4 +- src/butc/lwps.c | 50 +- src/butc/recoverDb.c | 26 +- src/butc/tcmain.c | 4 +- src/butc/tcprocs.c | 4 +- src/butc/tcudbprocs.c | 50 +- src/butc/tdump.c | 2 +- src/butc/test.c | 2 +- src/butm/butm_test.c | 6 +- src/butm/file_tm.c | 18 +- src/butm/test_ftm.c | 8 +- src/config/Makefile.alpha_dux40.in | 7 +- src/config/Makefile.alpha_dux50.in | 7 +- src/config/Makefile.alpha_linux_22.in | 5 +- src/config/Makefile.djgpp.common | 4 +- src/config/Makefile.hp_ux102.in | 3 +- src/config/Makefile.hp_ux110.in | 5 +- src/config/Makefile.i386_djgpp | 7 +- src/config/Makefile.i386_fbsd_42.in | 8 +- src/config/Makefile.i386_linux24.in | 7 +- src/config/Makefile.ppc_darwin_12.in | 5 +- src/config/Makefile.ppc_darwin_13.in | 5 +- src/config/Makefile.ppc_linux24.in | 6 +- src/config/Makefile.rs_aix42.in | 3 +- src/config/Makefile.s390_linux22.in | 5 +- src/config/Makefile.s390_linux24.in | 5 +- src/config/Makefile.sgi_62.in | 7 +- src/config/Makefile.sgi_63.in | 3 +- src/config/Makefile.sgi_64.in | 7 +- src/config/Makefile.sgi_65.in | 7 +- src/config/Makefile.sparc64_linux22.in | 5 +- src/config/Makefile.sparc64_linux24.in | 5 +- src/config/Makefile.sparc_linux22.in | 5 +- src/config/Makefile.sun4x_55.in | 7 +- src/config/Makefile.sun4x_56.in | 7 +- src/config/Makefile.sun4x_57.in | 7 +- src/config/Makefile.sun4x_58.in | 7 +- src/config/Makefile.sunx86_54.in | 3 +- src/config/Makefile.version-CML | 6 +- src/config/Makefile.version-NOCML.in | 7 +- src/config/NTMakefile | 70 +- src/config/NTMakefile.i386_nt40 | 6 + src/config/NTMakefile.i386_win95 | 6 + src/config/NTVersioninfo.rc | 10 +- src/config/afs_sysnames.h | 8 + src/config/param.i386_nt40.h | 12 +- src/config/param.i386_win95.h | 12 +- src/config/param.sun4x_55.h | 5 +- src/config/param.sun4x_56.h | 5 +- src/config/param.sun4x_57.h | 5 +- src/config/param.sun4x_58.h | 5 +- src/config/param.sun4x_58_usr.h | 2 + src/config/param.sunx86_54.h | 2 +- src/config/stds.h | 4 +- src/config/util_cr.c | 203 +- src/dauth/dlog.c | 23 +- src/des/NTMakefile | 22 +- src/des/andrew-conf.h | 4 + src/des/cbc_encrypt.c | 30 +- src/des/cksum.c | 21 +- src/des/crypt.c | 15 +- src/des/des.c | 10 +- src/des/enc.c | 4 +- src/des/misc.c | 71 +- src/des/new_rnd_key.c | 12 +- src/des/pcbc_encrypt.c | 34 +- src/des/read_pssword.c | 25 +- src/des/strng_to_key.c | 13 +- src/des/weak_key.c | 11 +- src/dir/buffer.c | 3 +- src/dir/salvage.c | 6 +- src/dir/test/dtest.c | 4 +- src/export/cfgexport.c | 4 +- src/export/symtab.c | 4 +- src/fsprobe/fsprobe.c | 17 +- src/fsprobe/fsprobe_test.c | 8 +- src/ftpd43+/ftpcmd.y | 2 +- src/ftpd43+/ftpd.c | 2 +- src/ftpd43+/logwtmp.c | 2 +- src/ftpd43+/popen.c | 4 +- src/gtx/frame.c | 12 +- src/gtx/keymap.c | 6 +- src/gtx/textcb.c | 8 +- src/inetd/inetd.c | 6 +- src/inetd/setenv.c | 4 +- src/inetd/ta-rauth.c | 6 +- src/kauth/admin_tools.c | 8 +- src/kauth/authclient.c | 22 +- src/kauth/client.c | 12 +- src/kauth/kadatabase.c | 32 +- src/kauth/kaprocs.c | 72 +- src/kauth/kaserver.c | 6 +- src/kauth/kautils.c | 6 +- src/kauth/kdb.c | 4 +- src/kauth/kkids.c | 8 +- src/kauth/klog.c | 11 +- src/kauth/klogin.c | 14 +- src/kauth/knfs.c | 45 +- src/kauth/kpasswd.c | 42 +- src/kauth/krb_udp.c | 25 +- src/kauth/manyklog.c | 9 +- src/kauth/read_passwd.c | 12 +- src/kauth/rebuild.c | 4 +- src/kauth/test/multiklog.c | 11 +- src/kauth/test/test_badtix.c | 16 +- src/kauth/test/test_getticket.c | 4 +- src/kauth/test/test_interim_ktc.c | 18 +- src/kauth/test/test_rxkad_free.c | 10 +- src/kauth/user.c | 6 +- src/kauth/user_nt.c | 4 +- src/libacl/aclprocs.c | 15 +- src/libadmin/bos/afs_bosAdmin.c | 4 +- src/libadmin/client/afs_clientAdmin.c | 4 +- src/libadmin/test/bos.c | 4 +- src/libadmin/vos/afs_vosAdmin.c | 8 +- src/libadmin/vos/lockprocs.c | 8 +- src/libadmin/vos/vosutils.c | 18 +- src/libadmin/vos/vsprocs.c | 28 +- src/libafs/MakefileProto.AIX.in | 100 +- src/libafs/MakefileProto.DARWIN.in | 57 +- src/libafs/MakefileProto.DUX.in | 63 +- src/libafs/MakefileProto.FBSD.in | 63 +- src/libafs/MakefileProto.HPUX.in | 59 +- src/libafs/MakefileProto.IRIX.in | 177 +- src/libafs/MakefileProto.SOLARIS.in | 84 +- src/libuafs/Makefile.common | 90 +- src/log/kseal.c | 8 +- src/log/test/testlog.c | 4 +- src/login/login.c | 6 +- src/login/setenv.c | 4 +- src/login/util_logout.c | 6 +- src/lwp/iomgr.c | 4 +- src/lwp/test/selsubs.c | 4 +- src/lwp/test/testlwp.c | 4 +- src/lwp/threadname.c | 8 +- src/lwp/waitkey.c | 2 +- src/mpp/mpp.c | 6 +- src/ntp/mkntpconf.c | 10 +- src/ntp/ntp.c | 6 +- src/ntp/ntp.h | 2 +- src/ntp/ntp_adjust.c | 4 +- src/ntp/ntpd.c | 11 +- src/ntp/ntpdc.c | 10 +- src/ntp/read_psti.c | 6 +- src/ntp/runntp.c | 4 +- src/ntp/test.c | 6 +- src/package/check.c | 5 +- src/package/conftree.c | 2 +- src/pam/Makefile.in | 79 +- src/pam/afs_auth.c | 188 +- src/pam/afs_message.c | 34 +- src/pam/afs_message.h | 20 +- src/pam/afs_password.c | 18 +- src/pam/afs_session.c | 74 +- src/pam/afs_setcred.c | 114 +- src/pam/afs_util.c | 122 +- src/pam/afs_util.h | 5 + src/pam/test_pam.c | 12 +- src/pinstall/install.c | 12 +- src/ptserver/db_verify.c | 14 +- src/ptserver/ptclient.c | 8 +- src/ptserver/ptprocs.c | 12 +- src/ptserver/ptuser.c | 4 +- src/ptserver/ptutils.c | 38 +- src/ptserver/readgroup.c | 20 +- src/ptserver/readpwd.c | 12 +- src/ptserver/testpt.c | 14 +- src/ptserver/utils.c | 40 +- src/rcp/rcp.c | 14 +- src/rlogind/rexecd.c | 6 +- src/rlogind/rlogind.c | 36 +- src/rsh/rcmd.c | 15 +- src/rsh/rlogin.c | 8 +- src/rsh/rsh.c | 6 +- src/rx/AIX/rx_knet.c | 8 +- src/rx/DARWIN/rx_knet.c | 4 +- src/rx/DUX/rx_knet.c | 8 +- src/rx/FBSD/rx_knet.c | 8 +- src/rx/HPUX/rx_knet.c | 14 +- src/rx/IRIX/rx_knet.c | 16 +- src/rx/SOLARIS/rx_knet.c | 18 +- src/rx/bulk.example/bulk_client.c | 4 +- src/rx/bulktest/bulk_client.c | 6 +- src/rx/multi.example/sample_client.c | 4 +- src/rx/rx.h | 1 + src/rx/rx_event.c | 5 +- src/rx/rx_kcommon.c | 18 +- src/rx/rx_misc.c | 8 +- src/rx/rx_packet.h | 15 +- src/rx/rx_rdwr.c | 20 +- src/rx/rx_stream.c | 10 +- src/rx/rx_stream.h | 4 +- src/rx/rx_trace.c | 10 +- src/rx/rx_user.c | 18 +- src/rx/rxdebug.c | 12 +- src/rx/simple.example/sample_client.c | 4 +- src/rx/test/kctest.c | 8 +- src/rx/test/testclient.c | 4 +- src/rx/xdr_afsuuid.c | 6 +- src/rx/xdr_int64.c | 4 +- src/rx/xdr_mem.c | 6 +- src/rx/xdr_rec.c | 6 +- src/rx/xdr_refernce.c | 4 +- src/rxgen/rpc_clntout.c | 4 +- src/rxgen/rpc_cout.c | 8 +- src/rxgen/rpc_main.c | 27 +- src/rxgen/rpc_parse.c | 22 +- src/rxgen/rpc_scan.c | 8 +- src/rxgen/rpc_svcout.c | 10 +- src/rxgen/rpc_util.c | 10 +- src/rxkad/domestic/crypt_conn.c | 6 +- src/rxkad/domestic/fcrypt.c | 18 +- src/rxkad/domestic/tcrypt.c | 12 +- src/rxkad/rxkad_client.c | 21 +- src/rxkad/rxkad_common.c | 19 +- src/rxkad/rxkad_server.c | 20 +- src/rxkad/test/stress.c | 6 +- src/rxkad/test/stress_c.c | 10 +- src/rxkad/test/stress_s.c | 4 +- src/rxkad/ticket.c | 12 +- src/scout/scout.c | 10 +- src/sys/rmtsysc.c | 6 +- src/sys/rmtsyss.c | 6 +- src/tbutc/NTMakefile | 2 +- src/tsm41/aix41_auth.c | 4 +- src/tviced/NTMakefile | 1 + src/ubik/beacon.c | 6 +- src/ubik/disk.c | 18 +- src/ubik/recovery.c | 5 +- src/ubik/remote.c | 4 +- src/ubik/ubik.c | 16 +- src/ubik/ubikcmd.c | 6 +- src/ubik/udebug.c | 10 +- src/ubik/vote.c | 14 +- src/update/client.c | 10 +- src/update/server.c | 8 +- src/update/utils.c | 8 +- src/usd/usd_file.c | 8 +- src/usd/usd_nt.c | 8 +- src/uss/lex.c | 7 +- src/uss/uss_fs.c | 4 +- src/uss/uss_kauth.c | 7 +- src/uss/uss_procs.c | 7 +- src/uss/uss_ptserver.c | 3 +- src/uss/uss_vol.c | 4 +- src/util/NTMakefile | 3 + src/util/hostparse.c | 10 +- src/util/kreltime.c | 6 +- src/util/ktime.c | 6 +- src/util/netutils.c | 8 +- src/util/serverLog.c | 8 +- src/util/uuid.c | 6 +- src/util/volparse.c | 10 +- src/venus/cacheout.c | 6 +- src/venus/cmdebug.c | 4 +- src/venus/fs.c | 62 +- src/venus/up.c | 10 +- src/vfsck/dir.c | 35 +- src/vfsck/inode.c | 6 +- src/vfsck/main.c | 4 +- src/vfsck/pass1.c | 9 +- src/vfsck/pass1b.c | 4 +- src/vfsck/pass2.c | 16 +- src/vfsck/pass3.c | 4 +- src/vfsck/pass4.c | 4 +- src/vfsck/pass5.c | 55 +- src/vfsck/proplist.c | 5 +- src/vfsck/setup.c | 28 +- src/vfsck/utilities.c | 10 +- src/viced/callback.c | 4 +- src/viced/fsprobe.c | 66 +- src/viced/host.c | 8 +- src/viced/physio.c | 6 +- src/viced/profile.c | 4 +- src/viced/viced.c | 10 +- src/vlserver/cnvldb.c | 24 +- src/vlserver/sascnvldb.c | 6 +- src/vlserver/vlclient.c | 42 +- src/vlserver/vldb_check.c | 8 +- src/vlserver/vlprocs.c | 20 +- src/vlserver/vlserver.c | 8 +- src/vlserver/vlutils.c | 48 +- src/vol/clone.c | 4 +- src/vol/devname.c | 6 +- src/vol/fs_conv_411.c | 7 +- src/vol/fssync.c | 4 +- src/vol/gi.c | 9 +- src/vol/nuke.c | 4 +- src/vol/physio.c | 8 +- src/vol/purge.c | 4 +- src/vol/test/listVicepx.c | 3 +- src/vol/vnode.c | 8 +- src/vol/vol-info.c | 4 +- src/vol/vol-salvage.c | 24 +- src/vol/volume.c | 12 +- src/vol/vutil.c | 10 +- src/volser/dumpstuff.c | 12 +- src/volser/physio.c | 8 +- src/volser/restorevol.c | 8 +- src/volser/volprocs.c | 18 +- src/volser/voltrans.c | 4 +- src/volser/vos.c | 138 +- src/volser/vsprocs.c | 24 +- src/volser/vsutils.c | 14 +- src/xstat/xstat_cm.c | 11 +- src/xstat/xstat_cm_test.c | 4 +- src/xstat/xstat_fs.c | 11 +- src/xstat/xstat_fs_test.c | 4 +- 448 files changed, 7532 insertions(+), 5199 deletions(-) diff --git a/NEWS b/NEWS index 85a61c748..f1096ccad 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,13 @@ Openafs News -- history of user Visible changes. 11 July 2001 +* Changes since OpenAFS 1.1.1 + +** AFS now supports --prefix and the other directory options of + configure. By default AFS builds assuming it will be installed in + /usr/local. In order to get traditional AFS directory paths (/usr/afs + and /usr/vice/etc) use the --enable-transarc-paths option to + configure. More details on the new directory layout are found in README. + * Changes since Openafs 1.0 ** AFS now builds with configure. The README for building has been @@ -129,3 +137,11 @@ Openafs News -- history of user Visible changes. 11 July 2001 install directory. These commands include klog, unlog, tokens, kpasswd, symlink, fs and pts. The installable includes a readme file that contains more information on how to use the client program and known issues. + +** support for large caches in afsd. Cachefiles are stored in + subdirectories. The default is 2048 files per subdirectory, which + should work fine in most situations. You can use the new afsd + option -files_per_subdir to change this number. Note that the first + time you run afsd with this patch, your cachefiles will get moved + into subdirectories. If you subsequently run an older version of + afsd, you will lose all your cached files. diff --git a/README b/README index ca463b17b..9d20c5a0d 100644 --- a/README +++ b/README @@ -5,6 +5,18 @@ This software has been released under the terms of the IBM Public License. For details, see the LICENSE file in the top-level source directory or online at http://www.openafs.org/dl/license10.html +Short instructions for sites upgrading from a previous version of AFS: +% ./configure --enable-transarc-paths +% make +% make dest + +will create a Transarc-style dest tree in ${SYS_NAME}/dest where +${SYS_NAME} is the AFS sysname of the system you built for. +This assumes if you're building for Linux that your kernel source is +in /usr/src/linux. + +Otherwise, please read on. + Building OpenAFS on UNIX and LINUX ---------------------------------- @@ -28,16 +40,18 @@ A. Creating the proper directory structure. sun4x_57 sun4x_58 ppc_darwin_13 - alpha_linux_22 (DES does not work, will require one more change to + ppc_linux22 + ppc_linux24 + alpha_linux22 (DES does not work, will require one more change to compile) hp_ux110 (No client support, but db servers and utilities work) hp_ux102 (No client support, but db servers and utilities work) 2. Using configure in the top level directory, configure for your AFS system type, providing the necessary flags: - % ./configure --with-afs-sysname=sun4x_58 + % ./configure --with-afs-sysname=sun4x_58 --enable-transarc-paths - For Linux systems you need also provide the patch in which your + For Linux systems you need also provide the path in which your kernel headers for your configured kernel can be found. This should be the path of the directory containing a child directory named "include". So if your version file was @@ -53,15 +67,43 @@ A. Creating the proper directory structure. or insecure software included with OpenAFS. See README.obsolete and README.insecure for more details. + There are two modes for directory path handling: "Transarc mode" and "default mode": + - In Transarc mode, we retain compatibility with Transarc/IBM AFS tools + by putting client configuaration files in /usr/vice/etc, and server + files in /usr/afs under the traditional directory layout. + - In default mode, files are located in standardized locations, usually + under $(prefix). + - Client programs, libraries, and related files always go in standard + directories under $(prefix). This rule covers things that would go + into $(bindir), $(includedir), $(libdir), $(mandir), and $(sbindir). + - Other files get located in the following places: + + Directory Transarc Mode Default Mode + ============ ========================= ============================== + viceetcdir /usr/vice/etc $(sysconfdir)/openafs + afssrvdir /usr/afs/bin (servers) $(libexecdir)/openafs + afsconfdir /usr/afs/etc $(sysconfdir)/openafs/server + afslocaldir /usr/afs/local $(localstatedir)/openafs + afsdbdir /usr/afs/db $(localstatedir)/openafs/db + afslogdir /usr/afs/logs $(localstatedir)/openafs/logs + afsbosconfig $(afslocaldir)/BosConfig $(afsconfdir)/BosConfig + afsbosserver $(afsbindir)/bosserver $(sbindir)/bosserver + + B Building 1. Now, you can build OpenAFS. % make - When the build completes, you will have a complete binary tree - in the dest directory under the directory named for the sys_name you - built for, e.g. sun4x_57/dest or i386_linux22/dest + 2. Install your build using either "make install" to install + into the current system (you will need to be root, and files + will be placed as appropriate for Transarc or standard paths), + "make install DESTDIR=/some/path" to install into an alternate + directory tree, or if you configured with --enable-transarc-paths + make dest to create a complete binary tree in the dest directory + under the directory named for the sys_name you built for, + e.g. sun4x_57/dest or i386_linux22/dest 2. As appropriate you can clean up or, if you're using Linux, build for another kernel version: diff --git a/acconfig.h b/acconfig.h index 395c77a26..12ef98bd8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -22,13 +22,19 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #undef AFS_AFSDB_ENV #undef AFS_NAMEI_ENV -#undef BOS_RESTRICTED_MODE -#undef FAST_RESTART #undef BITMAP_LATER +#undef BOS_RESTRICTED_MODE +#undef FAST_RESTART +#undef FULL_LISTVOL_SWITCH #undef INODE_SETATTR_NOT_VOID #undef STRUCT_INODE_HAS_I_BYTES +#undef STRUCT_INODE_HAS_I_CDEV +#undef STRUCT_INODE_HAS_I_TRUNCATE_SEM +#undef STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS +#undef STRUCT_INODE_HAS_I_MAPPING_OVERLOAD +#undef STRUCT_INODE_HAS_I_MMAP_SHARED #undef STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK /* glue for RedHat kernel bug */ diff --git a/regen.sh b/regen.sh index 9875b78d7..1aa095317 100755 --- a/regen.sh +++ b/regen.sh @@ -3,6 +3,9 @@ echo "Running aclocal" aclocal -I src/cf echo "Running autoconf" autoconf +echo "Running autoconf for configure-libafs" +autoconf configure-libafs.in > configure-libafs +chmod +x configure-libafs echo "Running autoheader" autoheader #echo "Running automake" diff --git a/src/Makefile.djgpp b/src/Makefile.djgpp index 362b1b2c1..e0316f8d4 100644 --- a/src/Makefile.djgpp +++ b/src/Makefile.djgpp @@ -17,11 +17,11 @@ includes: afsdinc osiinc authinc libs: fsint cmd lwp osi rx rxkad vldb rxstat acl clean: - -rm -f $(SYS_NAME)/dest/include/* - -rm -f $(SYS_NAME)/dest/include/afs/* - -rm -f $(SYS_NAME)/dest/lib/* - -rm -f $(SYS_NAME)/dest/lib/afs/* - -rm -f $(SYS_NAME)/dest/bin/* + -$(RM) -f $(SYS_NAME)/dest/include/* + -$(RM) -f $(SYS_NAME)/dest/include/afs/* + -$(RM) -f $(SYS_NAME)/dest/lib/* + -$(RM) -f $(SYS_NAME)/dest/lib/afs/* + -$(RM) -f $(SYS_NAME)/dest/bin/* config: -make -C $(OBJ)/config install diff --git a/src/NTMake9x b/src/NTMake9x index 8b84b8986..2e766745d 100644 --- a/src/NTMake9x +++ b/src/NTMake9x @@ -23,7 +23,7 @@ NTMAKELANG = nmake /nologo /f ntmakefile en_install NTMAKE_HEADERS = nmake /nologo /f ntmakefile install_headers NTMAKE_LIBUTILS = nmake /nologo /f ntmakefile install_libutils MKDIR = mkdir -#OBJ = src +OBJ = src # Standard install directory. !IFDEF AFSDEV_DESTDIR @@ -292,10 +292,15 @@ install9x: install #Leave last echo in - it helps the build reconize the last $(CD) Win9x:: - $(CD) $(OBJ)\WINNT\install\$@ - nmake /nologo /f NTMakefile install9x + echo ***** afs_setup_utils + $(CD) $(OBJ)\WINNT\afs_setup_utils + nmake -f ntmakefile install + $(CD) ..\..\.. + echo ***** Win9x + $(CD) $(OBJ)\WINNT\install\Win9x + nmake /nologo /f NTMakefile isinstall $(CD) ..\..\..\.. - echo **** End of Install Scripts + eho **** End of Install Scripts media: Win9x @@ -307,9 +312,9 @@ clean: start $(CD) $(OBJ)\WINNT\install\Win9x nmake /nologo /f NTMakefile clean $(CD) ..\..\..\.. - .\src\rmbat $(DESTDIR)\include\*.* $(DESTDIR)\include\afs\*.* $(DESTDIR)\include\WINNT\*.* $(DESTDIR)\include\rx\*.* - .\src\rmbat $(DESTDIR)\LIB\*.LIB $(DESTDIR)\LIB\*.DLL $(DESTDIR)\LIB\AFS\*.LIB - .\src\RMBAT $(DESTDIR)\root.client\usr\vice\etc\*.* + $(DESTDIR)\BIN\rmbat $(DESTDIR)\include\*.* $(DESTDIR)\include\afs\*.* $(DESTDIR)\include\WINNT\*.* $(DESTDIR)\include\rx\*.* + $(DESTDIR)\BIN\rmbat $(DESTDIR)\LIB\*.LIB $(DESTDIR)\LIB\*.DLL $(DESTDIR)\LIB\AFS\*.LIB + $(DESTDIR)\BIN\rmbat $(DESTDIR)\root.client\usr\vice\etc\*.* $(CD) $(OBJ)\config nmake /nologo /f ntmakefile clean_version $(CD) ..\.. diff --git a/src/NTMakefile b/src/NTMakefile index b6ebfa5e8..268119af6 100644 --- a/src/NTMakefile +++ b/src/NTMakefile @@ -22,7 +22,7 @@ NTMAKE = nmake /nologo /f ntmakefile install NTMAKELANG = nmake /nologo /f ntmakefile en_US NTMAKE_HEADERS = nmake /nologo /f ntmakefile install_headers MKDIR = mkdir -OBJ = obj +OBJ = src # Standard install directory. !IFDEF AFSDEV_DESTDIR @@ -326,37 +326,37 @@ libadmin: tbutc $(CD) $(OBJ)\$@ $(NTMAKE) $(CD) ..\.. - + adminutil: libadmin echo ***** $@ $(CD) $(OBJ)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. - + vos: adminutil echo ***** $@ $(CD) $(OBJ)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. - + client: vos echo ***** $@ $(CD) $(OBJ)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. - + kas: client echo ***** $@ $(CD) $(OBJ)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. - + pts: kas echo ***** $@ $(CD) $(OBJ)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. - + bos: pts echo ***** $@ $(CD) $(OBJ)\libadmin\$@ @@ -417,13 +417,7 @@ afssvrcpa: afssvrcfg $(NTMAKE) $(CD) ..\..\.. -afs_setup_utils: afssvrcpa - echo ***** $@ - $(CD) $(OBJ)\WINNT\$@ - $(NTMAKE) - $(CD) ..\..\.. - -client_talocale: afs_setup_utils +client_talocale: afssvrcpa echo ***** $@ $(CD) $(OBJ)\WINNT\talocale $(NTMAKE) @@ -476,6 +470,11 @@ install: start finale # InstallShield dependencies InstallShield5: install + echo ***** afs_setup_utils + $(CD) $(OBJ)\WINNT\afs_setup_utils + $(NTMAKE) + $(CD) ..\..\.. + $(CD) $(OBJ)\WINNT\install\$@ $(NTMAKE) $(CD) ..\..\..\.. diff --git a/src/README-NT b/src/README-NT index 9973d5f82..90b27ace8 100644 --- a/src/README-NT +++ b/src/README-NT @@ -3,7 +3,7 @@ All Rights Reserved. This software has been released under the terms of the IBM Public License. For details, see the LICENSE file in the top-level source -directory or online at http://www.openafs.org/dl/license10.html +directory or on-line at http://www.openafs.org/dl/license10.html Building OpenAFS on Windows NT ------------------------------ @@ -22,10 +22,10 @@ Each step is explained in detail below: A. Install a compiler - You must install a copy of Microsoft Visual C++ 5.0 (6 might also - work). The "Typical" install setting is sufficient. It may be - possible to use other compilers, but the source code as provided - will work with MS VC++ 5.0. + You must install a copy of Microsoft Visual C++ 5.0 or 6.0. The + "Typical" install setting is sufficient. It may be possible to use + other compilers, but the source code as provided will work with MS + VC++ 5.0/6.0. B. Add missing header files @@ -53,9 +53,17 @@ C. Optional: Install Installshield 5.x 2. build of the product plus an installer package In order to do the build that includes the installer package, a - copy of InstallShield 5.x must be installed. NOTE: InstallShield + copy of Installshield 5.x must be installed. NOTE: Installshield versions 6 and higher WILL NOT WORK. + Optional DLL's missing for Install Script + Two Microsoft DLL's must be included at DEST\WinInstall\Config\. + SHLWAPI.DLL + WININET.DLL + + These files are only used for the Install, they will not be left + on the target machine. + D. Optional: Install flex and bison There are two files in the source tree that are processed with lex @@ -91,63 +99,76 @@ E. Configure the OpenAFS build environment settings for you. Within this file there are the following lines that must be set to match your system settings: - set MSVCDIR= + * set SYS_NAME= + + * set MSVCDIR= Ex: set MSVCDIR=c:\progra~1\DevStudio\vc - This is the path to the compiler directory of the Microsot Visual + This is the path to the compiler directory of the Microsoft Visual C++ installation. - set AFSDEV_INCLUDE= + * set AFSDEV_INCLUDE= Ex: set AFSDEV_INCLUDE=%MSVCDIR%\include;%MSVCDIR%\mfc\include This contains a semicolon separated list of directories that - contain compiler provided include files. You do not need to add paths - here of AFS include files. + contain compiler provided include files. You should not need to + edit this other than to point to the DDK includes not provided + with the distribution - set AFSDEV_LIB= - Ex: set AFSDEV_LIB=%MSVCDIR%\lib;%MSVCDIR%\mfc\lib - - This contains a semicolon separated list of directories that - contain compiler provided library files. You do not need to add - paths here of AFS library files. - - set AFSDEV_BIN= - Ex: set AFSDEV_BIN=%MSVCDIR%\bin - - This is the path to the compiler binary files. - - set AFSROOT= + * set AFSROOT= Ex: set AFSROOT=d:\OpenAFS This is the root directory of OpenAFS, which is the parent directory of the src directory. - set IS5ROOT= + * set IS5ROOT= Ex: set IS5ROOT=d:\progra~1\instal~1\instal~1.1pr - This is the path to the InstallShield5 program directory. You - should only define this if you have InstallShield installed on - your computer and want to create the install package as part of + This is the path to the Installshield5 program directory. You + should only define this if you have Installshield installed on + your computer and want to create the install script as part of the build. - set BISON_SIMPLE= - set BISON_HAIRY= - Ex: set BISON_SIMPLE=c:\bin\bison.simple - Ex: set BISON_HAIRY=c:\bin\bison.hairy + NOTES: There are other settings in ntbuild.bat, but the ones listed + above must be set correctly for the build to succeed. + + As can be seen in the examples above, all paths in + ntbuild.bat must be in the old MSDOS 8.3 format. - bison has two files (in addition to the bison executable) that - must be on the system. In order for bison to find these files, - you must set the environment variables listed above to the paths - to these files. There are other ways to do this, but this is - what the build system expects. +F. Set version and installation options - NOTE: There are other settings in ntbuild.bat, but the ones listed - above must be set correctly for the build to succeed. + Modify .\src\config\NTMakefile.i386_nt40 + AFSPRODUCT_VERSION - Product version + CELLNAME_DEFAULT - The default AFS cell name + CELLSERVDB_INSTALL - The default name for the CellServDB included in the install script + CELLSERVDB_WEB - The default web address to obtain CellServDB + +For Example: + + .\src\config\NTMakefile.i386_nt40 + + AFSPRODUCT_VERSION=1.1.1a + CELLNAME_DEFAULT=openafs.org + CELLSERVDB_INSTALL=CellServDB.GrandCentral + CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB - As can be seen in the examples above, all paths in ntbuild.bat must - be in the old MSDOS 8.3 format. +NOTE: If CELLNAME_DEFAULT has a '.' in cell name, then the name is assumed to be +a valid cell name and when the user installs AFS the AFS Control Center +will default to NOT installed! -F. Begin the build +Version level may be specified in different formats, for example the following +forms all have the same version level; however will be displayed differently: + +AFSPRODUCT_VERSION=1.1.1a +AFSPRODUCT_VERSION=1.1.1 a +AFSPRODUCT_VERSION=1.1.1.1 +AFSPRODUCT_VERSION=1.1.101 + +Add CellServDB file to install area. + For the previous example you would add file: + DEST\Winistall\Config\CellServDB.GrandCentral + +G. Begin the build 1. Make sure you are running the default NT command shell, cmd.exe. Other shells may work, but many do not. @@ -166,8 +187,11 @@ F. Begin the build 3. Copy the file src/NTMakefile to the parent of the src directory. You only need to do this once. - 4. Begin the build. You can choose to build just the product bits, - or, if InstallShield is installed, the product bits and the + 4. If you have not created a separate object build directory, edit NTMakefile and + OBJ=obj to OBJ=src. + + 5. Begin the build. You can choose to build just the product bits, + or, if Installshield is installed, the product bits and the install package. To build just the product bits, run: diff --git a/src/README-WIN9X b/src/README-WIN9X index a19ba59f9..dae84fb67 100644 --- a/src/README-WIN9X +++ b/src/README-WIN9X @@ -124,6 +124,34 @@ or nmake -f ntmake9x clean VC6RedistSetup_enu.exe This is located at: http://support.microsoft.com/support/kb/articles/Q259/4/03.ASP + Two Microsoft DLL's must be included at DEST\WinInstall\Config\. + SHLWAPI.DLL + WININET.DLL + These DLL's will not be left on the target machine, there are only + used for installation and removed after installation is complete. + +6) Required changes to configuration file .\src\config\NTMakefile.i386_win95 + +AFSPRODUCT_VERSION - Product version +CELLNAME_DEFAULT - The default AFS cell name +CELLSERVDB_INSTALL - The default name for the CellServDB included in the install script +CELLSERVDB_WEB - The default web address to obtain CellServDB + +For Example: + + .\src\config\NTMakefile.i386_win95 + AFSPRODUCT_VERSION=1.1.1a + CELLNAME_DEFAULT=openafs.org + CELLSERVDB_INSTALL=CellServDB.GrandCentral + CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB + +Version level may be specified in different formats, for example the following +forms all have the same version level; however will be displayed differently: + +AFSPRODUCT_VERSION=1.1.1a +AFSPRODUCT_VERSION=1.1.1 a +AFSPRODUCT_VERSION=1.1.1.1 +AFSPRODUCT_VERSION=1.1.101 6) Installation @@ -163,3 +191,5 @@ or nmake -f ntmake9x clean 5. Reboot the target machine. 6. You can now start the client by executing the program WinAfsLoad.exe from the install directory. + + diff --git a/src/WINNT/afs_setup_utils/NTMakefile b/src/WINNT/afs_setup_utils/NTMakefile index dc4d0a263..0115b0b43 100644 --- a/src/WINNT/afs_setup_utils/NTMakefile +++ b/src/WINNT/afs_setup_utils/NTMakefile @@ -86,14 +86,26 @@ $(AFSRM_EXEFILE): $(AFSRM_EXEOBJS) $(AFSRM_EXELIBS) ############################################################################ +DIRLANG= ZH_TW ZH_CN PT_BR KO_KR JA_JP ES_ES EN_US DE_DE + install : $(INSTALL_UTILS_DLLFILE) $(SERVER_UNINST_DLLFILE) $(CLIENT_UNINST_DLLFILE) \ $(CC_UNINST_DLLFILE) $(LIGHT_CLIENT_UNINST_DLLFILE) $(DOCS_UNINST_DLLFILE) \ - $(AFSRM_EXEFILE) lang -lang :: +media : install + $(AFSRM_EXEFILE) $(DIRLANG) + cd _isuser + nmake -fntmakefile install + $(CD) .. + cd getwebdll + nmake -fntmakefile install + $(CD) .. + echo + +$(DIRLANG) :: $(CD) lang - for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install $(CD) .. + echo done lang ############################################################################ # How to build the shared source file for each uninstall dll @@ -156,7 +168,20 @@ $(DOCS_UNINST_DLLFILE) : d_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS) ############################################################################ clean:: - + $(CD) _isuser + nmake -fntmakefile clean + $(CD) .. + $(CD) getwebdll + nmake -fntmakefile clean + $(CD) .. + echo done clean + cd _isuser + nmake -fntmakefile clean + $(CD) .. + cd getwebdll + nmake -fntmakefile clean + $(CD) .. + echo ############################################################################ # diff --git a/src/WINNT/afs_setup_utils/afs_setup_utils.cpp b/src/WINNT/afs_setup_utils/afs_setup_utils.cpp index 363adc7b4..7a0aa8ef3 100644 --- a/src/WINNT/afs_setup_utils/afs_setup_utils.cpp +++ b/src/WINNT/afs_setup_utils/afs_setup_utils.cpp @@ -8,2089 +8,2091 @@ */ /* - * INCLUDES _________________________________________________________________ - * - */ - -extern "C" { -#include -#include -#include -} - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "resource.h" -#include "progress_dlg.h" -#include "sutil.h" -#include "forceremove.h" - - -/* - * PROTOTYPES _________________________________________________________________ - * - */ -static char *GetAppInstallDir(struct APPINFO *pApp, BOOL bRemembered); -BOOL UninstallCredsTool(); -BOOL ServerSpecificUninstall(); -BOOL ClientSpecificUninstall(); - - - -/* - * DEFINITIONS _________________________________________________________________ - * - */ -#define SUCALLCONV WINAPI - -#define UNINSTALL_TEMP_INFO_KEY "HKEY_LOCAL_MACHINE\\Software\\AfsUninstallTempInfo" -#define INSTALL_DIR_VALUE_NAME "InstallDir" - -#define AFS_PRESERVED_CFG_INFO_KEY "HKEY_LOCAL_MACHINE\\Software\\AfsPreservedConfigInfo" - -#define MS_SHARED_FILES_KEY "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs" - -// Log file to use when running in silent mode -#define UNINSTALL_ERROR_LOG_NAME "\\AfsUninstallErrorLog.txt" -#define INSTALL_ERROR_LOG_NAME "\\AfsInstallErrorLog.txt" - -#define TARGETDIR "" -#define WINDIR "" -#define WINSYSDIR "" - -#define WIN9X_START_MENU_REG_KEY "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" -#define WIN9X_START_MENU_REG_VALUE "Programs" - -#define WINNT_START_MENU_REG_KEY "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" -#define WINNT_START_MENU_REG_VALUE "Common Programs" - -#define LOCALE_ID_LEN 4 - -struct REGVALUE { - char *pszKey; - char *pszValue; -}; - - -typedef BOOL (APP_UNINSTALL_FUNC)(); - - - -struct APPINFO { - char *pszAppName; - - // Service Info - char *pszSvcName; - char *pszSvcKey; - char *pszSvcDependOn; - char *pszSvcDisplayName; - - char *pszNetworkProviderOrder; - - // Message to use to tell the user that we have to stop the service - int nServiceShutdownMsgID; - - // Message to use for the progress dialog that is shown while - // waiting for the service to stop. - int nServiceShutdownProgressMsgID; - - // Location in registry of a key we can use to know that the app is installed - char *pszAppKey; - - // Location in registry of this app's install dir - struct REGVALUE regInstallDir; - - // Path Info - char *pszLocalRoot; // The root dir below the install dir - char *pszBinPath; // Path to remove from the system path - - // Generated files and directories to delete. These are both multistring lists. - char *pszDirsToDel; // All files in these dirs will be deleted - char *pszFilesToDel; // Use this if you want to delete files but leave the dir. Wildcards can be used. - - // Registry values to remove - struct REGVALUE *pRegValues; - struct REGVALUE *pWinNTRegValues; // Only remove these if running WinNT - struct REGVALUE *pWin9XRegValues; // Only remove these if running Win9X - - // Start menu entries to delete - char *pszStartMenuEntries; - - // Registry keys to save if a user wants to preserve config info during uninstall - char *pszRegKeysToPreserve; - int nPreserveConfigInfoMsgID; - - // Uninstall func - used for things specific to this app - APP_UNINSTALL_FUNC *pUninstallFunc; -}; - - -/* - * App info structure for the Server product - */ -struct APPINFO appServer = { - "AFS Server", - - AFSREG_SVR_SVC_NAME, - AFSREG_SVR_SVC_KEY, - 0, // No depend on - AFSREG_SVR_SVC_DISPLAYNAME_DATA, - - 0, // No network provider order - - IDS_MUST_STOP_SERVER, - IDS_WAITING_FOR_SERVER_TO_STOP, - - AFSREG_SVR_SW_VERSION_KEY, - - { AFSREG_SVR_SW_VERSION_KEY, AFSREG_SVR_SW_VERSION_DIR_VALUE }, - - "\\Server", - "\\usr\\afs\\bin", - - // Dirs to delete - TARGETDIR"\\Server\\usr\\afs\\bin\\backup\0" - TARGETDIR"\\Server\\usr\\afs\\bin\0" - TARGETDIR"\\Server\\usr\\afs\\db\0" - TARGETDIR"\\Server\\usr\\afs\\logs\0" - TARGETDIR"\\Server\\usr\\afs\\etc\0" - TARGETDIR"\\Server\\usr\\afs\\local\0" - TARGETDIR"\\Server\\usr\\afs\0" - TARGETDIR"\\Server\\usr\0", - - // Files to delete - TARGETDIR"\\Common\\*.gid\0" - TARGETDIR"\\Common\\*.fts\0", - - 0, // No reg values - 0, // No NT only reg values - 0, // No 9x only reg values - - "Server\0", - - // Config info to preserve - AFSREG_SVR_SVC_KEY"\0", - IDS_PRESERVE_SERVER_CONFIG_INFO, - - 0 // No special uninstall function -}; - -// Registry values to remove for the Client -struct REGVALUE clientRegValues[] = { - { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" }, - { 0, 0 } // This indicates there are no more entries -}; - -struct REGVALUE clientWinNTRegValues[] = { - { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\File Manager\\AddOns", "AFS Client FME" }, - { 0, 0 } -}; - -struct REGVALUE clientWin9XRegValues[] = { - { "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order", "TransarcAFSDaemon" }, - { 0, 0 } -}; - -/* - * App info structure for the Client product - */ -struct APPINFO appClient = { - "AFS Client", - - AFSREG_CLT_SVC_NAME, - AFSREG_CLT_SVC_KEY, - "5250435353004E657462696F730000", - AFSREG_CLT_SVC_DISPLAYNAME_DATA, - - AFSREG_CLT_SVC_NAME, - - IDS_MUST_STOP_CLIENT, - IDS_WAITING_FOR_CLIENT_TO_STOP, - - AFSREG_CLT_SW_VERSION_KEY, - - { AFSREG_CLT_SW_VERSION_KEY, AFSREG_CLT_SW_VERSION_DIR_VALUE }, - - "\\Client", - "\\Program", - - // No dirs to delete - 0, - - // Files to delete - TARGETDIR"\\Common\\*.gid\0" - TARGETDIR"\\Common\\*.fts\0" - WINDIR"\\..\\AFSCache\0" - WINDIR"\\afsd.log\0" - WINDIR"\\afsd.ini\0" - WINDIR"\\afsdsbmt.ini\0" - WINDIR"\\afsd_init.log\0", - - clientRegValues, - clientWinNTRegValues, - clientWin9XRegValues, - - // Start menu entries to remove - "Client\0", - - // Config info to preserve - AFSREG_CLT_SVC_KEY"\0", - IDS_PRESERVE_CLIENT_CONFIG_INFO, - - ClientSpecificUninstall -}; - - -/* - * App info structure for the Light Client product - */ -struct APPINFO appLightClient = { - "AFS Light", - - // No service info - 0, - 0, - 0, - 0, - - AFSREG_CLT_SVC_NAME, - - // No service shutdown messages - 0, - 0, - - "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Light Client", - - { AFSREG_CLT_SW_VERSION_KEY, AFSREG_CLT_SW_VERSION_DIR_VALUE }, - - "\\Client", - "\\Program", - - // No dirs to delete - 0, - - // Files to delete - TARGETDIR"\\Common\\*.gid\0" - TARGETDIR"\\Common\\*.fts\0", - - clientRegValues, - clientWinNTRegValues, - clientWin9XRegValues, - - // Start menu entries to remove - "Light\0", - - // Config info to preserve - AFSREG_CLT_SVC_KEY"\0", - IDS_PRESERVE_LIGHT_CLIENT_CONFIG_INFO, - - UninstallCredsTool -}; - - -/* - * App info structure for the Control Center product - */ -struct APPINFO appControlCenter = { - "AFS Control Center", - - // No service info - 0, - 0, - 0, - 0, - - // No network provider order - 0, - - // No service shutdown messages - 0, - 0, - - "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Control Center", - - { "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Control Center\\CurrentVersion", "PathName" }, - - "\\Control Center", - "", - - // No dirs to delete - 0, - - // Files to delete - TARGETDIR"\\Common\\*.gid\0" - TARGETDIR"\\Common\\*.fts\0", - - 0, // No reg values - 0, // No NT only reg values - 0, // No 9x only reg values - - // Start menu entries to remove - "Control Center\0", - - // Config info to preserve - AFSREG_CLT_SVC_KEY"\0", - IDS_PRESERVE_CC_CONFIG_INFO, - - 0 // No uninstall function -}; - - -/* - * App info structure for the Sys Admin Doc files - */ -struct APPINFO appDocs = { - "AFS Supplemental Documentation", - - // No service info - 0, - 0, - 0, - 0, - - // No network provider order - 0, - - // No service shutdown messages - 0, - 0, - - "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Supplemental Documentation", - - { "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Supplemental Documentation\\CurrentVersion", "PathName" }, - - "\\Documentation", - "", - - // No dirs to delete - 0, - - // Files to delete - TARGETDIR"\\Common\\*.gid\0" - TARGETDIR"\\Common\\*.fts\0", - - 0, // No reg values - 0, // No NT only reg values - 0, // No 9x only reg values - - // Start menu entries to remove - "Documentation\\AFS for Windows Backup Command Reference.lnk\0Documentation\\AFS Command Reference Manual.lnk\0Documentation\\AFS System Administrator's Guide.lnk\0", - - 0, // No config info to preserve - - 0 // No uninstall function -}; - - -// Shared and in-use files -struct FILEINFO { - char *pszName; - int nUsedBy; -}; - -#define SERVER 1 -#define CLIENT 2 -#define LCLIENT 4 -#define CC 8 -#define DOCS 16 - - -struct FILEINFO fileInfo[] = { - { TARGETDIR"\\Common\\afsbosadmin.dll", SERVER | CC }, - { TARGETDIR"\\Common\\afscfgadmin.dll", SERVER | CC }, - { TARGETDIR"\\Common\\afsclientadmin.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afskasadmin.dll", SERVER | CC }, - { TARGETDIR"\\Common\\afsptsadmin.dll", SERVER | CC }, - { TARGETDIR"\\Common\\afsvosadmin.dll", SERVER | CC }, - { TARGETDIR"\\Common\\afsadminutil.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afsrpc.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afsauthent.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\pthread.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\TaAfsAppLib.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afsprocmgmt.dll", SERVER | CLIENT | LCLIENT }, - { TARGETDIR"\\Common\\afs_config.exe", CLIENT | LCLIENT| CC }, - { TARGETDIR"\\Common\\afseventmsg_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afslegal_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afsserver_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afssvrcfg_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\TaAfsAccountManager_????.dll",SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\TaAfsAppLib_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\TaAfsServerManager_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afscreds_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs_config_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs_cpa_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs_shl_ext_????.dll", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-nt.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-nt.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafssvrmgr.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafssvrmgr.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafsusrmgr.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafsusrmgr.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-cc.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-cc.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-light.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\afs-light.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafscfg.cnt", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Common\\taafscfg.hlp", SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Client\\PROGRAM\\afs_shl_ext.dll", CLIENT | LCLIENT }, - { TARGETDIR"\\Client\\PROGRAM\\libafsconf.dll", CLIENT | LCLIENT }, - { TARGETDIR"\\Client\\PROGRAM\\afslogon.dll", CLIENT }, - { TARGETDIR"\\Client\\PROGRAM\\afslog95.dll", LCLIENT }, - { TARGETDIR"\\Control Center\\TaAfsAdmSvr.exe", CC }, - { WINSYSDIR"\\afs_cpa.cpl", CLIENT | LCLIENT | CC }, - { WINSYSDIR"\\afsserver.cpl", SERVER }, - { TARGETDIR"\\Common\\afsdcell.ini", CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Documentation\\Html\\banner.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\books.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\bot.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\index.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\index.htm", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\next.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\prev.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\toc.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\top.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, - { TARGETDIR"\\Documentation\\Html\\ReleaseNotes\\relnotes.htm", - SERVER | CLIENT | LCLIENT | CC }, - { TARGETDIR"\\Documentation\\Html\\InstallGd\\afsnt35i.htm", - SERVER | CLIENT | LCLIENT | CC }, - { 0, 0 } // End of list -}; - - -/* - * VARIABLES _________________________________________________________________ - * - */ -HINSTANCE hinst; - -static HWND hDlg; -static BOOL bPreserveConfigInfo; -static BOOL bSilentMode; -static char *pszInstallDir; - - -/* - * FUNCTIONS _________________________________________________________________ - * - */ - -static BOOL UpgradeClientIntParm(HKEY hKey, char *pszOldParm, char *pszNewParm) -{ - int nData; - LONG result = ERROR_SUCCESS; - - nData = GetPrivateProfileInt("AFS Client", pszOldParm, -1, "afsd.ini"); - if (nData > -1) - result = RegSetValueEx(hKey, pszNewParm, 0, REG_DWORD, (BYTE *)&nData, sizeof(nData)); - - return (result == ERROR_SUCCESS); -} - -static BOOL UpgradeClientStringParm(HKEY hKey, char *pszOldParm, char *pszNewParm) -{ - char szData[1024]; - LONG result = ERROR_SUCCESS; - - GetPrivateProfileString("AFS Client", pszOldParm, "", szData, sizeof(szData), "afsd.ini"); - if (szData[0]) - result = RegSetValueEx(hKey, pszNewParm, 0, REG_SZ, (PBYTE)szData, strlen(szData) + 1); - - return (result == ERROR_SUCCESS); -} - -int SUCALLCONV Upgrade34ClientConfigInfo() -{ - HKEY hKey; - LONG result; - int nData; - - result = RegOpenKeyAlt(AFSREG_NULL_KEY, AFSREG_CLT_SVC_PARAM_KEY, KEY_WRITE, TRUE, &hKey, 0); - if (result != ERROR_SUCCESS) - return -1; - - UpgradeClientIntParm(hKey, "CacheSize", "CacheSize"); - UpgradeClientIntParm(hKey, "Stats", "Stats"); - UpgradeClientIntParm(hKey, "LogoffTokenTransfer", "LogoffTokenTransfer"); - UpgradeClientIntParm(hKey, "LogoffTokenTransferTimeout", "LogoffTokenTransferTimeout"); - UpgradeClientIntParm(hKey, "TrapOnPanic", "TrapOnPanic"); - UpgradeClientIntParm(hKey, "TraceBufferSize", "TraceBufferSize"); - UpgradeClientIntParm(hKey, "TraceOnShutdown", "TraceOnShutdown"); - UpgradeClientIntParm(hKey, "ReportSessionStartups", "ReportSessionStartups"); - - UpgradeClientStringParm(hKey, "MountRoot", "MountRoot"); - UpgradeClientStringParm(hKey, "Cell", "Cell"); - - /* BlockSize to ChunkSize requires convertion */ - nData = GetPrivateProfileInt("AFS Client", "BlockSize", -1, "afsd.ini"); - if (nData > -1) { - DWORD chunkSize; - for (chunkSize = 0; (1 << chunkSize) < nData; chunkSize++); - (void) RegSetValueEx(hKey, "ChunkSize", 0, REG_DWORD, (BYTE *)&chunkSize, sizeof(chunkSize)); - } - - RegCloseKey(hKey); - - return 0; -} - -int SUCALLCONV Eradicate34Client() -{ - if (Client34Eradicate(TRUE) != ERROR_SUCCESS) - return -1; - - return 0; -} - -// This function was written a long time ago by Mike Comer for use by the -// original DFS Client for NT install program. -int SUCALLCONV CheckIfAdmin(void) -{ - HANDLE token = INVALID_HANDLE_VALUE; - PVOID buffer = 0; - DWORD bufLength; - DWORD realBufLength; - TOKEN_PRIMARY_GROUP *pgroup; - TOKEN_GROUPS *groups; - int result = -1; - DWORD groupCount; - LONG status; - PSID AdministratorSID = NULL; - SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY; - - // allocate the SID for the Administrators group - if (!AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorSID)) { - status = GetLastError(); - goto getout; - } - - // open the process token - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token)) { - status = GetLastError(); - token = INVALID_HANDLE_VALUE; - goto getout; - } - - // check primary group first - buffer = GlobalAlloc(GMEM_FIXED, sizeof(TOKEN_PRIMARY_GROUP)); - if (!buffer) { - goto getout; - } - - bufLength = sizeof(TOKEN_PRIMARY_GROUP); - while(1) { - if (!GetTokenInformation(token, TokenPrimaryGroup, buffer, bufLength, &realBufLength)) { - if (realBufLength > bufLength) { - // not enough space - GlobalFree(buffer); - bufLength = realBufLength; - buffer = GlobalAlloc(GMEM_FIXED, realBufLength); - if (!buffer) { - goto getout; - } - continue; - } - - goto getout; - } - break; - } - - pgroup = (TOKEN_PRIMARY_GROUP *)buffer; - if (EqualSid(pgroup->PrimaryGroup, AdministratorSID)) { - result = 0; - } else { - // okay, try the secondary groups - while(1) { - if (!GetTokenInformation(token, TokenGroups, buffer, bufLength, &realBufLength)) { - if (realBufLength > bufLength) { - // not enough space - GlobalFree(buffer); - bufLength = realBufLength; - buffer = GlobalAlloc(GMEM_FIXED, realBufLength); - if (!buffer) { - goto getout; - } - continue; - } - - // a real error - goto getout; - } - break; - } - - // we have the list of groups here. Process them: - groups = (TOKEN_GROUPS *)buffer; - for(groupCount = 0; groupCount < groups->GroupCount; groupCount++) { - if (EqualSid(groups->Groups[groupCount].Sid, AdministratorSID)) { - result = 0; - break; - } - } - } - -getout: - - if (token != INVALID_HANDLE_VALUE) { - CloseHandle(token); - } - - if (buffer) { - GlobalFree(buffer); - } - - if (AdministratorSID) { - FreeSid(AdministratorSID); - } - - return result; -} - -static void SetSharedFileRefCount(char *pszFile, int nRefCount) -{ - LONG result; - HKEY hKey; - - result = RegOpenKeyAlt(AFSREG_NULL_KEY, MS_SHARED_FILES_KEY, KEY_WRITE, FALSE, &hKey, 0); - if (result != ERROR_SUCCESS) - return; - - if (nRefCount <= 0) - RegDeleteValue(hKey, pszFile); - else - RegSetValueEx(hKey, pszFile, 0, REG_DWORD, (BYTE *)&nRefCount, sizeof(int)); - - RegCloseKey(hKey); -} - -static char *GetTimeStamp() -{ - char szTime[64], szDate[64]; - static char szTimeDate[128]; - - _strtime(szTime); - _strdate(szDate); - - sprintf(szTimeDate, "[%s %s] ", szTime, szDate); - - return szTimeDate; -} - -int SUCALLCONV WriteToInstallErrorLog(char *pszMsg) -{ - static BOOL bWritten = FALSE; - FILE *fp; - - // On the first write, recreate the file - fp = fopen(INSTALL_ERROR_LOG_NAME, bWritten ? "a" : "w"); - if (!fp) - return -1; - - fprintf(fp, "%s%s\r\n", GetTimeStamp(), pszMsg); - - fclose(fp); - - bWritten = TRUE; - - return 0; -} - -static void WriteToUninstallErrorLog(char *pszMsg) -{ - static BOOL bWritten = FALSE; - FILE *fp; - - // On the first write, recreate the file - fp = fopen(UNINSTALL_ERROR_LOG_NAME, bWritten ? "a" : "w"); - if (!fp) - return; - - fprintf(fp, "%s%s\r\n", GetTimeStamp(), pszMsg); - - fclose(fp); - - bWritten = TRUE; -} - -static char *LoadResString(UINT uID) -{ - static char str[256]; - GetString (str, uID); - return str; -} - -static void ShowError(UINT nResID, LONG nError) -{ - char szErr[256]; - char szPrompt[256]; - char szMsg[256]; - char szTitle[256]; - char *psz; - - psz = LoadResString(nResID); - if (psz) - strcpy(szErr, psz); - else - sprintf(szErr, "unknown error msg (Msg ID = %d)", nResID); - - psz = LoadResString(IDS_INSTALLATION_FAILURE); - strcpy(szPrompt, psz ? psz : "An error has occurred: %s (Last Error = %ld)."); - - sprintf(szMsg, szPrompt, szErr, nError); - - psz = LoadResString(IDS_TITLE); - strcpy(szTitle, psz ? psz : "AFS"); - - if (bSilentMode) - WriteToUninstallErrorLog(szMsg); - else - MessageBox(hDlg, szMsg, szTitle, MB_OK); -} - -static int ShowMsg(UINT nResID, int nType) -{ - char szTitle[256]; - char *psz; - - psz = LoadResString(IDS_TITLE); - strcpy(szTitle, psz ? psz : "AFS"); - - return MessageBox(hDlg, LoadResString(nResID), szTitle, nType); -} - -static char *GetAppInstallDir(struct APPINFO *pApp, BOOL bRemembered) -{ - HKEY hKey; - LONG nResult; - DWORD dwType; - static char szInstallDir[256]; - DWORD dwSize; - char *pszKey; - char *pszValue; - - pszKey = bRemembered ? UNINSTALL_TEMP_INFO_KEY : pApp->regInstallDir.pszKey; - pszValue = bRemembered ? INSTALL_DIR_VALUE_NAME : pApp->regInstallDir.pszValue; - - dwSize = sizeof(szInstallDir); - - nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); - if (nResult == ERROR_SUCCESS) { - nResult = RegQueryValueEx(hKey, pszValue, 0, &dwType, (PBYTE)szInstallDir, &dwSize); - RegCloseKey(hKey); - } - - if (nResult != ERROR_SUCCESS) { - ShowError(IDS_CANT_DETERMINE_APP_PATH, nResult); - return 0; - } - - FilepathNormalizeEx(szInstallDir, FPN_BACK_SLASHES); - - return szInstallDir; -} - -static BOOL DoesRegKeyExist(char *pszKey) -{ - HKEY hKey; - LONG nResult; - - nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); - if (nResult == ERROR_SUCCESS) { - RegCloseKey(hKey); - return TRUE; - } - - return FALSE; -} - -static BOOL IsAppInstalled(struct APPINFO *pApp) -{ - return DoesRegKeyExist(pApp->pszAppKey); -} - -static void BuildShortPath(char *pszShortPath, UINT nShortPathLen, char *pszInstallDir, char *pszPath) -{ - strncpy(pszShortPath, pszInstallDir, nShortPathLen); - strncat(pszShortPath, pszPath, nShortPathLen); - - GetShortPathName(pszShortPath, pszShortPath, nShortPathLen); -} - -static BOOL IsWin95() -{ - OSVERSIONINFO versionInformation; - - versionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - GetVersionEx(&versionInformation); - - if ((versionInformation.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && - (versionInformation.dwMinorVersion == 0)) - return TRUE; - - return FALSE; -} - -int IsWin98() -{ - OSVERSIONINFO versionInformation; - - versionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - GetVersionEx(&versionInformation); - - if ((versionInformation.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && - (versionInformation.dwMinorVersion == 10)) - return 0; - - return -1; -} - -static BOOL IsServiceInstalled(char *pszServiceKey) -{ - HKEY hKey; - - if (RegOpenKeyAlt(0, pszServiceKey, KEY_READ, FALSE, &hKey, 0) == ERROR_SUCCESS) { - RegCloseKey(hKey); - return TRUE; - } - - return FALSE; -} - -// If this fails in anyway we just return. No error is displayed. -static void MakeSureServiceDoesNotExist(char *pszName) -{ - SC_HANDLE hServer = 0, hSCM = 0; - SERVICE_STATUS status; - - hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); - if (hSCM) { - hServer = OpenService(hSCM, pszName, SERVICE_ALL_ACCESS | DELETE); - if (hServer) { - if (QueryServiceStatus(hServer, &status)) { - if (status.dwCurrentState != SERVICE_STOPPED) { - if (!ControlService(hServer, SERVICE_CONTROL_STOP, &status)) { - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - return; - } - } - } - - // Try to delete even if status query fails - DeleteService(hServer); - } - } - - if (hServer) - CloseServiceHandle(hServer); - if (hSCM) - CloseServiceHandle(hSCM); -} - -static int InstallService(char *pszName, char *pszDependOn, char *pszDisplayName, char *pszServicePath, BOOL bInteractive) -{ - SC_HANDLE hServer = 0, hSCM; - BOOL bRestoreOldConfig = FALSE; - - hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); - if (!hSCM) { - ShowError(IDS_SCM_OPEN_FAILED, GetLastError()); - return -1; - } - -/* This code is not used, but it could be handy in the future so I am keeping it here. - - // If the service exists, then we (most probably) are in the middle of an upgrade or reinstall. - bRestoreOldConfig = IsServiceInstalled(pszName); - - if (bRestoreOldConfig) { - hServer = OpenService(hSCM, pszName, SERVICE_ALL_ACCESS); - if (!hServer || !ChangeServiceConfig(hServer, SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE, 0, 0, 0, 0, 0, 0, 0)) { - ShowError(IDS_RESTORE_OF_PREVIOUS_CONFIG_FAILED, GetLastError()); - bRestoreOldConfig = FALSE; - // Fall through to service creation below - } - } -*/ - - if (!bRestoreOldConfig) { - DWORD dwServiceType; - - // If the service already exists, the create call will fail. This can - // happen if uninstall failed (which is not infrequent). Making sure the - // service does not exist makes it easier for a user to install over top of - // a previously failed uninstall. - MakeSureServiceDoesNotExist(pszName); - - dwServiceType = SERVICE_WIN32_OWN_PROCESS; - if (bInteractive) - dwServiceType |= SERVICE_INTERACTIVE_PROCESS; - - hServer = CreateService(hSCM, pszName, pszDisplayName, - SERVICE_ALL_ACCESS, dwServiceType, SERVICE_AUTO_START, - SERVICE_ERROR_NORMAL, pszServicePath, 0, 0, "RPCSS\0Netbios\0\0", 0, 0); - - if (!hServer) - ShowError(IDS_SERVICE_CREATE_FAILED, GetLastError()); - } - - if (hServer) - CloseServiceHandle(hServer); - - CloseServiceHandle(hSCM); - - return 0; -} - -int SUCALLCONV InstallServerService(char *pszServicePath) -{ - return InstallService(appServer.pszSvcName, 0, appServer.pszSvcDisplayName, pszServicePath, TRUE); -} - -int SUCALLCONV InstallClientService(char *pszServicePath) -{ - return InstallService(appClient.pszSvcName, appClient.pszSvcDependOn, appClient.pszSvcDisplayName, pszServicePath, FALSE); -} - -static int UninstallService(struct APPINFO *pAppInfo) -{ - SC_HANDLE hServer, hSCM; - SERVICE_STATUS status; - BOOL bOk; - BOOL bServer = FALSE; - BOOL bShowingProgressDlg = FALSE; - - hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); - if (!hSCM) { - ShowError(IDS_SCM_OPEN_FAILED, GetLastError()); - return -1; - } - - hServer = OpenService(hSCM, pAppInfo->pszSvcName, SERVICE_ALL_ACCESS | DELETE); - if (!hServer) { - ShowError(IDS_SERVICE_OPEN_FAILED, GetLastError()); - CloseServiceHandle(hSCM); - return -1; - } - - if (!QueryServiceStatus(hServer, &status)) { - ShowError(IDS_SERVICE_QUERY_FAILED, GetLastError()); - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - return -1; - } - - if (status.dwCurrentState != SERVICE_STOPPED) { - if (pAppInfo->nServiceShutdownMsgID) { - if (!bSilentMode && (ShowMsg(pAppInfo->nServiceShutdownMsgID, MB_YESNO | MB_ICONQUESTION) == IDNO)) { - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - return 1; - } - } - - if (!bSilentMode) - bShowingProgressDlg = ShowProgressDialog(LoadResString(pAppInfo->nServiceShutdownProgressMsgID)); - - if (!ControlService(hServer, SERVICE_CONTROL_STOP, &status)) { - if (bShowingProgressDlg) - HideProgressDialog(); - ShowError(IDS_SERVICE_STOP_FAILED, GetLastError()); - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - return -1; - } - } - - // Wait for the service to stop - while (status.dwCurrentState != SERVICE_STOPPED) { - // I stopped waiting on dwWaitHint because it seemed the wait hint was too long. - // The service would be stopped but we'd still be asleep for a long time yet. - Sleep(5000); //status.dwWaitHint); - - if (!QueryServiceStatus(hServer, &status)) { - if (bShowingProgressDlg) - HideProgressDialog(); - ShowError(IDS_SERVICE_QUERY_FAILED, GetLastError()); - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - return -1; - } - } - - // The service has been stopped - if (bShowingProgressDlg) - HideProgressDialog(); - - // This code to disable the service may be of use some day so I am keeping it here. - // bOk = ChangeServiceConfig(hServer, SERVICE_NO_CHANGE, SERVICE_DISABLED, SERVICE_NO_CHANGE, 0, 0, 0, 0, 0, 0, 0); - - bOk = DeleteService(hServer); - - if (!bOk) - ShowError(IDS_SERVICE_DELETE_FAILED, GetLastError()); - - CloseServiceHandle(hServer); - CloseServiceHandle(hSCM); - - return (bOk ? 0 : -1); -} - -int SUCALLCONV AddToNetworkProviderOrder(char *pszWhatToAdd) -{ - return AddToProviderOrder(pszWhatToAdd) ? 0 : -1; -} - -static int RemoveFromNetworkProviderOrder(char *pszWhatToDel) -{ - return RemoveFromProviderOrder(pszWhatToDel) ? 0 : -1; -} - -int SUCALLCONV AddToPath(char *pszPath) -{ - return AddToSystemPath(pszPath) ? 0 : -1; -} - -static int RemoveFromPath(char *pszPath) -{ - return RemoveFromSystemPath(pszPath) ? 0 : -1; -} - -static void RemoveFiles(char *pszFileSpec) -{ - struct _finddata_t fileinfo; - long hSearch; - char szDel[MAX_PATH]; - char szDir[MAX_PATH]; - char *p; - - strcpy(szDir, pszFileSpec); - p = strrchr(szDir, '\\'); - if (p) - *p = 0; - - hSearch = _findfirst(pszFileSpec, &fileinfo); - if (hSearch == -1) - return; - - while (1) { - if ((strcmp(fileinfo.name, ".") != 0) && (strcmp(fileinfo.name, "..") != 0)) { - sprintf(szDel, "%s\\%s", szDir, fileinfo.name); - DeleteFile(szDel); - } - - if (_findnext(hSearch, &fileinfo) == -1) - break; - } - - _findclose(hSearch); -} - -static void RemoveDir(char *pszDir) -{ - char szFileSpec[MAX_PATH]; - - sprintf(szFileSpec, "%s\\*.*", pszDir); - - RemoveFiles(szFileSpec); - RemoveDirectory(pszDir); -} - -static void RemoveRegValues(struct REGVALUE *pRegValues) -{ - struct REGVALUE *pCurValue; - HKEY hKey; - LONG nResult; - - if (!pRegValues) - return; - - for (pCurValue = pRegValues; pCurValue->pszKey; pCurValue++) { - nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pCurValue->pszKey, KEY_ALL_ACCESS, FALSE, &hKey, 0); - - if (nResult == ERROR_SUCCESS) { - nResult = RegDeleteValue(hKey, pCurValue->pszValue); - RegCloseKey(hKey); - } - - if (nResult != ERROR_SUCCESS) - ShowError(IDS_REG_DELETE_VALUE_ERROR, nResult); - } -} - -static BOOL UninstallCredsTool() -{ - int nResult = WinExec("afscreds /uninstall", SW_HIDE); - - if (nResult <= 31) { - if (nResult != ERROR_FILE_NOT_FOUND) - ShowError(IDS_CANT_UNINSTALL_AFSCREDS, nResult); - } - - // Always return true. We don't want the uninstall to completely fail just - // because the creds tool didn't uninstall. - return TRUE; -} - - -static char *GetTempDir() -{ - DWORD result; - static char szTempDir[MAX_PATH]; - - result = GetTempPath(sizeof(szTempDir) - 1, szTempDir); - if (result == 0) - return "\\"; - - return szTempDir; -} - -static char *GetRootInstallDir() -{ - char *psz; - static char szRootInstallDir[MAX_PATH] = ""; - - if (szRootInstallDir[0] == 0) { - strcpy(szRootInstallDir, pszInstallDir); - - // Strip off the app specific part of the install dir - psz = strrchr(szRootInstallDir, '\\'); - if (psz) - *psz = 0; - } - - return szRootInstallDir; -} - -static BOOL ClientSpecificUninstall() -{ - int nChoice; - - // This function needs to do two things. First it needs to see if the server is - // installed, and if it is, ask the user if they really want to uninstall the - // client given that the server needs the client. Second, if we are uninstalling - // the client, we need to uninstall the creds tool. - - if (!bSilentMode) { - if (IsAppInstalled(&appServer)) { - nChoice = ShowMsg(IDS_CLIENT_NEEDED_BY_SERVER, MB_ICONQUESTION | MB_YESNO); - if (nChoice == IDNO) - return FALSE; // Cancel the uninstall - } - } - - UninstallCredsTool(); - - return TRUE; -} - -static struct APPINFO *GetApp() -{ -#ifdef SERVER_UNINST - return &appServer; -#elif CLIENT_UNINST - return &appClient; -#elif CC_UNINST - return &appControlCenter; -#elif LIGHT_CLIENT_UNINST - return &appLightClient; -#elif DOCS_UNINST - return &appDocs; -#else - return 0; -#endif; -} - -static void RememberInstallDir(char *pszInstallDir) -{ - HKEY hKey; - - // We remember the install dir so that when the UninstUninitialize function is called - // by the InstallShield uninstaller, we can find out where we were installed to. We - // have to do this because by the time that function is called, the registry values - // created at install time are already gone. We need to be able to find out where we - // were installed so we can clean up anything IS couldn't uninstall. If this fails in - // any way then we don't care. The only consequence is that some junk might be left on - // the users' system after an uninstall. - - LONG result = RegOpenKeyAlt(AFSREG_NULL_KEY, UNINSTALL_TEMP_INFO_KEY, KEY_WRITE, TRUE, &hKey, 0); - if (result != ERROR_SUCCESS) - return; - - RegSetValueEx(hKey, INSTALL_DIR_VALUE_NAME, 0, REG_SZ, (PBYTE)pszInstallDir, strlen(pszInstallDir) + 1); - - RegCloseKey(hKey); -} - -int SUCALLCONV SetSilentMode() -{ - bSilentMode = TRUE; - - return 0; -} - -static char *GetWinDir() -{ - static char szWinDir[MAX_PATH] = ""; - - if (!szWinDir[0]) - GetWindowsDirectory(szWinDir, sizeof(szWinDir)); - - return szWinDir; -} - -static char *GetWinSysDir() -{ - static char szWinSysDir[MAX_PATH] = ""; - - if (!szWinSysDir[0]) - GetSystemDirectory(szWinSysDir, sizeof(szWinSysDir)); - - return szWinSysDir; -} - -static char *GetLocaleID() -{ - static char szID[25] = ""; - - if (szID[0] == 0) { - LCID dwID = GetSystemDefaultLCID(); - - // Nuke the high word. It contains a sort ID. - dwID &= 0x0000FFFF; - - // Convert locale ID to a string - itoa(dwID, szID, 10); - - // This thing should never be more than LOCALE_ID_LEN characters long. - szID[LOCALE_ID_LEN] = 0; - } - - return szID; -} - -static char *ExpandPath(char *pszFile) -{ - static char szPath[MAX_PATH]; - char *psz; - - szPath[0] = 0; - - // Convert a path containing TARGETDIR, WINDIR, or WINSYSDIR to a - // real path in the file system. One of these MUST be the start of - // the file path passed in. Also convert the string ???? to an - // actual locale number. - if (strncmp(pszFile, TARGETDIR, strlen(TARGETDIR)) == 0) - strcpy(szPath, GetRootInstallDir()); - else if (strncmp(pszFile, WINDIR, strlen(WINDIR)) == 0) - strcpy(szPath, GetWinDir()); - else if (strncmp(pszFile, WINSYSDIR, strlen(WINSYSDIR)) == 0) - strcpy(szPath, GetWinSysDir()); - - if (szPath[0]) { - psz = strchr(pszFile, '\\'); - if (psz) - strcat(szPath, psz); - } else - strcpy(szPath, pszFile); - - // Is this a language dll? - psz = strstr(szPath, "????."); - - // If it is, replace ???? with the locale number - if (psz) - strncpy(psz, GetLocaleID(), LOCALE_ID_LEN); - - return szPath; -} - -static BOOL FileNeededByOtherApp(struct APPINFO *pApp, struct FILEINFO *pFileInfo) -{ - // If the file is used by the server, the app being uninstalled is not the server, and - // the server is installed, then this file is used by another app. - if (!IsWinNT()) { - if ((pFileInfo->nUsedBy & LCLIENT) && (pApp != &appLightClient) && IsAppInstalled(&appLightClient)) - return TRUE; - return FALSE; - } - - if ((pFileInfo->nUsedBy & SERVER) && (pApp != &appServer) && IsAppInstalled(&appServer)) - return TRUE; - - if ((pFileInfo->nUsedBy & CLIENT) && (pApp != &appClient) && IsAppInstalled(&appClient)) - return TRUE; - - if ((pFileInfo->nUsedBy & CC) && (pApp != &appControlCenter) && IsAppInstalled(&appControlCenter)) - return TRUE; - - return FALSE; -} - -static void DeleteInUseFiles(struct APPINFO *pAppInfo, struct FILEINFO *pFileInfo) -{ - char szSrcPath[MAX_PATH]; - char szDestPath[MAX_PATH]; - char szTempDir[MAX_PATH]; - int ii; - - // If some app's file has been loaded before the app is uninstalled, then - // when an uninstall is attempted, the application and all of the dlls that - // its uses will be in use and IS will not be able to delete them. Normally this - // is not a problem because IS will tell the user to reboot to finish the uninstall. - // However, we must support the ability to perform a silent uninstall followed - // immediatly by an install of the same product to the same directories. If we let - // IS handle the uninstall of these files, this is not possible. The reason is that - // when IS fails to remove these in use files, it marks them for deletion after the - // next reboot, which is fine. Unfortunately, it leaves them in the dirs they were - // installed to. So if we don't immediately reboot and perform an install to the - // same dirs, once a reboot is performed, those files get deleted and we have a - // broken installation. - - // What we will do to fix all of this, is when the client is uninstalled, but - // before IS does anything, we will move the in use files and associated dlls - // into the temp dir and mark them for delete after a reboot. Then an install - // that follows will succeed. - - // Delete the files that may be in use. If they are we actually move - // them to the temp dir and mark them for deletion after the next reboot. - for (ii = 0; pFileInfo[ii].pszName != 0; ii++) { - // Get the source path - strcpy(szSrcPath, ExpandPath(pFileInfo[ii].pszName)); - - // Only delete the file if it is not used by some other app - if (FileNeededByOtherApp(pAppInfo, &pFileInfo[ii])) - continue; - - // If the file doesn't exist then go on to the next file. - if (_access(szSrcPath, 0) != 0) - continue; - - // See if we can do a regular delete of the file - if (DeleteFile(szSrcPath)) { - SetSharedFileRefCount(szSrcPath, 0); - continue; - } - - // Get a temp dir that is on the same drive as the src path. - // We can't move an in use file to a different drive. - strcpy(szTempDir, GetTempDir()); - if (szTempDir[0] != szSrcPath[0]) { - // Get the drive, colon, and slash of the src path - strncpy(szTempDir, szSrcPath, 3); - szTempDir[3] = 0; - } - - // Get the dest path - we will rename the file during the move - GetTempFileName(szTempDir, "AFS", 0, szDestPath); - - // Move from source to dest, marking the file for deletion after a reboot - if (IsWin95()) { - if (MoveFile(szSrcPath, szDestPath)) { - WritePrivateProfileString("rename", szSrcPath, szDestPath, "wininit.ini"); - SetSharedFileRefCount(szSrcPath, 0); - } - } else { // WinNT or Win98 - if (MoveFileEx(szSrcPath, szDestPath, MOVEFILE_REPLACE_EXISTING)) { - SetFileAttributes(szDestPath, FILE_ATTRIBUTE_NORMAL); - MoveFileEx(szDestPath, 0, MOVEFILE_DELAY_UNTIL_REBOOT); - SetSharedFileRefCount(szSrcPath, 0); - } - } - } -} - -// Delete a directory and all its files and subdirectories - Yee haaa! -static void RemoveDirectoryTree(char *pszDir) -{ - HANDLE hFind; - WIN32_FIND_DATA findFileData; - char szSpec[MAX_PATH]; - char szSubFileOrDir[MAX_PATH]; - BOOL bContinue; - - sprintf(szSpec, "%s\\*.*", pszDir); - - // First delete the contents of the dir - hFind = FindFirstFile(szSpec, &findFileData); - bContinue = (hFind != INVALID_HANDLE_VALUE); - - while (bContinue) { - if ((strcmp(findFileData.cFileName, ".") != 0) && (strcmp(findFileData.cFileName, "..") != 0)) { - sprintf(szSubFileOrDir, "%s\\%s", pszDir, findFileData.cFileName); - - if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - RemoveDirectoryTree(szSubFileOrDir); - else - DeleteFile(szSubFileOrDir); - } - - bContinue = FindNextFile(hFind, &findFileData); - } - - FindClose(hFind); - - // Now remove the dir - RemoveDirectory(pszDir); -} - -static char *GetStartMenuRoot() -{ - HKEY hKey; - LONG nResult; - DWORD dwType; - DWORD dwSize; - char *pszKey; - char *pszValue; - - static char szStartMenuRoot[MAX_PATH] = ""; - - if (szStartMenuRoot[0] == 0) { - dwSize = sizeof(szStartMenuRoot); - - if (IsWinNT()) { - pszKey = WINNT_START_MENU_REG_KEY; - pszValue = WINNT_START_MENU_REG_VALUE; - } else { - pszKey = WIN9X_START_MENU_REG_KEY; - pszValue = WIN9X_START_MENU_REG_VALUE; - } - - nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); - if (nResult == ERROR_SUCCESS) { - nResult = RegQueryValueEx(hKey, pszValue, 0, &dwType, (PBYTE)szStartMenuRoot, &dwSize); - RegCloseKey(hKey); - } - - if (nResult != ERROR_SUCCESS) - return 0; - } - - FilepathNormalizeEx(szStartMenuRoot, FPN_BACK_SLASHES); - - return szStartMenuRoot; -} - -static char *GetAfsStartMenuRoot() -{ - static char szAfsStartMenuRoot[MAX_PATH] = ""; - char *pszStartMenuRoot; - - if (szAfsStartMenuRoot[0] == 0) { - pszStartMenuRoot = GetStartMenuRoot(); - if (!pszStartMenuRoot) - return 0; - - if (bSilentMode) - sprintf(szAfsStartMenuRoot, "%s\\IBM WebSphere\\Performance Pack\\AFS", pszStartMenuRoot ); - else - sprintf(szAfsStartMenuRoot, "%s\\IBM AFS", pszStartMenuRoot ); - } - - return szAfsStartMenuRoot; -} - -static BOOL IsADir(char *pszName) -{ - struct _stat statbuf; - - if (_stat(pszName, &statbuf) < 0) - return FALSE; - - return statbuf.st_mode & _S_IFDIR; -} - -static void DeleteStartMenuEntries(char *pszEntries) -{ - char szStartMenuPath[MAX_PATH]; - char *pszAfsStartMenuRoot; - char *pszCurEntry; - - pszAfsStartMenuRoot = GetAfsStartMenuRoot(); - - if (!pszAfsStartMenuRoot) - return; - - for (pszCurEntry = pszEntries; *pszCurEntry; pszCurEntry += strlen(pszCurEntry) + 1) { - sprintf(szStartMenuPath, "%s\\%s", pszAfsStartMenuRoot, pszCurEntry); - if (IsADir(szStartMenuPath)) - RemoveDirectoryTree(szStartMenuPath); - else - DeleteFile(szStartMenuPath); - } -} - -static void RefreshStartMenu() -{ - char *pszAfsStartMenuRoot; - char szTemp[MAX_PATH]; - - pszAfsStartMenuRoot = GetAfsStartMenuRoot(); - if (!pszAfsStartMenuRoot) - return; - - sprintf(szTemp, "%s - Refresh Attempt", pszAfsStartMenuRoot); - - // Deleting items from below the root level of the start menu does not - // cause it to refresh. In order that users can see changes without - // rebooting we will temporarily rename our root most entry, which - // does cause a refresh of the start menu. - MoveFileEx(pszAfsStartMenuRoot, szTemp, MOVEFILE_REPLACE_EXISTING); - MoveFileEx(szTemp, pszAfsStartMenuRoot, MOVEFILE_REPLACE_EXISTING); -} - -static BOOL PreserveConfigInfo(struct APPINFO *pApp) -{ - char *pszRegKey; - char szDestKey[256]; - LONG result; - - bPreserveConfigInfo = TRUE; - - // If not in silent mode, ask user if they want to preserve the cfg info - if (!bSilentMode) { - int nChoice = ShowMsg(pApp->nPreserveConfigInfoMsgID, MB_ICONQUESTION | MB_YESNOCANCEL); - if (nChoice == IDCANCEL) - return FALSE; // Cancel the uninstall - else if (nChoice == IDNO) { - bPreserveConfigInfo = FALSE; // User doesn't want to preserve the config info - return TRUE; - } - } - - // Copy each reg key (and all of its subkeys and values) to another place in the registry. - for (pszRegKey = pApp->pszRegKeysToPreserve; *pszRegKey; pszRegKey += strlen(pszRegKey) + 1) { - if (!DoesRegKeyExist(pszRegKey)) - continue; - - // Create the destination path for the copy - sprintf(szDestKey, "%s\\%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName, pszRegKey); - - // Try to copy it - result = RegDupKeyAlt(pszRegKey, szDestKey); - - if ((result != ERROR_SUCCESS) && (result != ERROR_FILE_NOT_FOUND)) { - // If the copy failed, then delete any copies that succeeded - sprintf(szDestKey, "%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); - RegDeleteEntryAlt(szDestKey, REGENTRY_KEY); - goto done; - } - } - - // Remember the integrated login setting if this app supports that and it was turned on - if (pApp->pszNetworkProviderOrder) { - // Was integerated login turned on? - BOOL bOn, bOk; - bOk = InNetworkProviderOrder(pApp->pszNetworkProviderOrder, &bOn); - if (bOk && bOn) { - HKEY hKey; - sprintf(szDestKey, "%s\\%s\\IntegratedLogin", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); - result = RegOpenKeyAlt(AFSREG_NULL_KEY, szDestKey, KEY_WRITE, TRUE, &hKey, 0); - // The existance of the key is a flag indicating that integrated login was turned on - RegCloseKey(hKey); - } - } - -done: - if ((result == ERROR_SUCCESS) || bSilentMode) - return TRUE; // Continue with uninstall - - // Report the error and ask the user if they want to continue the uninstall - return (ShowMsg(IDS_SAVE_OF_CONFIG_INFO_FAILED, MB_ICONEXCLAMATION | MB_YESNO) == IDYES); -} - -int SUCALLCONV RestoreConfigInfo(int nApp) -{ - char *pszRegKey; - char szSrcKey[256]; - struct APPINFO *pApp = 0; - BOOL bError = FALSE; - LONG result; - - switch (nApp) { - case SERVER: pApp = &appServer; break; - case CLIENT: pApp = &appClient; break; - case LCLIENT: pApp = &appLightClient; break; - case CC: pApp = &appControlCenter; break; - } - - if (!pApp) - return -1; - - // Copy each reg key (and all of its subkeys and values) back to its original place in the registry. - for (pszRegKey = pApp->pszRegKeysToPreserve; *pszRegKey; pszRegKey += strlen(pszRegKey) + 1) { - // Create the source path for the copy - sprintf(szSrcKey, "%s\\%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName, pszRegKey); - - if (!DoesRegKeyExist(szSrcKey)) - continue; - - // Try to restore as many of the keys as possible. Report any errors at the end. - - // Try to copy it - result = RegDupKeyAlt(szSrcKey, pszRegKey); - if ((result != ERROR_SUCCESS) && (result != ERROR_FILE_NOT_FOUND)) - bError = TRUE; - } - - // Restore integrated login if this app was using it - if (pApp->pszNetworkProviderOrder) { - // Check if integrated login was turned on. The IntegratedLogin key is a flag - // telling us that it was on. If the key does not exist, integrated login was - // not on. - sprintf(szSrcKey, "%s\\%s\\IntegratedLogin", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); - if (DoesRegKeyExist(szSrcKey)) { - if (!AddToProviderOrder(pApp->pszNetworkProviderOrder)) - bError = TRUE; - } - } - - // Remove our saved copies of the config info - sprintf(szSrcKey, "%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); - RegDeleteEntryAlt(szSrcKey, REGENTRY_KEY); - - if (bError) - ShowError(IDS_RESTORE_OF_PREVIOUS_CONFIG_FAILED, 0); - - return TRUE; -} - -static BOOL DoSubKeysExist(char *pszKey) -{ - LONG result; - HKEY hKey; - char *pszSubKeys = 0; - BOOL bExist; - - result = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); - if (result != ERROR_SUCCESS) - return FALSE; - - result = RegEnumKeyAlt(hKey, &pszSubKeys); - RegCloseKey(hKey); - - if (result != ERROR_SUCCESS) - return FALSE; - - if (pszSubKeys) { - bExist = TRUE; - free(pszSubKeys); - } else - bExist = FALSE; - - return bExist; -} - -/* - * The following definitions are taken from richedit.h: - * - */ - -#define EM_SETBKGNDCOLOR (WM_USER + 67) // from Richedit.h -#define EM_STREAMIN (WM_USER + 73) // from Richedit.h -#define SF_RTF 0x0002 - -typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb); - -typedef struct _editstream { - DWORD dwCookie; /* user value passed to callback as first parameter */ - DWORD dwError; /* last error */ - EDITSTREAMCALLBACK pfnCallback; -} EDITSTREAM; - -/* - * - */ - -DWORD CALLBACK License_StreamText (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) -{ - LPTSTR psz = (LPTSTR)dwCookie; - LONG cchAvail = lstrlen(psz); - if ((*pcb = min(cchAvail, cb)) != 0) { - memcpy (pbBuff, psz, *pcb); - memmove (psz, &psz[*pcb], cchAvail - *pcb + 1); - } - return 0; -} - - -void License_OnInitDialog (HWND hDlg, LPTSTR pszFile) -{ - // Open the license file and shove its text in our RichEdit control - // - HANDLE hFile; - if ((hFile = CreateFile (pszFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) { - - size_t cbText; - if ((cbText = GetFileSize (hFile, NULL)) != 0) { - - LPTSTR abText = (LPTSTR)GlobalAlloc (GMEM_FIXED, cbText + 3); - - DWORD cbRead; - if (ReadFile (hFile, abText, cbText, &cbRead, NULL)) { - abText[ cbRead ] = 0; - - EDITSTREAM Stream; - memset (&Stream, 0x00, sizeof(Stream)); - Stream.dwCookie = (DWORD)abText; - Stream.pfnCallback = License_StreamText; - - SendDlgItemMessage (hDlg, IDC_TEXT, EM_STREAMIN, SF_RTF, (LPARAM)&Stream); - } - - GlobalFree (abText); - } - - CloseHandle (hFile); - } - - // Make the control's background be gray - // - SendDlgItemMessage (hDlg, IDC_TEXT, EM_SETBKGNDCOLOR, FALSE, (LPARAM)GetSysColor(COLOR_BTNFACE)); -} - -BOOL CALLBACK License_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) -{ - switch (msg) { - case WM_INITDIALOG: - SetWindowLong (hDlg, DWL_USER, lp); - License_OnInitDialog (hDlg, (LPTSTR)lp); - break; - - case WM_COMMAND: - switch (LOWORD(wp)) { - case IDCANCEL: - case IDOK: - EndDialog (hDlg, LOWORD(wp)); - break; - - case IDC_PRINT: - TCHAR szDir[ MAX_PATH ]; - GetCurrentDirectory (MAX_PATH, szDir); - ShellExecute (hDlg, TEXT("print"), (LPTSTR)GetWindowLong (hDlg, DWL_USER), NULL, szDir, SW_HIDE); - break; - } - break; - } - return FALSE; -} - -BOOL FindAfsInstallationPathByComponent (LPTSTR pszInstallationPath, LPTSTR pszComponent) -{ - *pszInstallationPath = 0; - - TCHAR szRegPath[ MAX_PATH ]; - wsprintf (szRegPath, TEXT("Software\\TransarcCorporation\\%s\\CurrentVersion"), pszComponent); - - HKEY hk; - if (RegOpenKey (HKEY_LOCAL_MACHINE, szRegPath, &hk) == 0) { - DWORD dwType = REG_SZ; - DWORD dwSize = MAX_PATH; - - if (RegQueryValueEx (hk, TEXT("PathName"), NULL, &dwType, (PBYTE)pszInstallationPath, &dwSize) == 0) { - *(LPTSTR)FindBaseFileName (pszInstallationPath) = TEXT('\0'); - - if (pszInstallationPath[0] && (pszInstallationPath[ lstrlen(pszInstallationPath)-1 ] == TEXT('\\'))) - pszInstallationPath[ lstrlen(pszInstallationPath)-1 ] = TEXT('\0'); - } - - RegCloseKey (hk); - } - - return !!*pszInstallationPath; -} - -BOOL FindAfsInstallationPath (LPTSTR pszInstallationPath) -{ - if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Client"))) - return TRUE; - if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Control Center"))) - return TRUE; - if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Server"))) - return TRUE; - if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Supplemental Documentation"))) - return TRUE; - return FALSE; -} - -HINSTANCE LoadRichTextControl (void) -{ - HINSTANCE hInst; - if ((hInst = LoadLibrary ("riched20.dll")) != NULL) - return hInst; - if ((hInst = LoadLibrary ("riched32.dll")) != NULL) - return hInst; - if ((hInst = LoadLibrary ("riched.dll")) != NULL) - return hInst; - if ((hInst = LoadLibrary ("richedit.dll")) != NULL) - return hInst; - return NULL; -} - -int SUCALLCONV ShowLicense (char *pszTarget, char *pszSource) -{ - // If the license already lives on this user's machine, don't show - // it again. This only has to be done if the user has never - // accepted the license agreement before (it's part of the setup - // program, so it gets installed if they've accepted it). - // - // We were handed a relative path of the form: - // Documentation/html/license.rtf - // - // We'll need to find the AFS installation directory, in order to - // find that Documentation subtree. - // - BOOL fShowLicense = TRUE; - - TCHAR szInstallationPath[ MAX_PATH ]; - if (FindAfsInstallationPath (szInstallationPath)) { - TCHAR szLicensePath[ MAX_PATH ]; - wsprintf (szLicensePath, TEXT("%s\\%s"), szInstallationPath, pszTarget); - - if (GetFileAttributes (szLicensePath) != (DWORD)-1) { - fShowLicense = FALSE; - } - } - - // Before we can show the license file, we have to prepare the RichEdit - // control. That means loading the appropriate library and calling its - // initialization functions. - // - HINSTANCE hRichEdit; - if ((hRichEdit = LoadRichTextControl()) != NULL) { - - // If we must show the license, do so now. This is a modal dialog, - // so we'll know whether or not the user accepts the license. - // - if (ModalDialogParam (IDD_LICENSE, GetActiveWindow(), License_DlgProc, (LPARAM)pszSource) == IDCANCEL) { - // The user rejected the license; fail setup - return FALSE; - } - - FreeLibrary (hRichEdit); - } - - // The user accepted the license, so we can continue with Setup. - // The license file is installed as part of Setup. - return TRUE; -} - -int SUCALLCONV UninstInitialize(HWND hIS, HINSTANCE hIS5, long Reserved) -{ - char szPath[MAX_PATH]; - struct APPINFO *pAppInfo; - char *pszFile = 0; - char *pszSubDir = 0; - - hDlg = hIS; - - bSilentMode = !IsWindowVisible(hIS); - - // Which app are we uninstalling? - pAppInfo = GetApp(); - if (!pAppInfo) { - ShowError(IDS_CANT_DETERMINE_PRODUCT, 0); - return -1; - } - - // Get the app's install dir - pszInstallDir = GetAppInstallDir(pAppInfo, FALSE); - if (!pszInstallDir) - return -1; - - // If this app has a custom uninstall func, call it here - if (pAppInfo->pUninstallFunc) - if (!pAppInfo->pUninstallFunc()) - return -1; - - if (pAppInfo->pszRegKeysToPreserve) - if (!PreserveConfigInfo(pAppInfo)) - return -1; - - // Unconfigure the service, if there is one for this app - if (pAppInfo->pszSvcKey) { - if (IsServiceInstalled(pAppInfo->pszSvcKey)) - if (UninstallService(pAppInfo) == 1) - return -1; - } - - RememberInstallDir(pszInstallDir); - - DeleteInUseFiles(pAppInfo, fileInfo); - - // Remove the app's bin path from the system path - if (pAppInfo->pszBinPath) { - BuildShortPath(szPath, sizeof(szPath), pszInstallDir, pAppInfo->pszBinPath); - RemoveFromPath(szPath); - } - - // Remove entry from NetworkProvider\Order key in registry - if (pAppInfo->pszNetworkProviderOrder) - RemoveFromNetworkProviderOrder(pAppInfo->pszNetworkProviderOrder); - - // Remove any generated subdirectories - if (!bPreserveConfigInfo && pAppInfo->pszDirsToDel) { - for (pszSubDir = pAppInfo->pszDirsToDel; *pszSubDir; pszSubDir += strlen(pszSubDir) + 1) - RemoveDir(ExpandPath(pszSubDir)); - } - - // Remove any generated files - if (!bPreserveConfigInfo && pAppInfo->pszFilesToDel) { - for (pszFile = pAppInfo->pszFilesToDel; *pszFile; pszFile += strlen(pszFile) + 1) - RemoveFiles(ExpandPath(pszFile)); - } - - // Remove any registry values that IS can't handle - RemoveRegValues(pAppInfo->pRegValues); - if (IsWinNT()) - RemoveRegValues(pAppInfo->pWinNTRegValues); - else - RemoveRegValues(pAppInfo->pWin9XRegValues); - - // Remove the start menu entries for this app - if (pAppInfo->pszStartMenuEntries) { - DeleteStartMenuEntries(pAppInfo->pszStartMenuEntries); - RefreshStartMenu(); - } - - // Remove the install dir - RemoveDirectory(pszInstallDir); - - return 0; -} - -void SUCALLCONV UninstUnInitialize(HWND hIS, HINSTANCE hIS5, long Reserved) -{ - char *pszInstallDir; - char szDirPath[MAX_PATH]; - char *psz; - struct APPINFO *pAppInfo; - - // If we just uninstalled the last AFS app, then do some cleanup. - if (IsAppInstalled(&appServer) || IsAppInstalled(&appClient) || - IsAppInstalled(&appControlCenter) || IsAppInstalled(&appLightClient) || - IsAppInstalled(&appDocs)) - { - return; - } - - bSilentMode = !IsWindowVisible(hIS); - - // Which app did we just uninstall? - pAppInfo = GetApp(); - if (!pAppInfo) { - ShowError(IDS_CANT_DETERMINE_PRODUCT, 0); - return; - } - - // Get the app's install dir - pszInstallDir = GetAppInstallDir(pAppInfo, TRUE); - if (!pszInstallDir) - return; - - // Remove the reg key we used to remember the app install dir - RegDeleteEntryAlt(UNINSTALL_TEMP_INFO_KEY, REGENTRY_KEY); - - // Try to remove the reg key used to store config info, but only - // if there are no app config info sub keys present. - if (!DoSubKeysExist(AFS_PRESERVED_CFG_INFO_KEY)) - RegDeleteEntryAlt(AFS_PRESERVED_CFG_INFO_KEY, REGENTRY_KEY); - - // Remove the install dir - RemoveDirectory(pszInstallDir); - - // Attempt to remove the install root and common directories. The are - // shared and so no single app knows to delete them. - - // Strip off the app specific part of the install dir - psz = strrchr(pszInstallDir, '\\'); - if (psz) - *psz = 0; - - sprintf(szDirPath, "%s\\%s", pszInstallDir, "Common"); - RemoveDirectory(szDirPath); - - // Remove the Common directory from the system path - RemoveFromPath(szDirPath); - - // Remove all of the documentation dirs - sprintf(szDirPath, "%s\\%s", pszInstallDir, "Documentation"); - RemoveDirectoryTree(szDirPath); - - // Ok, up to this point we have been removing files we know we - // created. However, after this point we are into the path - // that the user chose for our install root. The default for - // this is IBM/Afs, but they could have chosen anything, - // including a dir or dirs that have other products in them. - // We will check to see if it is IBM\AFS and if it is then we - // will attempt to remove them. - - // Back up a level and look for AFS - psz = strrchr(pszInstallDir, '\\'); - if (psz) { - if (stricmp(psz + 1, "AFS") == 0) { - RemoveDirectory(pszInstallDir); - *psz = 0; - } - } - - // Back up a level and look for IBM - psz = strrchr(pszInstallDir, '\\'); - if (psz) { - if (stricmp(psz + 1, "IBM") == 0) { - RemoveDirectory(pszInstallDir); - *psz = 0; - } - } - - // Remove the root afs start menu entry - psz = GetStartMenuRoot(); - if (psz) { - if (bSilentMode) { - // Remove everything under our branch - sprintf(szDirPath, "%s\\IBM WebSphere\\Performance Pack\\AFS", psz); - RemoveDirectoryTree(szDirPath); - - // Remove the IBM stuff only if the dirs are empty - sprintf(szDirPath, "%s\\IBM WebSphere\\Performance Pack", psz); - if (RemoveDirectory(szDirPath)) { - sprintf(szDirPath, "%s\\IBM WebSphere", psz); - RemoveDirectory(szDirPath); - } - } else { - sprintf(szDirPath, "%s\\IBM AFS", psz); - RemoveDirectoryTree(szDirPath); - } - } -} - -BOOLEAN _stdcall DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) -{ - if (reason == DLL_PROCESS_ATTACH) { - hinst = (HINSTANCE)dll; - TaLocale_LoadCorrespondingModuleByName (hinst, "afs_setup_utils.dll"); - } - - return TRUE; -} - -extern "C" int WINAPI Test (HINSTANCE hInst, HINSTANCE hPrev, LPSTR psz, int nCmdShow) -{ - ShowLicense ("TEST", "\\\\fury\\afssetup\\license\\ja_JP.rtf"); - return 0; -} - - + * INCLUDES _________________________________________________________________ + * + */ + +extern "C" { +#include +#include +#include +} + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "resource.h" +#include "progress_dlg.h" +#include "sutil.h" +#include "forceremove.h" + + +/* + * PROTOTYPES _________________________________________________________________ + * + */ +static char *GetAppInstallDir(struct APPINFO *pApp, BOOL bRemembered); +BOOL UninstallCredsTool(); +BOOL ServerSpecificUninstall(); +BOOL ClientSpecificUninstall(); + + + +/* + * DEFINITIONS _________________________________________________________________ + * + */ +#define SUCALLCONV WINAPI + +#define UNINSTALL_TEMP_INFO_KEY "HKEY_LOCAL_MACHINE\\Software\\AfsUninstallTempInfo" +#define INSTALL_DIR_VALUE_NAME "InstallDir" + +#define AFS_PRESERVED_CFG_INFO_KEY "HKEY_LOCAL_MACHINE\\Software\\AfsPreservedConfigInfo" + +#define MS_SHARED_FILES_KEY "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs" + +// Log file to use when running in silent mode +#define UNINSTALL_ERROR_LOG_NAME "\\AfsUninstallErrorLog.txt" +#define INSTALL_ERROR_LOG_NAME "\\AfsInstallErrorLog.txt" + +#define TARGETDIR "" +#define WINDIR "" +#define WINSYSDIR "" + +#define WIN9X_START_MENU_REG_KEY "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" +#define WIN9X_START_MENU_REG_VALUE "Programs" + +#define WINNT_START_MENU_REG_KEY "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" +#define WINNT_START_MENU_REG_VALUE "Common Programs" + +#define LOCALE_ID_LEN 4 + +struct REGVALUE { + char *pszKey; + char *pszValue; +}; + + +typedef BOOL (APP_UNINSTALL_FUNC)(); + + + +struct APPINFO { + char *pszAppName; + + // Service Info + char *pszSvcName; + char *pszSvcKey; + char *pszSvcDependOn; + char *pszSvcDisplayName; + + char *pszNetworkProviderOrder; + + // Message to use to tell the user that we have to stop the service + int nServiceShutdownMsgID; + + // Message to use for the progress dialog that is shown while + // waiting for the service to stop. + int nServiceShutdownProgressMsgID; + + // Location in registry of a key we can use to know that the app is installed + char *pszAppKey; + + // Location in registry of this app's install dir + struct REGVALUE regInstallDir; + + // Path Info + char *pszLocalRoot; // The root dir below the install dir + char *pszBinPath; // Path to remove from the system path + + // Generated files and directories to delete. These are both multistring lists. + char *pszDirsToDel; // All files in these dirs will be deleted + char *pszFilesToDel; // Use this if you want to delete files but leave the dir. Wildcards can be used. + + // Registry values to remove + struct REGVALUE *pRegValues; + struct REGVALUE *pWinNTRegValues; // Only remove these if running WinNT + struct REGVALUE *pWin9XRegValues; // Only remove these if running Win9X + + // Start menu entries to delete + char *pszStartMenuEntries; + + // Registry keys to save if a user wants to preserve config info during uninstall + char *pszRegKeysToPreserve; + int nPreserveConfigInfoMsgID; + + // Uninstall func - used for things specific to this app + APP_UNINSTALL_FUNC *pUninstallFunc; +}; + + +/* + * App info structure for the Server product + */ +struct APPINFO appServer = { + "AFS Server", + + AFSREG_SVR_SVC_NAME, + AFSREG_SVR_SVC_KEY, + 0, // No depend on + AFSREG_SVR_SVC_DISPLAYNAME_DATA, + + 0, // No network provider order + + IDS_MUST_STOP_SERVER, + IDS_WAITING_FOR_SERVER_TO_STOP, + + AFSREG_SVR_SW_VERSION_KEY, + + { AFSREG_SVR_SW_VERSION_KEY, AFSREG_SVR_SW_VERSION_DIR_VALUE }, + + "\\Server", + "\\usr\\afs\\bin", + + // Dirs to delete + TARGETDIR"\\Server\\usr\\afs\\bin\\backup\0" + TARGETDIR"\\Server\\usr\\afs\\bin\0" + TARGETDIR"\\Server\\usr\\afs\\db\0" + TARGETDIR"\\Server\\usr\\afs\\logs\0" + TARGETDIR"\\Server\\usr\\afs\\etc\0" + TARGETDIR"\\Server\\usr\\afs\\local\0" + TARGETDIR"\\Server\\usr\\afs\0" + TARGETDIR"\\Server\\usr\0", + + // Files to delete + TARGETDIR"\\Common\\*.gid\0" + TARGETDIR"\\Common\\*.fts\0", + + 0, // No reg values + 0, // No NT only reg values + 0, // No 9x only reg values + + "Server\0", + + // Config info to preserve + AFSREG_SVR_SVC_KEY"\0", + IDS_PRESERVE_SERVER_CONFIG_INFO, + + 0 // No special uninstall function +}; + +// Registry values to remove for the Client +struct REGVALUE clientRegValues[] = { + { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" }, + { 0, 0 } // This indicates there are no more entries +}; + +struct REGVALUE clientWinNTRegValues[] = { + { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\File Manager\\AddOns", "AFS Client FME" }, + { "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", "SMBDeviceEnabled" }, + { 0, 0 } +}; + +struct REGVALUE clientWin9XRegValues[] = { + { "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order", "TransarcAFSDaemon" }, + { 0, 0 } +}; + +/* + * App info structure for the Client product + */ +struct APPINFO appClient = { + "AFS Client", + + AFSREG_CLT_SVC_NAME, + AFSREG_CLT_SVC_KEY, + "5250435353004E657462696F730000", + AFSREG_CLT_SVC_DISPLAYNAME_DATA, + + AFSREG_CLT_SVC_NAME, + + IDS_MUST_STOP_CLIENT, + IDS_WAITING_FOR_CLIENT_TO_STOP, + + AFSREG_CLT_SW_VERSION_KEY, + + { AFSREG_CLT_SW_VERSION_KEY, AFSREG_CLT_SW_VERSION_DIR_VALUE }, + + "\\Client", + "\\Program", + + // No dirs to delete + 0, + + // Files to delete + TARGETDIR"\\Common\\*.gid\0" + TARGETDIR"\\Common\\*.fts\0" + WINDIR"\\..\\AFSCache\0" + WINDIR"\\afsd.log\0" + WINDIR"\\afsd.ini\0" + WINDIR"\\afsdsbmt.ini\0" + WINDIR"\\afsdcell.ini\0" + WINDIR"\\afsd_init.log\0", + + clientRegValues, + clientWinNTRegValues, + clientWin9XRegValues, + + // Start menu entries to remove + "Client\0", + + // Config info to preserve + AFSREG_CLT_SVC_KEY"\0", + IDS_PRESERVE_CLIENT_CONFIG_INFO, + + ClientSpecificUninstall +}; + + +/* + * App info structure for the Light Client product + */ +struct APPINFO appLightClient = { + "AFS Light", + + // No service info + 0, + 0, + 0, + 0, + + AFSREG_CLT_SVC_NAME, + + // No service shutdown messages + 0, + 0, + + "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Light Client", + + { AFSREG_CLT_SW_VERSION_KEY, AFSREG_CLT_SW_VERSION_DIR_VALUE }, + + "\\Client", + "\\Program", + + // No dirs to delete + 0, + + // Files to delete + TARGETDIR"\\Common\\*.gid\0" + TARGETDIR"\\Common\\*.fts\0", + + clientRegValues, + clientWinNTRegValues, + clientWin9XRegValues, + + // Start menu entries to remove + "Light\0", + + // Config info to preserve + AFSREG_CLT_SVC_KEY"\0", + IDS_PRESERVE_LIGHT_CLIENT_CONFIG_INFO, + + UninstallCredsTool +}; + + +/* + * App info structure for the Control Center product + */ +struct APPINFO appControlCenter = { + "AFS Control Center", + + // No service info + 0, + 0, + 0, + 0, + + // No network provider order + 0, + + // No service shutdown messages + 0, + 0, + + "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Control Center", + + { "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Control Center\\CurrentVersion", "PathName" }, + + "\\Control Center", + "", + + // No dirs to delete + 0, + + // Files to delete + TARGETDIR"\\Common\\*.gid\0" + TARGETDIR"\\Common\\*.fts\0", + + 0, // No reg values + 0, // No NT only reg values + 0, // No 9x only reg values + + // Start menu entries to remove + "Control Center\0", + + // Config info to preserve + AFSREG_CLT_SVC_KEY"\0", + IDS_PRESERVE_CC_CONFIG_INFO, + + 0 // No uninstall function +}; + + +/* + * App info structure for the Sys Admin Doc files + */ +struct APPINFO appDocs = { + "AFS Supplemental Documentation", + + // No service info + 0, + 0, + 0, + 0, + + // No network provider order + 0, + + // No service shutdown messages + 0, + 0, + + "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Supplemental Documentation", + + { "HKEY_LOCAL_MACHINE\\SOFTWARE\\TransarcCorporation\\AFS Supplemental Documentation\\CurrentVersion", "PathName" }, + + "\\Documentation", + "", + + // No dirs to delete + 0, + + // Files to delete + TARGETDIR"\\Common\\*.gid\0" + TARGETDIR"\\Common\\*.fts\0", + + 0, // No reg values + 0, // No NT only reg values + 0, // No 9x only reg values + + // Start menu entries to remove + "Documentation\\AFS for Windows Backup Command Reference.lnk\0Documentation\\AFS Command Reference Manual.lnk\0Documentation\\AFS System Administrator's Guide.lnk\0", + + 0, // No config info to preserve + + 0 // No uninstall function +}; + + +// Shared and in-use files +struct FILEINFO { + char *pszName; + int nUsedBy; +}; + +#define SERVER 1 +#define CLIENT 2 +#define LCLIENT 4 +#define CC 8 +#define DOCS 16 + + +struct FILEINFO fileInfo[] = { + { TARGETDIR"\\Common\\afsbosadmin.dll", SERVER | CC }, + { TARGETDIR"\\Common\\afscfgadmin.dll", SERVER | CC }, + { TARGETDIR"\\Common\\afsclientadmin.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afskasadmin.dll", SERVER | CC }, + { TARGETDIR"\\Common\\afsptsadmin.dll", SERVER | CC }, + { TARGETDIR"\\Common\\afsvosadmin.dll", SERVER | CC }, + { TARGETDIR"\\Common\\afsadminutil.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afsrpc.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afsauthent.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\pthread.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\TaAfsAppLib.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afsprocmgmt.dll", SERVER | CLIENT | LCLIENT }, + { TARGETDIR"\\Common\\afs_config.exe", CLIENT | LCLIENT| CC }, + { TARGETDIR"\\Common\\afseventmsg_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afslegal_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afsserver_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afssvrcfg_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\TaAfsAccountManager_????.dll",SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\TaAfsAppLib_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\TaAfsServerManager_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afscreds_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs_config_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs_cpa_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs_shl_ext_????.dll", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-nt.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-nt.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafssvrmgr.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafssvrmgr.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafsusrmgr.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafsusrmgr.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-cc.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-cc.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-light.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\afs-light.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafscfg.cnt", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Common\\taafscfg.hlp", SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Client\\PROGRAM\\afs_shl_ext.dll", CLIENT | LCLIENT }, + { TARGETDIR"\\Client\\PROGRAM\\libafsconf.dll", CLIENT | LCLIENT }, + { TARGETDIR"\\Client\\PROGRAM\\afslogon.dll", CLIENT }, + { TARGETDIR"\\Client\\PROGRAM\\afslog95.dll", LCLIENT }, + { TARGETDIR"\\Control Center\\TaAfsAdmSvr.exe", CC }, + { WINSYSDIR"\\afs_cpa.cpl", CLIENT | LCLIENT | CC }, + { WINSYSDIR"\\afsserver.cpl", SERVER }, + { TARGETDIR"\\Common\\afsdcell.ini", CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Documentation\\Html\\banner.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\books.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\bot.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\index.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\index.htm", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\next.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\prev.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\toc.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\top.gif", SERVER | CLIENT | LCLIENT | CC | DOCS }, + { TARGETDIR"\\Documentation\\Html\\ReleaseNotes\\relnotes.htm", + SERVER | CLIENT | LCLIENT | CC }, + { TARGETDIR"\\Documentation\\Html\\InstallGd\\afsnt35i.htm", + SERVER | CLIENT | LCLIENT | CC }, + { 0, 0 } // End of list +}; + + +/* + * VARIABLES _________________________________________________________________ + * + */ +HINSTANCE hinst; + +static HWND hDlg; +static BOOL bPreserveConfigInfo; +static BOOL bSilentMode; +static char *pszInstallDir; + + +/* + * FUNCTIONS _________________________________________________________________ + * + */ + +static BOOL UpgradeClientIntParm(HKEY hKey, char *pszOldParm, char *pszNewParm) +{ + int nData; + LONG result = ERROR_SUCCESS; + + nData = GetPrivateProfileInt("AFS Client", pszOldParm, -1, "afsd.ini"); + if (nData > -1) + result = RegSetValueEx(hKey, pszNewParm, 0, REG_DWORD, (BYTE *)&nData, sizeof(nData)); + + return (result == ERROR_SUCCESS); +} + +static BOOL UpgradeClientStringParm(HKEY hKey, char *pszOldParm, char *pszNewParm) +{ + char szData[1024]; + LONG result = ERROR_SUCCESS; + + GetPrivateProfileString("AFS Client", pszOldParm, "", szData, sizeof(szData), "afsd.ini"); + if (szData[0]) + result = RegSetValueEx(hKey, pszNewParm, 0, REG_SZ, (PBYTE)szData, strlen(szData) + 1); + + return (result == ERROR_SUCCESS); +} + +int SUCALLCONV Upgrade34ClientConfigInfo() +{ + HKEY hKey; + LONG result; + int nData; + + result = RegOpenKeyAlt(AFSREG_NULL_KEY, AFSREG_CLT_SVC_PARAM_KEY, KEY_WRITE, TRUE, &hKey, 0); + if (result != ERROR_SUCCESS) + return -1; + + UpgradeClientIntParm(hKey, "CacheSize", "CacheSize"); + UpgradeClientIntParm(hKey, "Stats", "Stats"); + UpgradeClientIntParm(hKey, "LogoffTokenTransfer", "LogoffTokenTransfer"); + UpgradeClientIntParm(hKey, "LogoffTokenTransferTimeout", "LogoffTokenTransferTimeout"); + UpgradeClientIntParm(hKey, "TrapOnPanic", "TrapOnPanic"); + UpgradeClientIntParm(hKey, "TraceBufferSize", "TraceBufferSize"); + UpgradeClientIntParm(hKey, "TraceOnShutdown", "TraceOnShutdown"); + UpgradeClientIntParm(hKey, "ReportSessionStartups", "ReportSessionStartups"); + + UpgradeClientStringParm(hKey, "MountRoot", "MountRoot"); + UpgradeClientStringParm(hKey, "Cell", "Cell"); + + /* BlockSize to ChunkSize requires convertion */ + nData = GetPrivateProfileInt("AFS Client", "BlockSize", -1, "afsd.ini"); + if (nData > -1) { + DWORD chunkSize; + for (chunkSize = 0; (1 << chunkSize) < nData; chunkSize++); + (void) RegSetValueEx(hKey, "ChunkSize", 0, REG_DWORD, (BYTE *)&chunkSize, sizeof(chunkSize)); + } + + RegCloseKey(hKey); + + return 0; +} + +int SUCALLCONV Eradicate34Client() +{ + if (Client34Eradicate(TRUE) != ERROR_SUCCESS) + return -1; + + return 0; +} + +// This function was written a long time ago by Mike Comer for use by the +// original DFS Client for NT install program. +int SUCALLCONV CheckIfAdmin(void) +{ + HANDLE token = INVALID_HANDLE_VALUE; + PVOID buffer = 0; + DWORD bufLength; + DWORD realBufLength; + TOKEN_PRIMARY_GROUP *pgroup; + TOKEN_GROUPS *groups; + int result = -1; + DWORD groupCount; + LONG status; + PSID AdministratorSID = NULL; + SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY; + + // allocate the SID for the Administrators group + if (!AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorSID)) { + status = GetLastError(); + goto getout; + } + + // open the process token + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token)) { + status = GetLastError(); + token = INVALID_HANDLE_VALUE; + goto getout; + } + + // check primary group first + buffer = GlobalAlloc(GMEM_FIXED, sizeof(TOKEN_PRIMARY_GROUP)); + if (!buffer) { + goto getout; + } + + bufLength = sizeof(TOKEN_PRIMARY_GROUP); + while(1) { + if (!GetTokenInformation(token, TokenPrimaryGroup, buffer, bufLength, &realBufLength)) { + if (realBufLength > bufLength) { + // not enough space + GlobalFree(buffer); + bufLength = realBufLength; + buffer = GlobalAlloc(GMEM_FIXED, realBufLength); + if (!buffer) { + goto getout; + } + continue; + } + + goto getout; + } + break; + } + + pgroup = (TOKEN_PRIMARY_GROUP *)buffer; + if (EqualSid(pgroup->PrimaryGroup, AdministratorSID)) { + result = 0; + } else { + // okay, try the secondary groups + while(1) { + if (!GetTokenInformation(token, TokenGroups, buffer, bufLength, &realBufLength)) { + if (realBufLength > bufLength) { + // not enough space + GlobalFree(buffer); + bufLength = realBufLength; + buffer = GlobalAlloc(GMEM_FIXED, realBufLength); + if (!buffer) { + goto getout; + } + continue; + } + + // a real error + goto getout; + } + break; + } + + // we have the list of groups here. Process them: + groups = (TOKEN_GROUPS *)buffer; + for(groupCount = 0; groupCount < groups->GroupCount; groupCount++) { + if (EqualSid(groups->Groups[groupCount].Sid, AdministratorSID)) { + result = 0; + break; + } + } + } + +getout: + + if (token != INVALID_HANDLE_VALUE) { + CloseHandle(token); + } + + if (buffer) { + GlobalFree(buffer); + } + + if (AdministratorSID) { + FreeSid(AdministratorSID); + } + + return result; +} + +static void SetSharedFileRefCount(char *pszFile, int nRefCount) +{ + LONG result; + HKEY hKey; + + result = RegOpenKeyAlt(AFSREG_NULL_KEY, MS_SHARED_FILES_KEY, KEY_WRITE, FALSE, &hKey, 0); + if (result != ERROR_SUCCESS) + return; + + if (nRefCount <= 0) + RegDeleteValue(hKey, pszFile); + else + RegSetValueEx(hKey, pszFile, 0, REG_DWORD, (BYTE *)&nRefCount, sizeof(int)); + + RegCloseKey(hKey); +} + +static char *GetTimeStamp() +{ + char szTime[64], szDate[64]; + static char szTimeDate[128]; + + _strtime(szTime); + _strdate(szDate); + + sprintf(szTimeDate, "[%s %s] ", szTime, szDate); + + return szTimeDate; +} + +int SUCALLCONV WriteToInstallErrorLog(char *pszMsg) +{ + static BOOL bWritten = FALSE; + FILE *fp; + + // On the first write, recreate the file + fp = fopen(INSTALL_ERROR_LOG_NAME, bWritten ? "a" : "w"); + if (!fp) + return -1; + + fprintf(fp, "%s%s\r\n", GetTimeStamp(), pszMsg); + + fclose(fp); + + bWritten = TRUE; + + return 0; +} + +static void WriteToUninstallErrorLog(char *pszMsg) +{ + static BOOL bWritten = FALSE; + FILE *fp; + + // On the first write, recreate the file + fp = fopen(UNINSTALL_ERROR_LOG_NAME, bWritten ? "a" : "w"); + if (!fp) + return; + + fprintf(fp, "%s%s\r\n", GetTimeStamp(), pszMsg); + + fclose(fp); + + bWritten = TRUE; +} + +static char *LoadResString(UINT uID) +{ + static char str[256]; + GetString (str, uID); + return str; +} + +static void ShowError(UINT nResID, LONG nError) +{ + char szErr[256]; + char szPrompt[256]; + char szMsg[256]; + char szTitle[256]; + char *psz; + + psz = LoadResString(nResID); + if (psz) + strcpy(szErr, psz); + else + sprintf(szErr, "unknown error msg (Msg ID = %d)", nResID); + + psz = LoadResString(IDS_INSTALLATION_FAILURE); + strcpy(szPrompt, psz ? psz : "An error has occurred: %s (Last Error = %ld)."); + + sprintf(szMsg, szPrompt, szErr, nError); + + psz = LoadResString(IDS_TITLE); + strcpy(szTitle, psz ? psz : "AFS"); + + if (bSilentMode) + WriteToUninstallErrorLog(szMsg); + else + MessageBox(hDlg, szMsg, szTitle, MB_OK); +} + +static int ShowMsg(UINT nResID, int nType) +{ + char szTitle[256]; + char *psz; + + psz = LoadResString(IDS_TITLE); + strcpy(szTitle, psz ? psz : "AFS"); + + return MessageBox(hDlg, LoadResString(nResID), szTitle, nType); +} + +static char *GetAppInstallDir(struct APPINFO *pApp, BOOL bRemembered) +{ + HKEY hKey; + LONG nResult; + DWORD dwType; + static char szInstallDir[256]; + DWORD dwSize; + char *pszKey; + char *pszValue; + + pszKey = bRemembered ? UNINSTALL_TEMP_INFO_KEY : pApp->regInstallDir.pszKey; + pszValue = bRemembered ? INSTALL_DIR_VALUE_NAME : pApp->regInstallDir.pszValue; + + dwSize = sizeof(szInstallDir); + + nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); + if (nResult == ERROR_SUCCESS) { + nResult = RegQueryValueEx(hKey, pszValue, 0, &dwType, (PBYTE)szInstallDir, &dwSize); + RegCloseKey(hKey); + } + + if (nResult != ERROR_SUCCESS) { + ShowError(IDS_CANT_DETERMINE_APP_PATH, nResult); + return 0; + } + + FilepathNormalizeEx(szInstallDir, FPN_BACK_SLASHES); + + return szInstallDir; +} + +static BOOL DoesRegKeyExist(char *pszKey) +{ + HKEY hKey; + LONG nResult; + + nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); + if (nResult == ERROR_SUCCESS) { + RegCloseKey(hKey); + return TRUE; + } + + return FALSE; +} + +static BOOL IsAppInstalled(struct APPINFO *pApp) +{ + return DoesRegKeyExist(pApp->pszAppKey); +} + +static void BuildShortPath(char *pszShortPath, UINT nShortPathLen, char *pszInstallDir, char *pszPath) +{ + strncpy(pszShortPath, pszInstallDir, nShortPathLen); + strncat(pszShortPath, pszPath, nShortPathLen); + + GetShortPathName(pszShortPath, pszShortPath, nShortPathLen); +} + +static BOOL IsWin95() +{ + OSVERSIONINFO versionInformation; + + versionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + GetVersionEx(&versionInformation); + + if ((versionInformation.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && + (versionInformation.dwMinorVersion == 0)) + return TRUE; + + return FALSE; +} + +int IsWin98() +{ + OSVERSIONINFO versionInformation; + + versionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + GetVersionEx(&versionInformation); + + if ((versionInformation.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && + (versionInformation.dwMinorVersion == 10)) + return 0; + + return -1; +} + +static BOOL IsServiceInstalled(char *pszServiceKey) +{ + HKEY hKey; + + if (RegOpenKeyAlt(0, pszServiceKey, KEY_READ, FALSE, &hKey, 0) == ERROR_SUCCESS) { + RegCloseKey(hKey); + return TRUE; + } + + return FALSE; +} + +// If this fails in anyway we just return. No error is displayed. +static void MakeSureServiceDoesNotExist(char *pszName) +{ + SC_HANDLE hServer = 0, hSCM = 0; + SERVICE_STATUS status; + + hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); + if (hSCM) { + hServer = OpenService(hSCM, pszName, SERVICE_ALL_ACCESS | DELETE); + if (hServer) { + if (QueryServiceStatus(hServer, &status)) { + if (status.dwCurrentState != SERVICE_STOPPED) { + if (!ControlService(hServer, SERVICE_CONTROL_STOP, &status)) { + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + return; + } + } + } + + // Try to delete even if status query fails + DeleteService(hServer); + } + } + + if (hServer) + CloseServiceHandle(hServer); + if (hSCM) + CloseServiceHandle(hSCM); +} + +static int InstallService(char *pszName, char *pszDependOn, char *pszDisplayName, char *pszServicePath, BOOL bInteractive) +{ + SC_HANDLE hServer = 0, hSCM; + BOOL bRestoreOldConfig = FALSE; + + hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); + if (!hSCM) { + ShowError(IDS_SCM_OPEN_FAILED, GetLastError()); + return -1; + } + +/* This code is not used, but it could be handy in the future so I am keeping it here. + + // If the service exists, then we (most probably) are in the middle of an upgrade or reinstall. + bRestoreOldConfig = IsServiceInstalled(pszName); + + if (bRestoreOldConfig) { + hServer = OpenService(hSCM, pszName, SERVICE_ALL_ACCESS); + if (!hServer || !ChangeServiceConfig(hServer, SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE, 0, 0, 0, 0, 0, 0, 0)) { + ShowError(IDS_RESTORE_OF_PREVIOUS_CONFIG_FAILED, GetLastError()); + bRestoreOldConfig = FALSE; + // Fall through to service creation below + } + } +*/ + + if (!bRestoreOldConfig) { + DWORD dwServiceType; + + // If the service already exists, the create call will fail. This can + // happen if uninstall failed (which is not infrequent). Making sure the + // service does not exist makes it easier for a user to install over top of + // a previously failed uninstall. + MakeSureServiceDoesNotExist(pszName); + + dwServiceType = SERVICE_WIN32_OWN_PROCESS; + if (bInteractive) + dwServiceType |= SERVICE_INTERACTIVE_PROCESS; + + hServer = CreateService(hSCM, pszName, pszDisplayName, + SERVICE_ALL_ACCESS, dwServiceType, SERVICE_AUTO_START, + SERVICE_ERROR_NORMAL, pszServicePath, 0, 0, "RPCSS\0Netbios\0\0", 0, 0); + + if (!hServer) + ShowError(IDS_SERVICE_CREATE_FAILED, GetLastError()); + } + + if (hServer) + CloseServiceHandle(hServer); + + CloseServiceHandle(hSCM); + + return 0; +} + +int SUCALLCONV InstallServerService(char *pszServicePath) +{ + return InstallService(appServer.pszSvcName, 0, appServer.pszSvcDisplayName, pszServicePath, TRUE); +} + +int SUCALLCONV InstallClientService(char *pszServicePath) +{ + return InstallService(appClient.pszSvcName, appClient.pszSvcDependOn, appClient.pszSvcDisplayName, pszServicePath, FALSE); +} + +static int UninstallService(struct APPINFO *pAppInfo) +{ + SC_HANDLE hServer, hSCM; + SERVICE_STATUS status; + BOOL bOk; + BOOL bServer = FALSE; + BOOL bShowingProgressDlg = FALSE; + + hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); + if (!hSCM) { + ShowError(IDS_SCM_OPEN_FAILED, GetLastError()); + return -1; + } + + hServer = OpenService(hSCM, pAppInfo->pszSvcName, SERVICE_ALL_ACCESS | DELETE); + if (!hServer) { + ShowError(IDS_SERVICE_OPEN_FAILED, GetLastError()); + CloseServiceHandle(hSCM); + return -1; + } + + if (!QueryServiceStatus(hServer, &status)) { + ShowError(IDS_SERVICE_QUERY_FAILED, GetLastError()); + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + return -1; + } + + if (status.dwCurrentState != SERVICE_STOPPED) { + if (pAppInfo->nServiceShutdownMsgID) { + if (!bSilentMode && (ShowMsg(pAppInfo->nServiceShutdownMsgID, MB_YESNO | MB_ICONQUESTION) == IDNO)) { + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + return 1; + } + } + + if (!bSilentMode) + bShowingProgressDlg = ShowProgressDialog(LoadResString(pAppInfo->nServiceShutdownProgressMsgID)); + + if (!ControlService(hServer, SERVICE_CONTROL_STOP, &status)) { + if (bShowingProgressDlg) + HideProgressDialog(); + ShowError(IDS_SERVICE_STOP_FAILED, GetLastError()); + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + return -1; + } + } + + // Wait for the service to stop + while (status.dwCurrentState != SERVICE_STOPPED) { + // I stopped waiting on dwWaitHint because it seemed the wait hint was too long. + // The service would be stopped but we'd still be asleep for a long time yet. + Sleep(5000); //status.dwWaitHint); + + if (!QueryServiceStatus(hServer, &status)) { + if (bShowingProgressDlg) + HideProgressDialog(); + ShowError(IDS_SERVICE_QUERY_FAILED, GetLastError()); + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + return -1; + } + } + + // The service has been stopped + if (bShowingProgressDlg) + HideProgressDialog(); + + // This code to disable the service may be of use some day so I am keeping it here. + // bOk = ChangeServiceConfig(hServer, SERVICE_NO_CHANGE, SERVICE_DISABLED, SERVICE_NO_CHANGE, 0, 0, 0, 0, 0, 0, 0); + + bOk = DeleteService(hServer); + + if (!bOk) + ShowError(IDS_SERVICE_DELETE_FAILED, GetLastError()); + + CloseServiceHandle(hServer); + CloseServiceHandle(hSCM); + + return (bOk ? 0 : -1); +} + +int SUCALLCONV AddToNetworkProviderOrder(char *pszWhatToAdd) +{ + return AddToProviderOrder(pszWhatToAdd) ? 0 : -1; +} + +static int RemoveFromNetworkProviderOrder(char *pszWhatToDel) +{ + return RemoveFromProviderOrder(pszWhatToDel) ? 0 : -1; +} + +int SUCALLCONV AddToPath(char *pszPath) +{ + return AddToSystemPath(pszPath) ? 0 : -1; +} + +static int RemoveFromPath(char *pszPath) +{ + return RemoveFromSystemPath(pszPath) ? 0 : -1; +} + +static void RemoveFiles(char *pszFileSpec) +{ + struct _finddata_t fileinfo; + long hSearch; + char szDel[MAX_PATH]; + char szDir[MAX_PATH]; + char *p; + + strcpy(szDir, pszFileSpec); + p = strrchr(szDir, '\\'); + if (p) + *p = 0; + + hSearch = _findfirst(pszFileSpec, &fileinfo); + if (hSearch == -1) + return; + + while (1) { + if ((strcmp(fileinfo.name, ".") != 0) && (strcmp(fileinfo.name, "..") != 0)) { + sprintf(szDel, "%s\\%s", szDir, fileinfo.name); + DeleteFile(szDel); + } + + if (_findnext(hSearch, &fileinfo) == -1) + break; + } + + _findclose(hSearch); +} + +static void RemoveDir(char *pszDir) +{ + char szFileSpec[MAX_PATH]; + + sprintf(szFileSpec, "%s\\*.*", pszDir); + + RemoveFiles(szFileSpec); + RemoveDirectory(pszDir); +} + +static void RemoveRegValues(struct REGVALUE *pRegValues) +{ + struct REGVALUE *pCurValue; + HKEY hKey; + LONG nResult; + + if (!pRegValues) + return; + + for (pCurValue = pRegValues; pCurValue->pszKey; pCurValue++) { + nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pCurValue->pszKey, KEY_ALL_ACCESS, FALSE, &hKey, 0); + + if (nResult == ERROR_SUCCESS) { + nResult = RegDeleteValue(hKey, pCurValue->pszValue); + RegCloseKey(hKey); + } + + if (nResult != ERROR_SUCCESS) + ShowError(IDS_REG_DELETE_VALUE_ERROR, nResult); + } +} + +static BOOL UninstallCredsTool() +{ + int nResult = WinExec("afscreds /uninstall", SW_HIDE); + + if (nResult <= 31) { + if (nResult != ERROR_FILE_NOT_FOUND) + ShowError(IDS_CANT_UNINSTALL_AFSCREDS, nResult); + } + + // Always return true. We don't want the uninstall to completely fail just + // because the creds tool didn't uninstall. + return TRUE; +} + + +static char *GetTempDir() +{ + DWORD result; + static char szTempDir[MAX_PATH]; + + result = GetTempPath(sizeof(szTempDir) - 1, szTempDir); + if (result == 0) + return "\\"; + + return szTempDir; +} + +static char *GetRootInstallDir() +{ + char *psz; + static char szRootInstallDir[MAX_PATH] = ""; + + if (szRootInstallDir[0] == 0) { + strcpy(szRootInstallDir, pszInstallDir); + + // Strip off the app specific part of the install dir + psz = strrchr(szRootInstallDir, '\\'); + if (psz) + *psz = 0; + } + + return szRootInstallDir; +} + +static BOOL ClientSpecificUninstall() +{ + int nChoice; + + // This function needs to do two things. First it needs to see if the server is + // installed, and if it is, ask the user if they really want to uninstall the + // client given that the server needs the client. Second, if we are uninstalling + // the client, we need to uninstall the creds tool. + + if (!bSilentMode) { + if (IsAppInstalled(&appServer)) { + nChoice = ShowMsg(IDS_CLIENT_NEEDED_BY_SERVER, MB_ICONQUESTION | MB_YESNO); + if (nChoice == IDNO) + return FALSE; // Cancel the uninstall + } + } + + UninstallCredsTool(); + + return TRUE; +} + +static struct APPINFO *GetApp() +{ +#ifdef SERVER_UNINST + return &appServer; +#elif CLIENT_UNINST + return &appClient; +#elif CC_UNINST + return &appControlCenter; +#elif LIGHT_CLIENT_UNINST + return &appLightClient; +#elif DOCS_UNINST + return &appDocs; +#else + return 0; +#endif; +} + +static void RememberInstallDir(char *pszInstallDir) +{ + HKEY hKey; + + // We remember the install dir so that when the UninstUninitialize function is called + // by the InstallShield uninstaller, we can find out where we were installed to. We + // have to do this because by the time that function is called, the registry values + // created at install time are already gone. We need to be able to find out where we + // were installed so we can clean up anything IS couldn't uninstall. If this fails in + // any way then we don't care. The only consequence is that some junk might be left on + // the users' system after an uninstall. + + LONG result = RegOpenKeyAlt(AFSREG_NULL_KEY, UNINSTALL_TEMP_INFO_KEY, KEY_WRITE, TRUE, &hKey, 0); + if (result != ERROR_SUCCESS) + return; + + RegSetValueEx(hKey, INSTALL_DIR_VALUE_NAME, 0, REG_SZ, (PBYTE)pszInstallDir, strlen(pszInstallDir) + 1); + + RegCloseKey(hKey); +} + +int SUCALLCONV SetSilentMode() +{ + bSilentMode = TRUE; + + return 0; +} + +static char *GetWinDir() +{ + static char szWinDir[MAX_PATH] = ""; + + if (!szWinDir[0]) + GetWindowsDirectory(szWinDir, sizeof(szWinDir)); + + return szWinDir; +} + +static char *GetWinSysDir() +{ + static char szWinSysDir[MAX_PATH] = ""; + + if (!szWinSysDir[0]) + GetSystemDirectory(szWinSysDir, sizeof(szWinSysDir)); + + return szWinSysDir; +} + +static char *GetLocaleID() +{ + static char szID[25] = ""; + + if (szID[0] == 0) { + LCID dwID = GetSystemDefaultLCID(); + + // Nuke the high word. It contains a sort ID. + dwID &= 0x0000FFFF; + + // Convert locale ID to a string + itoa(dwID, szID, 10); + + // This thing should never be more than LOCALE_ID_LEN characters long. + szID[LOCALE_ID_LEN] = 0; + } + + return szID; +} + +static char *ExpandPath(char *pszFile) +{ + static char szPath[MAX_PATH]; + char *psz; + + szPath[0] = 0; + + // Convert a path containing TARGETDIR, WINDIR, or WINSYSDIR to a + // real path in the file system. One of these MUST be the start of + // the file path passed in. Also convert the string ???? to an + // actual locale number. + if (strncmp(pszFile, TARGETDIR, strlen(TARGETDIR)) == 0) + strcpy(szPath, GetRootInstallDir()); + else if (strncmp(pszFile, WINDIR, strlen(WINDIR)) == 0) + strcpy(szPath, GetWinDir()); + else if (strncmp(pszFile, WINSYSDIR, strlen(WINSYSDIR)) == 0) + strcpy(szPath, GetWinSysDir()); + + if (szPath[0]) { + psz = strchr(pszFile, '\\'); + if (psz) + strcat(szPath, psz); + } else + strcpy(szPath, pszFile); + + // Is this a language dll? + psz = strstr(szPath, "????."); + + // If it is, replace ???? with the locale number + if (psz) + strncpy(psz, GetLocaleID(), LOCALE_ID_LEN); + + return szPath; +} + +static BOOL FileNeededByOtherApp(struct APPINFO *pApp, struct FILEINFO *pFileInfo) +{ + // If the file is used by the server, the app being uninstalled is not the server, and + // the server is installed, then this file is used by another app. + if (!IsWinNT()) { + if ((pFileInfo->nUsedBy & LCLIENT) && (pApp != &appLightClient) && IsAppInstalled(&appLightClient)) + return TRUE; + return FALSE; + } + + if ((pFileInfo->nUsedBy & SERVER) && (pApp != &appServer) && IsAppInstalled(&appServer)) + return TRUE; + + if ((pFileInfo->nUsedBy & CLIENT) && (pApp != &appClient) && IsAppInstalled(&appClient)) + return TRUE; + + if ((pFileInfo->nUsedBy & CC) && (pApp != &appControlCenter) && IsAppInstalled(&appControlCenter)) + return TRUE; + + return FALSE; +} + +static void DeleteInUseFiles(struct APPINFO *pAppInfo, struct FILEINFO *pFileInfo) +{ + char szSrcPath[MAX_PATH]; + char szDestPath[MAX_PATH]; + char szTempDir[MAX_PATH]; + int ii; + + // If some app's file has been loaded before the app is uninstalled, then + // when an uninstall is attempted, the application and all of the dlls that + // its uses will be in use and IS will not be able to delete them. Normally this + // is not a problem because IS will tell the user to reboot to finish the uninstall. + // However, we must support the ability to perform a silent uninstall followed + // immediatly by an install of the same product to the same directories. If we let + // IS handle the uninstall of these files, this is not possible. The reason is that + // when IS fails to remove these in use files, it marks them for deletion after the + // next reboot, which is fine. Unfortunately, it leaves them in the dirs they were + // installed to. So if we don't immediately reboot and perform an install to the + // same dirs, once a reboot is performed, those files get deleted and we have a + // broken installation. + + // What we will do to fix all of this, is when the client is uninstalled, but + // before IS does anything, we will move the in use files and associated dlls + // into the temp dir and mark them for delete after a reboot. Then an install + // that follows will succeed. + + // Delete the files that may be in use. If they are we actually move + // them to the temp dir and mark them for deletion after the next reboot. + for (ii = 0; pFileInfo[ii].pszName != 0; ii++) { + // Get the source path + strcpy(szSrcPath, ExpandPath(pFileInfo[ii].pszName)); + + // Only delete the file if it is not used by some other app + if (FileNeededByOtherApp(pAppInfo, &pFileInfo[ii])) + continue; + + // If the file doesn't exist then go on to the next file. + if (_access(szSrcPath, 0) != 0) + continue; + + // See if we can do a regular delete of the file + if (DeleteFile(szSrcPath)) { + SetSharedFileRefCount(szSrcPath, 0); + continue; + } + + // Get a temp dir that is on the same drive as the src path. + // We can't move an in use file to a different drive. + strcpy(szTempDir, GetTempDir()); + if (szTempDir[0] != szSrcPath[0]) { + // Get the drive, colon, and slash of the src path + strncpy(szTempDir, szSrcPath, 3); + szTempDir[3] = 0; + } + + // Get the dest path - we will rename the file during the move + GetTempFileName(szTempDir, "AFS", 0, szDestPath); + + // Move from source to dest, marking the file for deletion after a reboot + if (IsWin95()) { + if (MoveFile(szSrcPath, szDestPath)) { + WritePrivateProfileString("rename", szSrcPath, szDestPath, "wininit.ini"); + SetSharedFileRefCount(szSrcPath, 0); + } + } else { // WinNT or Win98 + if (MoveFileEx(szSrcPath, szDestPath, MOVEFILE_REPLACE_EXISTING)) { + SetFileAttributes(szDestPath, FILE_ATTRIBUTE_NORMAL); + MoveFileEx(szDestPath, 0, MOVEFILE_DELAY_UNTIL_REBOOT); + SetSharedFileRefCount(szSrcPath, 0); + } + } + } +} + +// Delete a directory and all its files and subdirectories - Yee haaa! +static void RemoveDirectoryTree(char *pszDir) +{ + HANDLE hFind; + WIN32_FIND_DATA findFileData; + char szSpec[MAX_PATH]; + char szSubFileOrDir[MAX_PATH]; + BOOL bContinue; + + sprintf(szSpec, "%s\\*.*", pszDir); + + // First delete the contents of the dir + hFind = FindFirstFile(szSpec, &findFileData); + bContinue = (hFind != INVALID_HANDLE_VALUE); + + while (bContinue) { + if ((strcmp(findFileData.cFileName, ".") != 0) && (strcmp(findFileData.cFileName, "..") != 0)) { + sprintf(szSubFileOrDir, "%s\\%s", pszDir, findFileData.cFileName); + + if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + RemoveDirectoryTree(szSubFileOrDir); + else + DeleteFile(szSubFileOrDir); + } + + bContinue = FindNextFile(hFind, &findFileData); + } + + FindClose(hFind); + + // Now remove the dir + RemoveDirectory(pszDir); +} + +static char *GetStartMenuRoot() +{ + HKEY hKey; + LONG nResult; + DWORD dwType; + DWORD dwSize; + char *pszKey; + char *pszValue; + + static char szStartMenuRoot[MAX_PATH] = ""; + + if (szStartMenuRoot[0] == 0) { + dwSize = sizeof(szStartMenuRoot); + + if (IsWinNT()) { + pszKey = WINNT_START_MENU_REG_KEY; + pszValue = WINNT_START_MENU_REG_VALUE; + } else { + pszKey = WIN9X_START_MENU_REG_KEY; + pszValue = WIN9X_START_MENU_REG_VALUE; + } + + nResult = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); + if (nResult == ERROR_SUCCESS) { + nResult = RegQueryValueEx(hKey, pszValue, 0, &dwType, (PBYTE)szStartMenuRoot, &dwSize); + RegCloseKey(hKey); + } + + if (nResult != ERROR_SUCCESS) + return 0; + } + + FilepathNormalizeEx(szStartMenuRoot, FPN_BACK_SLASHES); + + return szStartMenuRoot; +} + +static char *GetAfsStartMenuRoot() +{ + static char szAfsStartMenuRoot[MAX_PATH] = ""; + char *pszStartMenuRoot; + + if (szAfsStartMenuRoot[0] == 0) { + pszStartMenuRoot = GetStartMenuRoot(); + if (!pszStartMenuRoot) + return 0; + + if (bSilentMode) + sprintf(szAfsStartMenuRoot, "%s\\IBM WebSphere\\Performance Pack\\AFS", pszStartMenuRoot ); + else + sprintf(szAfsStartMenuRoot, "%s\\IBM AFS", pszStartMenuRoot ); + } + + return szAfsStartMenuRoot; +} + +static BOOL IsADir(char *pszName) +{ + struct _stat statbuf; + + if (_stat(pszName, &statbuf) < 0) + return FALSE; + + return statbuf.st_mode & _S_IFDIR; +} + +static void DeleteStartMenuEntries(char *pszEntries) +{ + char szStartMenuPath[MAX_PATH]; + char *pszAfsStartMenuRoot; + char *pszCurEntry; + + pszAfsStartMenuRoot = GetAfsStartMenuRoot(); + + if (!pszAfsStartMenuRoot) + return; + + for (pszCurEntry = pszEntries; *pszCurEntry; pszCurEntry += strlen(pszCurEntry) + 1) { + sprintf(szStartMenuPath, "%s\\%s", pszAfsStartMenuRoot, pszCurEntry); + if (IsADir(szStartMenuPath)) + RemoveDirectoryTree(szStartMenuPath); + else + DeleteFile(szStartMenuPath); + } +} + +static void RefreshStartMenu() +{ + char *pszAfsStartMenuRoot; + char szTemp[MAX_PATH]; + + pszAfsStartMenuRoot = GetAfsStartMenuRoot(); + if (!pszAfsStartMenuRoot) + return; + + sprintf(szTemp, "%s - Refresh Attempt", pszAfsStartMenuRoot); + + // Deleting items from below the root level of the start menu does not + // cause it to refresh. In order that users can see changes without + // rebooting we will temporarily rename our root most entry, which + // does cause a refresh of the start menu. + MoveFileEx(pszAfsStartMenuRoot, szTemp, MOVEFILE_REPLACE_EXISTING); + MoveFileEx(szTemp, pszAfsStartMenuRoot, MOVEFILE_REPLACE_EXISTING); +} + +static BOOL PreserveConfigInfo(struct APPINFO *pApp) +{ + char *pszRegKey; + char szDestKey[256]; + LONG result; + + bPreserveConfigInfo = TRUE; + + // If not in silent mode, ask user if they want to preserve the cfg info + if (!bSilentMode) { + int nChoice = ShowMsg(pApp->nPreserveConfigInfoMsgID, MB_ICONQUESTION | MB_YESNOCANCEL); + if (nChoice == IDCANCEL) + return FALSE; // Cancel the uninstall + else if (nChoice == IDNO) { + bPreserveConfigInfo = FALSE; // User doesn't want to preserve the config info + return TRUE; + } + } + + // Copy each reg key (and all of its subkeys and values) to another place in the registry. + for (pszRegKey = pApp->pszRegKeysToPreserve; *pszRegKey; pszRegKey += strlen(pszRegKey) + 1) { + if (!DoesRegKeyExist(pszRegKey)) + continue; + + // Create the destination path for the copy + sprintf(szDestKey, "%s\\%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName, pszRegKey); + + // Try to copy it + result = RegDupKeyAlt(pszRegKey, szDestKey); + + if ((result != ERROR_SUCCESS) && (result != ERROR_FILE_NOT_FOUND)) { + // If the copy failed, then delete any copies that succeeded + sprintf(szDestKey, "%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); + RegDeleteEntryAlt(szDestKey, REGENTRY_KEY); + goto done; + } + } + + // Remember the integrated login setting if this app supports that and it was turned on + if (pApp->pszNetworkProviderOrder) { + // Was integerated login turned on? + BOOL bOn, bOk; + bOk = InNetworkProviderOrder(pApp->pszNetworkProviderOrder, &bOn); + if (bOk && bOn) { + HKEY hKey; + sprintf(szDestKey, "%s\\%s\\IntegratedLogin", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); + result = RegOpenKeyAlt(AFSREG_NULL_KEY, szDestKey, KEY_WRITE, TRUE, &hKey, 0); + // The existance of the key is a flag indicating that integrated login was turned on + RegCloseKey(hKey); + } + } + +done: + if ((result == ERROR_SUCCESS) || bSilentMode) + return TRUE; // Continue with uninstall + + // Report the error and ask the user if they want to continue the uninstall + return (ShowMsg(IDS_SAVE_OF_CONFIG_INFO_FAILED, MB_ICONEXCLAMATION | MB_YESNO) == IDYES); +} + +int SUCALLCONV RestoreConfigInfo(int nApp) +{ + char *pszRegKey; + char szSrcKey[256]; + struct APPINFO *pApp = 0; + BOOL bError = FALSE; + LONG result; + + switch (nApp) { + case SERVER: pApp = &appServer; break; + case CLIENT: pApp = &appClient; break; + case LCLIENT: pApp = &appLightClient; break; + case CC: pApp = &appControlCenter; break; + } + + if (!pApp) + return -1; + + // Copy each reg key (and all of its subkeys and values) back to its original place in the registry. + for (pszRegKey = pApp->pszRegKeysToPreserve; *pszRegKey; pszRegKey += strlen(pszRegKey) + 1) { + // Create the source path for the copy + sprintf(szSrcKey, "%s\\%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName, pszRegKey); + + if (!DoesRegKeyExist(szSrcKey)) + continue; + + // Try to restore as many of the keys as possible. Report any errors at the end. + + // Try to copy it + result = RegDupKeyAlt(szSrcKey, pszRegKey); + if ((result != ERROR_SUCCESS) && (result != ERROR_FILE_NOT_FOUND)) + bError = TRUE; + } + + // Restore integrated login if this app was using it + if (pApp->pszNetworkProviderOrder) { + // Check if integrated login was turned on. The IntegratedLogin key is a flag + // telling us that it was on. If the key does not exist, integrated login was + // not on. + sprintf(szSrcKey, "%s\\%s\\IntegratedLogin", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); + if (DoesRegKeyExist(szSrcKey)) { + if (!AddToProviderOrder(pApp->pszNetworkProviderOrder)) + bError = TRUE; + } + } + + // Remove our saved copies of the config info + sprintf(szSrcKey, "%s\\%s", AFS_PRESERVED_CFG_INFO_KEY, pApp->pszAppName); + RegDeleteEntryAlt(szSrcKey, REGENTRY_KEY); + + if (bError) + ShowError(IDS_RESTORE_OF_PREVIOUS_CONFIG_FAILED, 0); + + return TRUE; +} + +static BOOL DoSubKeysExist(char *pszKey) +{ + LONG result; + HKEY hKey; + char *pszSubKeys = 0; + BOOL bExist; + + result = RegOpenKeyAlt(AFSREG_NULL_KEY, pszKey, KEY_READ, FALSE, &hKey, 0); + if (result != ERROR_SUCCESS) + return FALSE; + + result = RegEnumKeyAlt(hKey, &pszSubKeys); + RegCloseKey(hKey); + + if (result != ERROR_SUCCESS) + return FALSE; + + if (pszSubKeys) { + bExist = TRUE; + free(pszSubKeys); + } else + bExist = FALSE; + + return bExist; +} + +/* + * The following definitions are taken from richedit.h: + * + */ + +#define EM_SETBKGNDCOLOR (WM_USER + 67) // from Richedit.h +#define EM_STREAMIN (WM_USER + 73) // from Richedit.h +#define SF_RTF 0x0002 + +typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb); + +typedef struct _editstream { + DWORD dwCookie; /* user value passed to callback as first parameter */ + DWORD dwError; /* last error */ + EDITSTREAMCALLBACK pfnCallback; +} EDITSTREAM; + +/* + * + */ + +DWORD CALLBACK License_StreamText (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) +{ + LPTSTR psz = (LPTSTR)dwCookie; + LONG cchAvail = lstrlen(psz); + if ((*pcb = min(cchAvail, cb)) != 0) { + memcpy (pbBuff, psz, *pcb); + memmove (psz, &psz[*pcb], cchAvail - *pcb + 1); + } + return 0; +} + + +void License_OnInitDialog (HWND hDlg, LPTSTR pszFile) +{ + // Open the license file and shove its text in our RichEdit control + // + HANDLE hFile; + if ((hFile = CreateFile (pszFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) { + + size_t cbText; + if ((cbText = GetFileSize (hFile, NULL)) != 0) { + + LPTSTR abText = (LPTSTR)GlobalAlloc (GMEM_FIXED, cbText + 3); + + DWORD cbRead; + if (ReadFile (hFile, abText, cbText, &cbRead, NULL)) { + abText[ cbRead ] = 0; + + EDITSTREAM Stream; + memset (&Stream, 0x00, sizeof(Stream)); + Stream.dwCookie = (DWORD)abText; + Stream.pfnCallback = License_StreamText; + + SendDlgItemMessage (hDlg, IDC_TEXT, EM_STREAMIN, SF_RTF, (LPARAM)&Stream); + } + + GlobalFree (abText); + } + + CloseHandle (hFile); + } + + // Make the control's background be gray + // + SendDlgItemMessage (hDlg, IDC_TEXT, EM_SETBKGNDCOLOR, FALSE, (LPARAM)GetSysColor(COLOR_BTNFACE)); +} + +BOOL CALLBACK License_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) +{ + switch (msg) { + case WM_INITDIALOG: + SetWindowLong (hDlg, DWL_USER, lp); + License_OnInitDialog (hDlg, (LPTSTR)lp); + break; + + case WM_COMMAND: + switch (LOWORD(wp)) { + case IDCANCEL: + case IDOK: + EndDialog (hDlg, LOWORD(wp)); + break; + + case IDC_PRINT: + TCHAR szDir[ MAX_PATH ]; + GetCurrentDirectory (MAX_PATH, szDir); + ShellExecute (hDlg, TEXT("print"), (LPTSTR)GetWindowLong (hDlg, DWL_USER), NULL, szDir, SW_HIDE); + break; + } + break; + } + return FALSE; +} + +BOOL FindAfsInstallationPathByComponent (LPTSTR pszInstallationPath, LPTSTR pszComponent) +{ + *pszInstallationPath = 0; + + TCHAR szRegPath[ MAX_PATH ]; + wsprintf (szRegPath, TEXT("Software\\TransarcCorporation\\%s\\CurrentVersion"), pszComponent); + + HKEY hk; + if (RegOpenKey (HKEY_LOCAL_MACHINE, szRegPath, &hk) == 0) { + DWORD dwType = REG_SZ; + DWORD dwSize = MAX_PATH; + + if (RegQueryValueEx (hk, TEXT("PathName"), NULL, &dwType, (PBYTE)pszInstallationPath, &dwSize) == 0) { + *(LPTSTR)FindBaseFileName (pszInstallationPath) = TEXT('\0'); + + if (pszInstallationPath[0] && (pszInstallationPath[ lstrlen(pszInstallationPath)-1 ] == TEXT('\\'))) + pszInstallationPath[ lstrlen(pszInstallationPath)-1 ] = TEXT('\0'); + } + + RegCloseKey (hk); + } + + return !!*pszInstallationPath; +} + +BOOL FindAfsInstallationPath (LPTSTR pszInstallationPath) +{ + if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Client"))) + return TRUE; + if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Control Center"))) + return TRUE; + if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Server"))) + return TRUE; + if (FindAfsInstallationPathByComponent (pszInstallationPath, TEXT("AFS Supplemental Documentation"))) + return TRUE; + return FALSE; +} + +HINSTANCE LoadRichTextControl (void) +{ + HINSTANCE hInst; + if ((hInst = LoadLibrary ("riched20.dll")) != NULL) + return hInst; + if ((hInst = LoadLibrary ("riched32.dll")) != NULL) + return hInst; + if ((hInst = LoadLibrary ("riched.dll")) != NULL) + return hInst; + if ((hInst = LoadLibrary ("richedit.dll")) != NULL) + return hInst; + return NULL; +} + +int SUCALLCONV ShowLicense (char *pszTarget, char *pszSource) +{ + // If the license already lives on this user's machine, don't show + // it again. This only has to be done if the user has never + // accepted the license agreement before (it's part of the setup + // program, so it gets installed if they've accepted it). + // + // We were handed a relative path of the form: + // Documentation/html/license.rtf + // + // We'll need to find the AFS installation directory, in order to + // find that Documentation subtree. + // + BOOL fShowLicense = TRUE; + + TCHAR szInstallationPath[ MAX_PATH ]; + if (FindAfsInstallationPath (szInstallationPath)) { + TCHAR szLicensePath[ MAX_PATH ]; + wsprintf (szLicensePath, TEXT("%s\\%s"), szInstallationPath, pszTarget); + + if (GetFileAttributes (szLicensePath) != (DWORD)-1) { + fShowLicense = FALSE; + } + } + + // Before we can show the license file, we have to prepare the RichEdit + // control. That means loading the appropriate library and calling its + // initialization functions. + // + HINSTANCE hRichEdit; + if ((hRichEdit = LoadRichTextControl()) != NULL) { + + // If we must show the license, do so now. This is a modal dialog, + // so we'll know whether or not the user accepts the license. + // + if (ModalDialogParam (IDD_LICENSE, GetActiveWindow(), License_DlgProc, (LPARAM)pszSource) == IDCANCEL) { + // The user rejected the license; fail setup + return FALSE; + } + + FreeLibrary (hRichEdit); + } + + // The user accepted the license, so we can continue with Setup. + // The license file is installed as part of Setup. + return TRUE; +} + +int SUCALLCONV UninstInitialize(HWND hIS, HINSTANCE hIS5, long Reserved) +{ + char szPath[MAX_PATH]; + struct APPINFO *pAppInfo; + char *pszFile = 0; + char *pszSubDir = 0; + + hDlg = hIS; + + bSilentMode = !IsWindowVisible(hIS); + + // Which app are we uninstalling? + pAppInfo = GetApp(); + if (!pAppInfo) { + ShowError(IDS_CANT_DETERMINE_PRODUCT, 0); + return -1; + } + + // Get the app's install dir + pszInstallDir = GetAppInstallDir(pAppInfo, FALSE); + if (!pszInstallDir) + return -1; + + // If this app has a custom uninstall func, call it here + if (pAppInfo->pUninstallFunc) + if (!pAppInfo->pUninstallFunc()) + return -1; + + if (pAppInfo->pszRegKeysToPreserve) + if (!PreserveConfigInfo(pAppInfo)) + return -1; + + // Unconfigure the service, if there is one for this app + if (pAppInfo->pszSvcKey) { + if (IsServiceInstalled(pAppInfo->pszSvcKey)) + if (UninstallService(pAppInfo) == 1) + return -1; + } + + RememberInstallDir(pszInstallDir); + + DeleteInUseFiles(pAppInfo, fileInfo); + + // Remove the app's bin path from the system path + if (pAppInfo->pszBinPath) { + BuildShortPath(szPath, sizeof(szPath), pszInstallDir, pAppInfo->pszBinPath); + RemoveFromPath(szPath); + } + + // Remove entry from NetworkProvider\Order key in registry + if (pAppInfo->pszNetworkProviderOrder) + RemoveFromNetworkProviderOrder(pAppInfo->pszNetworkProviderOrder); + + // Remove any generated subdirectories + if (!bPreserveConfigInfo && pAppInfo->pszDirsToDel) { + for (pszSubDir = pAppInfo->pszDirsToDel; *pszSubDir; pszSubDir += strlen(pszSubDir) + 1) + RemoveDir(ExpandPath(pszSubDir)); + } + + // Remove any generated files + if (!bPreserveConfigInfo && pAppInfo->pszFilesToDel) { + for (pszFile = pAppInfo->pszFilesToDel; *pszFile; pszFile += strlen(pszFile) + 1) + RemoveFiles(ExpandPath(pszFile)); + } + + // Remove any registry values that IS can't handle + RemoveRegValues(pAppInfo->pRegValues); + if (IsWinNT()) + RemoveRegValues(pAppInfo->pWinNTRegValues); + else + RemoveRegValues(pAppInfo->pWin9XRegValues); + + // Remove the start menu entries for this app + if (pAppInfo->pszStartMenuEntries) { + DeleteStartMenuEntries(pAppInfo->pszStartMenuEntries); + RefreshStartMenu(); + } + + // Remove the install dir + RemoveDirectory(pszInstallDir); + + return 0; +} + +void SUCALLCONV UninstUnInitialize(HWND hIS, HINSTANCE hIS5, long Reserved) +{ + char *pszInstallDir; + char szDirPath[MAX_PATH]; + char *psz; + struct APPINFO *pAppInfo; + + // If we just uninstalled the last AFS app, then do some cleanup. + if (IsAppInstalled(&appServer) || IsAppInstalled(&appClient) || + IsAppInstalled(&appControlCenter) || IsAppInstalled(&appLightClient) || + IsAppInstalled(&appDocs)) + { + return; + } + + bSilentMode = !IsWindowVisible(hIS); + + // Which app did we just uninstall? + pAppInfo = GetApp(); + if (!pAppInfo) { + ShowError(IDS_CANT_DETERMINE_PRODUCT, 0); + return; + } + + // Get the app's install dir + pszInstallDir = GetAppInstallDir(pAppInfo, TRUE); + if (!pszInstallDir) + return; + + // Remove the reg key we used to remember the app install dir + RegDeleteEntryAlt(UNINSTALL_TEMP_INFO_KEY, REGENTRY_KEY); + + // Try to remove the reg key used to store config info, but only + // if there are no app config info sub keys present. + if (!DoSubKeysExist(AFS_PRESERVED_CFG_INFO_KEY)) + RegDeleteEntryAlt(AFS_PRESERVED_CFG_INFO_KEY, REGENTRY_KEY); + + // Remove the install dir + RemoveDirectory(pszInstallDir); + + // Attempt to remove the install root and common directories. The are + // shared and so no single app knows to delete them. + + // Strip off the app specific part of the install dir + psz = strrchr(pszInstallDir, '\\'); + if (psz) + *psz = 0; + + sprintf(szDirPath, "%s\\%s", pszInstallDir, "Common"); + RemoveDirectory(szDirPath); + + // Remove the Common directory from the system path + RemoveFromPath(szDirPath); + + // Remove all of the documentation dirs + sprintf(szDirPath, "%s\\%s", pszInstallDir, "Documentation"); + RemoveDirectoryTree(szDirPath); + + // Ok, up to this point we have been removing files we know we + // created. However, after this point we are into the path + // that the user chose for our install root. The default for + // this is IBM/Afs, but they could have chosen anything, + // including a dir or dirs that have other products in them. + // We will check to see if it is IBM\AFS and if it is then we + // will attempt to remove them. + + // Back up a level and look for AFS + psz = strrchr(pszInstallDir, '\\'); + if (psz) { + if (stricmp(psz + 1, "AFS") == 0) { + RemoveDirectory(pszInstallDir); + *psz = 0; + } + } + + // Back up a level and look for IBM + psz = strrchr(pszInstallDir, '\\'); + if (psz) { + if (stricmp(psz + 1, "IBM") == 0) { + RemoveDirectory(pszInstallDir); + *psz = 0; + } + } + + // Remove the root afs start menu entry + psz = GetStartMenuRoot(); + if (psz) { + if (bSilentMode) { + // Remove everything under our branch + sprintf(szDirPath, "%s\\IBM WebSphere\\Performance Pack\\AFS", psz); + RemoveDirectoryTree(szDirPath); + + // Remove the IBM stuff only if the dirs are empty + sprintf(szDirPath, "%s\\IBM WebSphere\\Performance Pack", psz); + if (RemoveDirectory(szDirPath)) { + sprintf(szDirPath, "%s\\IBM WebSphere", psz); + RemoveDirectory(szDirPath); + } + } else { + sprintf(szDirPath, "%s\\IBM AFS", psz); + RemoveDirectoryTree(szDirPath); + } + } +} + +BOOLEAN _stdcall DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) +{ + if (reason == DLL_PROCESS_ATTACH) { + hinst = (HINSTANCE)dll; + TaLocale_LoadCorrespondingModuleByName (hinst, "afs_setup_utils.dll"); + } + + return TRUE; +} + +extern "C" int WINAPI Test (HINSTANCE hInst, HINSTANCE hPrev, LPSTR psz, int nCmdShow) +{ + ShowLicense ("TEST", "\\\\fury\\afssetup\\license\\ja_JP.rtf"); + return 0; +} + + diff --git a/src/WINNT/afsclass/NTMakefile b/src/WINNT/afsclass/NTMakefile index 3fc4285de..52b578d2e 100644 --- a/src/WINNT/afsclass/NTMakefile +++ b/src/WINNT/afsclass/NTMakefile @@ -61,3 +61,5 @@ primary: $(LIBINCLUDES) $(LIBFILE) $(LIBFILE): $(LIBOBJS) $(LIBARCH) +clean:: + diff --git a/src/WINNT/afsclass/afsclassfn.cpp b/src/WINNT/afsclass/afsclassfn.cpp index 736c922f3..850a7962d 100644 --- a/src/WINNT/afsclass/afsclassfn.cpp +++ b/src/WINNT/afsclass/afsclassfn.cpp @@ -398,7 +398,7 @@ BOOL AfsClass_RestartService (LPIDENT lpiRestart, ULONG *pStatus) lpServer->Close(); } - BOOL fRestartAll; + BOOL fRestartAll = FALSE; if (!lpiRestart->fIsService()) fRestartAll = TRUE; diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 2801464e1..f00938a4b 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -425,7 +425,7 @@ int SRXAFSCB_GetCellServDB( t_name = (char *)malloc(AFSNAMEMAX); t_name[0] = '\0'; *a_name = t_name; - bzero(a_hosts, AFSMAXCELLHOSTS * sizeof(afs_int32)); + memset(a_hosts, 0, AFSMAXCELLHOSTS * sizeof(afs_int32)); return 0; } diff --git a/src/WINNT/afsd/cm_utils.c b/src/WINNT/afsd/cm_utils.c index e18654adf..f7e3284c0 100644 --- a/src/WINNT/afsd/cm_utils.c +++ b/src/WINNT/afsd/cm_utils.c @@ -129,6 +129,7 @@ cm_space_t *cm_GetSpace(void) cm_spaceListp = tsp->nextp; } else tsp = (cm_space_t *) malloc(sizeof(cm_space_t)); + (void) memset(tsp, 0, sizeof(cm_space_t)); lock_ReleaseWrite(&cm_utilsLock); return tsp; diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 985c44400..1ad8aaf12 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -2664,7 +2664,7 @@ static afs_int32 GetCryptCmd(as) if (code) Die(code, (char *) 0); else { tp = space; - bcopy(tp, &flag, sizeof(afs_int32)); + memcpy(&flag, tp, sizeof(afs_int32)); printf("Security level is currently "); if (flag == 1) printf("crypt (data security).\n"); diff --git a/src/WINNT/afsd/krb.h b/src/WINNT/afsd/krb.h index 6b24bb8bc..cf8f0ddba 100644 --- a/src/WINNT/afsd/krb.h +++ b/src/WINNT/afsd/krb.h @@ -175,7 +175,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +10,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +12,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +14,((char *) _krb_swap_tmp) +0 ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,16);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 16);\ } #define swap_u_12(x) {\ @@ -186,7 +186,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +6, ((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +8, ((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +10,((char *) _krb_swap_tmp) +0 ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,12);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 12);\ } #define swap_C_Block(x) {\ @@ -195,7 +195,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) x) +2,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) x) +4,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) x) +6,((char *) _krb_swap_tmp) ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)x,8);\ + memcpy((char *)x, (char *)_krb_swap_tmp, 8);\ } #define swap_u_quad(x) {\ unsigned long _krb_swap_tmp[4];\ @@ -203,7 +203,7 @@ typedef struct ktext KTEXT_ST; swab(((char *) &x) +2,((char *) _krb_swap_tmp) +4 ,2); \ swab(((char *) &x) +4,((char *) _krb_swap_tmp) +2 ,2); \ swab(((char *) &x) +6,((char *) _krb_swap_tmp) ,2); \ - bcopy((char *)_krb_swap_tmp,(char *)&x,8);\ + memcpy((char *)&x, (char *)_krb_swap_tmp, 8);\ } #define swap_u_long(x) {\ diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 9e06d8822..3b1722d85 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -149,6 +149,10 @@ void smb_IoctlPrepareWrite(smb_fid_t *fidp, smb_ioctl_t *ioctlp) if (!ioctlp->inAllocp) ioctlp->inAllocp = malloc(SMB_IOCTL_MAXDATA); if (!ioctlp->outAllocp) ioctlp->outAllocp = malloc(SMB_IOCTL_MAXDATA); + /* Fixes fs la problem. We do a StrToOEM later and if this data isn't initialized we get memory issues. */ + (void) memset(ioctlp->inAllocp, 0, SMB_IOCTL_MAXDATA); + (void) memset(ioctlp->outAllocp, 0, SMB_IOCTL_MAXDATA); + /* and make sure that we've reset our state for the new incoming request */ if (!(ioctlp->flags & SMB_IOCTLFLAG_DATAIN)) { ioctlp->inCopied = 0; diff --git a/src/WINNT/install/InstallShield5/BuildSetup.bat b/src/WINNT/install/InstallShield5/BuildSetup.bat index cf019000b..546fac3aa 100644 --- a/src/WINNT/install/InstallShield5/BuildSetup.bat +++ b/src/WINNT/install/InstallShield5/BuildSetup.bat @@ -14,11 +14,11 @@ Set SavePath=%Path% Path %IS5ROOT%\Program;%PATH% -ISbuild -p"%AFSROOT%\src\WINNT\install\InstallShield5" -m"Transarc AFS" +ISbuild -p"%AFSROOT%\src\WINNT\install\InstallShield5" -m"OpenAFS" -if not exist "Media\Transarc AFS\Disk Images\disk1" goto nocopylicense -mkdir "Media\Transarc AFS\Disk Images\disk1\License" -copy ..\..\license\lang\*.rtf "Media\Transarc AFS\Disk Images\disk1\License" +if not exist "Media\OpenAFS\Disk Images\disk1" goto nocopylicense +mkdir "Media\OpenAFS\Disk Images\disk1\License" +copy ..\..\license\lang\*.rtf "Media\OpenAFS\Disk Images\disk1\License" :nocopylicense If errorlevel 1 goto BuildErrorOccurred diff --git a/src/WINNT/install/InstallShield5/CreateGeneratedFiles.bat b/src/WINNT/install/InstallShield5/CreateGeneratedFiles.bat index 40f8ae8d1..25df3c728 100644 --- a/src/WINNT/install/InstallShield5/CreateGeneratedFiles.bat +++ b/src/WINNT/install/InstallShield5/CreateGeneratedFiles.bat @@ -15,6 +15,6 @@ call GenIS5.ipr.bat cd File Groups rem This next file must run using cmd.exe cmd /c GenFileGroups.bat -cd ..\Media\Transarc AFS +cd ..\Media\OpenAFS call GenDefault.mda.bat cd ..\.. diff --git a/src/WINNT/install/InstallShield5/CreateISDirTree.bat b/src/WINNT/install/InstallShield5/CreateISDirTree.bat index b7f8138e7..648a9e009 100644 --- a/src/WINNT/install/InstallShield5/CreateISDirTree.bat +++ b/src/WINNT/install/InstallShield5/CreateISDirTree.bat @@ -14,7 +14,7 @@ echo Creating the IS dir tree... if not exist "Component Definitions" mkdir "Component Definitions" if not exist "File Groups" mkdir "File Groups" if not exist Media mkdir Media -if not exist "Media\Transarc AFS" mkdir "Media\Transarc AFS" +if not exist "Media\OpenAFS" mkdir "Media\OpenAFS" if not exist "Registry Entries" mkdir "Registry Entries" if not exist "Script Files" mkdir "Script Files" if not exist "Setup Files" mkdir "Setup Files" diff --git a/src/WINNT/install/InstallShield5/Default.shl b/src/WINNT/install/InstallShield5/Default.shl index 8df938577..310191c80 100644 --- a/src/WINNT/install/InstallShield5/Default.shl +++ b/src/WINNT/install/InstallShield5/Default.shl @@ -271,6 +271,11 @@ Entry102=SERVER_GROUP_NAME Entry103=CLIENT_GROUP_NAME Entry104=CCENTER_GROUP_NAME Entry105=LIGHT_GROUP_NAME +Entry106=CELLNAME_DEFAULT +Entry107=WELCOME_MESSAGE +Entry108=CELLSERVDB_WEB +Entry109=CELLSERVDB_INSTALL +Entry110=CELLSERVDB_CONFIGNAME [CONFIGURING_AFS_CREDS] Comment= @@ -432,3 +437,18 @@ Comment= [LIGHT_GROUP_NAME] Comment= +[CELLNAME_DEFAULT] +Comment=Default Cell name + +[WELCOME_MESSAGE] +Comment=Display in Welcome Box + +[CELLSERVDB_WEB] +Comment=Web address to load cellservdb + +[CELLSERVDB_INSTALL] +Comment=Source file for installable Cellservdb + +[CELLSERVDB_CONFIGNAME] +Comment=Cellservdb file name + diff --git a/src/WINNT/install/InstallShield5/GatherFiles.bat b/src/WINNT/install/InstallShield5/GatherFiles.bat index 27dcbfe5b..1c3bd5634 100644 --- a/src/WINNT/install/InstallShield5/GatherFiles.bat +++ b/src/WINNT/install/InstallShield5/GatherFiles.bat @@ -15,7 +15,7 @@ copy "Component Definitions\Default.fgl" . copy "File Groups\Default.fdf" . copy "File Groups\GenFileGroups.bat" . -copy "Media\Transarc AFS\GenDefault.mda.bat" . +copy "Media\OpenAFS\GenDefault.mda.bat" . copy "Registry Entries\Default.rge" . @@ -23,6 +23,9 @@ copy "Script Files\setup.rul" . copy "Setup Files\Uncompressed Files\Language Independent\OS Independent\setup.bmp" . + +copy "Setup Files\Uncompressed Files\Language Independent\OS Independent\_isuser.dll" . + copy "Shell Objects\Default.shl" .\Default.shell copy "String Tables\Default.shl" . diff --git a/src/WINNT/install/InstallShield5/GenDefault.mda.bat b/src/WINNT/install/InstallShield5/GenDefault.mda.bat index 5c4e1aef3..9f4db547b 100644 --- a/src/WINNT/install/InstallShield5/GenDefault.mda.bat +++ b/src/WINNT/install/InstallShield5/GenDefault.mda.bat @@ -19,12 +19,12 @@ echo [GeneralInfo] >> default.mda echo MEDIATYPE=CDROM >> default.mda echo DATAASFILES=No >> default.mda echo BUILDTYPE=Full >> default.mda -echo BuildLocation=Media\Transarc AFS >> default.mda +echo BuildLocation=Media\OpenAFS >> default.mda echo BREAKBYTOPCOMPONENT=No >> default.mda echo REFRESH_DATAFILES=Yes >> default.mda echo REFRESH_SPLASH=Yes >> default.mda echo BUILDSIZE= >> default.mda -echo Name=AFS for Windows >> default.mda +echo Name=OpenAFS for Windows >> default.mda echo REVIEWREPORT=No >> default.mda echo REFRESH_IFILES=Yes >> default.mda echo PASSWORD= >> default.mda @@ -32,7 +32,7 @@ echo. >> default.mda echo [SetupInfo] >> default.mda echo ENABLELANGDLG=Yes >> default.mda echo ALTERNATEISDELETENAME= >> default.mda -echo APPLICATIONNAME=AFS for Windows >> default.mda +echo APPLICATIONNAME=OpenAFS for Windows >> default.mda echo HIDESTATUSBAR=No >> default.mda echo WIN32SENABLE=No >> default.mda echo. >> default.mda @@ -59,8 +59,8 @@ echo count=8 >> default.mda echo. >> default.mda echo [TagFileInfo] >> default.mda echo PRODUCTCATEGORY=System Tool >> default.mda -echo APPLICATIONNAME=AFS for Windows >> default.mda -echo COMPANYNAME=Transarc Corpration >> default.mda +echo APPLICATIONNAME=OpenAFS for Windows >> default.mda +echo COMPANYNAME=OpenAFS >> default.mda echo VERSION=1.00.000 >> default.mda -echo INFO= >> default.mda +echo INFO=http://www.openafs.org >> default.mda diff --git a/src/WINNT/install/InstallShield5/GenFileGroups.bat b/src/WINNT/install/InstallShield5/GenFileGroups.bat index 06b4fe2b1..6978f6685 100644 --- a/src/WINNT/install/InstallShield5/GenFileGroups.bat +++ b/src/WINNT/install/InstallShield5/GenFileGroups.bat @@ -69,7 +69,7 @@ echo Version=1.00.000 >> Client_Common_Files.fgl rem -------------- Client_WinDir_Files.fgl ----------------------------- echo [TopDir] > Client_WinDir_Files.fgl -echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Client_WinDir_Files.fgl +rem echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Client_WinDir_Files.fgl echo. >> Client_WinDir_Files.fgl echo [General] >> Client_WinDir_Files.fgl echo Type=FILELIST >> Client_WinDir_Files.fgl @@ -145,7 +145,7 @@ echo Version=1.00.000 >> Light_Client_Common_Files.fgl rem -------------- Light_Client_WinDir_Files.fgl ----------------------- echo [TopDir] > Light_Client_WinDir_Files.fgl -echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Light_Client_WinDir_Files.fgl +rem echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Light_Client_WinDir_Files.fgl echo. >> Light_Client_WinDir_Files.fgl echo [General] >> Light_Client_WinDir_Files.fgl echo Type=FILELIST >> Light_Client_WinDir_Files.fgl @@ -201,7 +201,7 @@ echo Version=1.00.000 >> Light95_Client_Common_Files.fgl rem -------------- Light95_Client_WinDir_Files.fgl ----------------------- echo [TopDir] > Light95_Client_WinDir_Files.fgl -echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Light95_Client_WinDir_Files.fgl +rem echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Light95_Client_WinDir_Files.fgl echo. >> Light95_Client_WinDir_Files.fgl echo [General] >> Light95_Client_WinDir_Files.fgl echo Type=FILELIST >> Light95_Client_WinDir_Files.fgl @@ -324,7 +324,7 @@ echo Version=1.00.000 >> Control_Center_Common_Files.fgl rem -------------- Control_Center_WinDir_Files.fgl --------------------- echo [TopDir] > Control_Center_WinDir_Files.fgl -echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Control_Center_Windir_Files.fgl +rem echo file0=%IS5_DEST%\root.client\usr\vice\etc\afsdcell.ini >> Control_Center_Windir_Files.fgl echo. >> Control_Center_WinDir_Files.fgl echo [General] >> Control_Center_WinDir_Files.fgl echo Type=FILELIST >> Control_Center_WinDir_Files.fgl diff --git a/src/WINNT/install/InstallShield5/GenIS5.ipr.bat b/src/WINNT/install/InstallShield5/GenIS5.ipr.bat index d1c38b337..312e22a0a 100644 --- a/src/WINNT/install/InstallShield5/GenIS5.ipr.bat +++ b/src/WINNT/install/InstallShield5/GenIS5.ipr.bat @@ -20,9 +20,9 @@ echo [OperatingSystem] >> InstallShield5.ipr echo OSSupport=0000000000010000 >> InstallShield5.ipr echo. >> InstallShield5.ipr echo [Data] >> InstallShield5.ipr -echo CurrentMedia=Transarc AFS >> InstallShield5.ipr +echo CurrentMedia=OpenAFS >> InstallShield5.ipr echo set_mifserial= >> InstallShield5.ipr -echo ProductName=AFS for Windows >> InstallShield5.ipr +echo ProductName=OpenAFS for Windows >> InstallShield5.ipr echo CurrentComponentDef=Default.cdf >> InstallShield5.ipr echo set_dlldebug=No >> InstallShield5.ipr echo AppExe= >> InstallShield5.ipr @@ -55,13 +55,13 @@ echo set_compileb4build=No >> InstallShield5.ipr echo set_crc=Yes >> InstallShield5.ipr echo set_maxwarn=50 >> InstallShield5.ipr echo Description=Description.txt >> InstallShield5.ipr -echo CompanyName=Transarc Corpration >> InstallShield5.ipr +echo CompanyName=OpenAFS >> InstallShield5.ipr echo CurrentLanguage=English >> InstallShield5.ipr echo. >> InstallShield5.ipr echo [MediaInfo] >> InstallShield5.ipr -echo mediadata0=Transarc AFS/Media\Transarc AFS >> InstallShield5.ipr +echo mediadata0=OpenAFS/Media\OpenAFS >> InstallShield5.ipr echo. >> InstallShield5.ipr echo [General] >> InstallShield5.ipr echo Type=INSTALLMAIN >> InstallShield5.ipr -echo Version=1.10.000 >> InstallShield5.ipr +echo Version=1.20.000 >> InstallShield5.ipr diff --git a/src/WINNT/install/InstallShield5/HowToSetTheVersion.txt b/src/WINNT/install/InstallShield5/HowToSetTheVersion.txt index ad3ba1cd1..70537ce79 100755 --- a/src/WINNT/install/InstallShield5/HowToSetTheVersion.txt +++ b/src/WINNT/install/InstallShield5/HowToSetTheVersion.txt @@ -1,127 +1,30 @@ Copyright 2000, International Business Machines Corporation and others. All Rights Reserved. - This software has been released under the terms of the IBM Public License. For details, see the LICENSE file in the top-level source directory or online at http://www.openafs.org/dl/license10.html - HOW TO SET THE AFS FOR WINDOWS VERSION INFORMATION +Set AFSPRODUCT_VERSION in the following files: +src\config\NTMakefile.i386_win95 +src\config\NTMakefile.i386_nt40 -DECIDE WHAT THE VERSION INFO SHOULD BE - -First decide what the version information should be. There are -the following values that will need to be set: - -MajorVersion -MinorVersion -PatchLevel -BetaLevel -ReleaseType -Title (called VersionString in the registry) - -MajorVersion is the first number in a dotted version scheme. For -example, if the version is 3.5, then MajorVersion is set to 3. - -MinorVersion is the second number in a dotted version scheme. For -example, if the version is 3.5, then MinorVersion is set to 5. - -PatchLevel is an integer number representing the patch level. If -the patch level is 4, then PatchLevel is set to 400. If the patch -level is 3.32, then PatchLevel is set to 332. The reason patch -numbers aren't just 1, 2, etc., is that they are currently set to -the cml configuration number of the build used to produce the patch. -We may later switch to just making the patch level a single digit, -in which case the PatchLevel value must be set to something big -enough so that in a comparison with the old patch levels, it will -evaluate as bigger. So if you want a patch level of 4, use a -PatchLevel setting of 400. If this is not a patch release, then -set PatchLevel to 0. - -BetaLevel is an integer number representing the beta level. This is -just a way to have multiple beta releases. So if this is the first -beta release, set BetaLevel to 1. If this is not a beta release, -then set BetaLevel to 0. - -ReleaseType is kind of redundant; it is set to the string "GA" if -this is a non-beta release and "Beta" if this is a beta release. - -Title is the product version as a full string. So if this is -release 3.5 3.22, then Title is set to "3.5 3.22". If this is -3.6 Beta 2, then Title is set to "3.6 Beta 2". - -Title is used when showing the version to the user, like, for -example, in the afs creds tool. - -************************* NOTE ****************************** -You MUST set all of these values correctly and in a consistent -manner from one release to the next so that the installer can -properly determine whether to perform upgrades, downgrades, or -reinstalls. - -Look at the function CompareVersions in file setup.rul to see -how these values are used to make version info decisions. - - -SET THE VERSION IN THE INSTALLSHIELD FILES - -You will need to edit the following InstallShield files: - -value.shl: - -This file contains all of the strings used by the program. Set -all of the following identifiers to the new version number: - -TITLE_MAIN -UNINST_DISPLAY_NAME_CC -UNINST_DISPLAY_NAME_CLIENT -UNINST_DISPLAY_NAME_DOCS -UNINST_DISPLAY_NAME_LIGHT_CLIENT -UNINST_DISPLAY_NAME_SERVER - -These identifiers below correspond to the version information -discussed in the first section above. - -PRODUCT_VERSION_MAJOR -PRODUCT_VERSION_MINOR -PRODUCT_VERSION_PATCH_LEVEL -PRODUCT_VERSION_BETA_LEVEL -PRODUCT_VERSION_RELEASE_TYPE -PRODUCT_VERSION_TITLE - -Default.rge: - -This file contains information that will be written to the registry -at install time. - -Change all occurances of the following to the proper verison info: - -MajorVersion (set to same value as PRODUCT_VERSION_MAJOR in value.shl) -MinorVersion (set to same value as PRODUCT_VERSION_MINOR in value.shl) -PatchLevel (set to same value as PRODUCT_VERSION_PATCH_LEVEL in value.shl) -BetaLevel (set to same value as PRODUCT_VERSION_BETA_LEVEL in value.shl) -ReleaseType (set to same value as PRODUCT_RELEASE_TYPE in value.shl) -VersionString (set to same value as PRODUCT_VERSION_TITLE in value.shl) - -Finally, change any string matching the form below to have the new verison -info: - -HKLMn=Software\TransarcCorporation\Product Name\Version - -For example, one such string may be: +The format of this variable should be +x.y.z.p or x.y.z p -HKLM2=Software\TransarcCorporation\AFS Control Center\3.5 3.32 +x= major verson (1-9) +y= minor verson (1-9) +z.p= patch level z=(1-9) p=(1-99 or a-z) -To update the verison info to 3.6 patch 3, the string would change -to: +For example: +AFSPRODUCT_VERSION=1.1.1 a +AFSPRODUCT_VERSION=1.1.1.1 +AFSPRODUCT_VERSION=1.1.101 +AFSPRODUCT_VERSION=1.1.1a -HKLM2=Software\TransarcCorporation\AFS Control Center\3.6 3 +These examples represent different forms of the same version. +However the version will be displayed to the user as they are shown! -That's it! Build and test the thing, making sure that the version info -in the registry is correct for each app, and that upgrades of previous -versions, downgrades to previous versions from this version, and reinstalls -of this version work correctly. -If you're the poor sucker who had to do this, then I offer you my sympathy! diff --git a/src/WINNT/install/InstallShield5/NTMakefile b/src/WINNT/install/InstallShield5/NTMakefile index c679e5ad7..96d30aa21 100644 --- a/src/WINNT/install/InstallShield5/NTMakefile +++ b/src/WINNT/install/InstallShield5/NTMakefile @@ -8,30 +8,62 @@ !INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME) !INCLUDE ..\..\..\config\NTMakefile.version -############################################################################ - -CELLSERVDB = $(DESTDIR)\root.client\usr\vice\etc\afsdcell.ini +# Install comments +# Don't use '=' in the following strings! +# WELCOMEMESSAGE=Display during installation process +# AFSBUILDCOMMENTS=Displayed in properity page for install file +# CELLSERVDB_CONFIGNAME = name of configuration file (ThisCell) -$(CELLSERVDB): afsdcell.ini - copy $** $@ +CELLSERVDB_CONFIGNAME=afsdcell.ini +WELCOMEMESSAGE=Default Configuration Information:\nBuild:*DatE* *TimE* Ver:$(AFSPRODUCT_VERSION)\nCellname:$(CELLNAME_DEFAULT)\nCellSrvDB:$(CELLSERVDB_INSTALL) +AFSBUILDCOMMENTS=Build:*DatE* *TimE* CellServDB:$(CELLSERVDB_INSTALL) + +############################################################################ -prep: $(CELLSERVDB) AFS_component_version_number.txt +prep: AFS_component_version_number.txt + $(DESTDIR)\bin\util_cr.exe } "$(AFSPRODUCT_VERSION)" ".\lang\en_US\value.txt" ".\lang\en_US\value.shl" + $(DESTDIR)\bin\util_cr.exe } "$(AFSPRODUCT_VERSION)" "default.txt" "default.rge" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\lang\en_US\value.shl" "[DATA] CELLSERVDB_CONFIGNAME=$(CELLSERVDB_CONFIGNAME)" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\lang\en_US\value.shl" "[DATA] CELLNAME_DEFAULT=$(CELLNAME_DEFAULT)" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\lang\en_US\value.shl" "[DATA] CELLSERVDB_INSTALL=$(CELLSERVDB_INSTALL)" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\lang\en_US\value.shl" "[DATA] CELLSERVDB_WEB=$(CELLSERVDB_WEB)" +!IF "$(WELCOMEMESSAGE)" != "" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\lang\en_US\value.shl" "[DATA] WELCOME_MESSAGE=$(WELCOMEMESSAGE)" +!ENDIF +! IF ((EXIST("$(ISWEB)")) &&("$(ISWEB)"!="")) + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Version=$(AFSPRODUCT_VERSION)" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Comments=$(AFSBUILDCOMMENTS)" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] ApplicationName=AFSforWindows" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Company=Open AFS" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Title=AFS for Windows" + $(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] OutputSpec="$(DESTDIR)\WinInstall\PackageWeb\AFSforWindows.exe" +! ENDIF CreateISDirTree.bat ScatterFiles.bat CreateGeneratedFiles.bat CompileScript.bat + $(COPY) $(DESTDIR)\WinInstall\Config\wininet.dll ".\Setup Files\Compressed Files\0009-English\Intel 32\." + $(COPY) $(DESTDIR)\WinInstall\Config\shlwapi.dll ".\Setup Files\Compressed Files\0009-English\Intel 32\." + $(COPY) ..\..\afs_setup_utils\_isuser\_isuser.dll ".\Setup Files\Compressed Files\0009-English\Intel 32\." + $(COPY) ..\..\afs_setup_utils\getwebdll\getwebdll.dll ".\Setup Files\Compressed Files\0009-English\Intel 32\." + $(COPY) $(DESTDIR)\WinInstall\Config\$(CELLSERVDB_INSTALL) ".\Setup Files\Compressed Files\0009-English\Intel 32\$(CELLSERVDB_CONFIGNAME)" + $(DESTDIR)\bin\util_cr.exe ~ ".\Setup Files\Compressed Files\0009-English\Intel 32\$(CELLSERVDB_CONFIGNAME)" + $(DESTDIR)\bin\util_cr.exe ~ ".\Setup Files\Compressed Files\0009-English\Intel 32\_ISUSER.DLL" + $(DESTDIR)\bin\util_cr.exe ~ ".\Setup Files\Compressed Files\0009-English\Intel 32\shlwapi.DLL" + $(DESTDIR)\bin\util_cr.exe ~ ".\Setup Files\Compressed Files\0009-English\Intel 32\wininet.DLL" + $(DESTDIR)\bin\util_cr.exe ~ ".\Setup Files\Compressed Files\0009-English\Intel 32\GETWEBDLL.DLL" build: - BuildSetup.bat - xcopy/s/e/y "Media\Transarc AFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall - copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt - $(DEL) /q "Media\Transarc AFS\Disk Images\disk1\*.*" -!IF ((EXIST("$(ISWEB)")) &&("$(ISWEB)"!="")) + BuildSetup.bat +!IF ((EXIST("$(ISWEB)")) &&("$(ISWEB)"!="")) ! IF (!EXIST($(DESTDIR)\Wininstall\PackageWeb)) $(MKDIR) $(DESTDIR)\Wininstall\PackageWeb ! ENDIF - $(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.* - $(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a -!ENDIF + $(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.* + $(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a +!ENDIF + xcopy/s/e/y "Media\Transarc AFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall + copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt + $(DEL) /q "Media\Transarc AFS\Disk Images\disk1\*.*" install: prep build diff --git a/src/WINNT/install/InstallShield5/ScatterFiles.bat b/src/WINNT/install/InstallShield5/ScatterFiles.bat index fffb4726b..4f2ae6e65 100644 --- a/src/WINNT/install/InstallShield5/ScatterFiles.bat +++ b/src/WINNT/install/InstallShield5/ScatterFiles.bat @@ -16,7 +16,7 @@ copy Default.fgl "Component Definitions" copy Default.fdf "File Groups" copy GenFileGroups.bat "File Groups" -copy GenDefault.mda.bat "Media\Transarc AFS" +copy GenDefault.mda.bat "Media\OpenAFS" copy Default.rge "Registry Entries" @@ -24,6 +24,7 @@ copy setup.rul "Script Files" rem Only copy this file when NOT doing a WSPP build if not defined AFSBLD_IS_WSPP copy setup.bmp "Setup Files\Uncompressed Files\Language Independent\OS Independent" +if not defined AFSBLD_IS_WSPP copy _isuser.dll "Setup Files\Uncompressed Files\Language Independent\OS Independent" copy %AFSROOT%\DEST\root.server\usr\afs\bin\InstallUtils.dll "Setup Files\Compressed Files\Language Independent\OS Independent" copy %AFSROOT%\DEST\root.server\usr\afs\bin\afs_setup_utils_*.dll "Setup Files\Compressed Files\Language Independent\OS Independent" diff --git a/src/WINNT/install/InstallShield5/setup.rul b/src/WINNT/install/InstallShield5/setup.rul index 6c4472191..4be378da3 100644 --- a/src/WINNT/install/InstallShield5/setup.rul +++ b/src/WINNT/install/InstallShield5/setup.rul @@ -1,14 +1,12 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1998 OpenAFS -// All rights reserved. -// + // -// File Name: Setup.rul +// Copyright 2000, International Business Machines Corporation and others. +// All Rights Reserved. // -// Description: InstallShield script +// This software has been released under the terms of the IBM Public +// License. For details, see the LICENSE file in the top-level source +// directory or online at http://www.openafs.org/dl/license10.html // -//////////////////////////////////////////////////////////////////////////////// // Include header files @@ -321,6 +319,745 @@ end; BOOL bPreinstallReplace; +//////////////////////////////////////////////////////////////////////////////// +// +// Function Name: Template +// +// Description: This dialog will show a dialog template which can be +// used for creating any user-defined dialog with the +// Windows 95 look and feel. +// Comments: +// +//////////////////////////////////////////////////////////////////////////////// + +number nvSection,nFileIsLocked; +STRING szTemp,szCellName; + +#define IDC_HOMEPATH 301 +#define IDC_ROOTPATH 302 +#define IDC_HOMEDRIVELIST 1007 +#define IDC_ROOTDRIVELIST 1008 +#define IDC_ENABLEROOT 1010 +#define IDC_ENABLEHOME 1011 +#define IDC_INSTALL 1011 +#define IDC_WEB 1016 +#define IDC_CHECK_INSTALL 1018 +#define IDC_CHECK_WEB 1019 +#define IDC_CHECK_BROWSEFILE 1020 +#define IDC_CHECK_PREVIOUSFILE 1021 +#define IDC_PREVIOUSFILE 1024 +#define IDC_BROWSE 1025 +#define IDC_BROWSEFILE 1026 +#define DLG_TEMPLATE 13029 +#define DLG_DRIVEPATH 13030 +#define DLG_CELLSERVDB 13031 +#define IDC_PATH 13032 + +prototype Logit(STRING); +function Logit(szMsg) +HWND handle; +begin + return; + OpenFileMode(FILE_MODE_APPEND); + if (OpenFile (handle, "y:\\dest", "silent.log") < 0) then + CreateFile(handle,"y:\\dest", "silent.log"); + endif; + WriteLine(handle,szMsg); + CloseFile(handle); +end; + +prototype Logitn(STRING,NUMBER); +function Logitn(szMsg,i) +HWND handle; +STRING sz; +begin + Sprintf(sz,szMsg,i); + Logit(sz); +end; +prototype INT GetWebDll.BrowseFile(NUMBER,BYREF STRING,BYREF STRING,NUMBER); +prototype INT GetWebDll.GetWebPage(BYREF STRING,BYREF STRING,BYREF STRING); +prototype INT GetWebDll.GetUserLogon(BYREF STRING); +prototype SetCellServDB(STRING,BYREF NUMBER,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING); +prototype FormErrorMessage(NUMBER,BYREF STRING); +prototype SetHomeRoot( STRING,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING ); +prototype BOOL getWebCellSrvDB(STRING,STRING); + +prototype BOOL GetDefaultDrive(BYREF NUMBER); +function GetDefaultDrive(listAv) + NUMBER listAc; + NUMBER I,nResult; + STRING item,iitem; +begin + listAc = ListCreate (STRINGLIST); + Enable (STATUS); + SetStatusWindow (50, "Scaning for available Drives..."); + nResult=GetValidDrivesList (listAc, -1,-1); + SetStatusWindow (100, "Completed."); + Delay (2); + if (nResult<0) then + SetStatusWindow(0, ""); + MessageBox ("Scan Drive Error" , SEVERE); + abort; + endif; + SetStatusWindow(0, ""); + listAv = ListCreate (STRINGLIST); + ListAddString(listAv,"None:",AFTER); + ListGetFirstString(listAc, iitem); + for I=67 to 90 + Sprintf(item,"%c",I); + nResult=ListFindString(listAc,item); + if nResult==END_OF_LIST then + ListAddString(listAv,item+":",AFTER); + endif; + ListGetNextString(listAc,iitem); + endfor; + ListDestroy(listAc); + return TRUE; +end; + +function FormErrorMessage(nResult,szResult) +begin + switch(nResult) + case COPY_ERR_CREATEDIR: + szResult=TARGETDIR+ "could not be created. Make sure that you have access rights to the target drive."; + case COPY_ERR_MEMORY: + szResult="The function was unable to allocate the memory required to complete the copy file process. Terminate as many running applications as possible to free memory."; + case COPY_ERR_NODISKSPACE: + szResult="The function could not find enough disk space on "+TARGETDIR+" to copy the files. Free disk space on the target drive."; + case COPY_ERR_OPENINPUT: + szResult="The function was unable to open the input file in "+SRCDIR+". Make sure the source file is a valid filename and that both the source file and target directory exist."; + case COPY_ERR_OPENOUTPUT: + szResult="The function was unable to copy the requested file."; + case COPY_ERR_TARGETREADONLY: + szResult="The file in "+TARGETDIR+" is read-only. Remove the read-only attribute from the target file and try again."; + default: + szResult="Unknown error"; + endswitch; +end; + +function getWebCellSrvDB(szDefaultWeb,szDestFile) + NUMBER nResult; + STRING szFile,szErrMsg,szURL; +begin + szErrMsg=" "; + Enable (STATUS); + SetStatusWindow (50, "Now Downloading CellServDB file..."); + nResult=GetWebPage(szErrMsg,szDestFile,szDefaultWeb); + SetStatusWindow (100, "Downloading completed."); + Delay (2); + if (nResult!=0) then + SetStatusWindow(0, ""); + MessageBox (szErrMsg, INFORMATION); + return FALSE; + endif; + // setup default status + SetStatusWindow(0, ""); + return TRUE; +end; + +// Transfer file to CELLSERVDB +prototype BOOL InstallCellServDB(NUMBER,STRING,STRING); +function InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse) +STRING szFile,svErrorMessage; +begin + switch (DefaultItem) + case IDC_CHECK_WEB: + nResult=getWebCellSrvDB(szDefaultWeb,TARGETDIR^@CELLSERVDB_CONFIGNAME); + case IDC_CHECK_BROWSEFILE: + // open file and copy to area + ParsePath(szFile,szDefaultBrowse,PATH); + SRCDIR=szFile; + ParsePath(szFile,szDefaultBrowse,FILENAME); + nResult=CopyFile ( szFile ,@CELLSERVDB_CONFIGNAME ); + if nResult < 0 then + if nResult = -1 then + MessageBox ( "CopyFile failed with error code -1!", WARNING ); + else + FormErrorMessage(nResult,svErrorMessage); + SprintfBox ( WARNING, "", + "CopyFile failed!\n\nError code: %ld\nMessage text: %s", + nResult, svErrorMessage ); + endif; + nResult=FALSE; + else + nResult=TRUE; + endif; + case IDC_CHECK_INSTALL: //need to delete because install will never overwrite + SRCDIR=SUPPORTDIR; + nResult=CopyFile (@CELLSERVDB_CONFIGNAME,@CELLSERVDB_CONFIGNAME ); + if nResult < 0 then + if nResult = -1 then + MessageBox ( "CopyFile failed with error code -1!", WARNING ); + else + FormErrorMessage(nResult,svErrorMessage); + SprintfBox ( WARNING, "", + "CopyFile failed!\n\nError code: %ld\nMessage text: %s", + nResult, svErrorMessage ); + endif; + nResult=FALSE; + else + nResult=TRUE; + endif; + case IDC_CHECK_PREVIOUSFILE: + nResult=TRUE;// work is done, it will use previous file + default: + nResult=TRUE; + ; + endswitch; + return nResult; +end; + +// Return TRUE if silent mode active +prototype BOOL SilentSetCellServDB(STRING,NUMBER,NUMBER,NUMBER,BYREF STRING,BYREF STRING); +function SilentSetCellServDB(szDlg,option,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse) +STRING svSection,szTemp; +NUMBER nTemp; +begin + switch (option) + case 0: //READ function + if (MODE!=SILENTMODE) then + return FALSE; + endif; + SdMakeName( svSection, szDlg, "", nvSection ); + SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult); + if (nResult!=NEXT) then + return TRUE; + endif; + SilentReadData( svSection, "DefaultItem", DATA_NUMBER,szTemp,DefaultItem); + SilentReadData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp); + SilentReadData( svSection, "szDefaultBrowse", DATA_STRING,szDefaultBrowse,nTemp ); + if (InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE) then + nResult=CANCEL; + else + nResult=NEXT; + endif; + return TRUE; + default: //write + SdMakeName( svSection, szDlg, "", nvSection ); + SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult ); + SilentWriteData( svSection, "DefaultItem", DATA_NUMBER,szTemp, DefaultItem ); + SilentWriteData( svSection, "szDefaultWeb", DATA_STRING, szDefaultWeb,nTemp ); + SilentWriteData( svSection, "szDefaultBrowse", DATA_STRING, szDefaultBrowse,nTemp ); + return TRUE; + endswitch; +end; + +function SetCellServDB( szTitle,DefaultItem,szPreviousInstall,szDefaultWeb,szDefaultBrowse,szDefaultInstall) +STRING szDlg, szTemp,szResult[256],svErrorMessage,szFile,svSection; +NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult; +INT hwndDlg,hwndItem; + +begin + szDlg = "DLG_CELLSERVDB"; + // record data produced by this dialog + if SilentSetCellServDB(szDlg,0,nResult,DefaultItem,szDefaultWeb,szDefaultBrowse) then + return nResult; + endif; + + // ensure general initialization is complete + if (!bSdInit) then + SdInit(); + endif; + + if (EzDefineDialog( szDlg, "", "", + DLG_CELLSERVDB ) = DLG_ERR) then + return -1; + endif; + + // Loop in dialog until the user selects a standard button + Disable(LOGGING); + VarSave(SRCTARGETDIR); + TARGETDIR=WINDIR; + doagain: + bDone = FALSE; + + while (!bDone) + + nId = WaitOnDialog( szDlg ); + hwndDlg = CmdGetHwndDlg( szDlg ); + + switch(nId) + + case DLG_INIT: + // Initialize List Control + // set file + CtrlSetState (szDlg, DefaultItem,BUTTON_CHECKED); + if !Is(FILE_EXISTS,szPreviousInstall) then + hwndItem = GetDlgItem( hwndDlg, IDC_CHECK_PREVIOUSFILE ); + EnableWindow( hwndItem, FALSE); + endif; + hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE ); + EnableWindow( hwndItem, DefaultItem==IDC_CHECK_PREVIOUSFILE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE ); + EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE ); + EnableWindow( hwndItem, DefaultItem==IDC_CHECK_BROWSEFILE); + hwndItem = GetDlgItem( hwndDlg, IDC_WEB ); + EnableWindow( hwndItem, DefaultItem==IDC_CHECK_WEB); + hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL ); + EnableWindow( hwndItem, DefaultItem==IDC_CHECK_INSTALL); + CtrlSetText (szDlg, IDC_PREVIOUSFILE, szPreviousInstall); + CtrlSetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse); + CtrlSetText (szDlg, IDC_WEB, szDefaultWeb); + CtrlSetText (szDlg, IDC_INSTALL, szDefaultInstall); + + SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct ); + + //This function sets the caption for old style dialogs or + //sets the text in the top banner area of win2k style dialogs +// SdSetDlgTitle(szDlg, hwndDlg, szTitle); //Version 6.0 only + + case OK: + nId = NEXT; + bDone = TRUE; + + case BACK: + nId = BACK; + bDone = TRUE; + + case DLG_ERR: + SdError( -1, "DLG_CELLSERVDB" ); + nId = -1; + bDone = TRUE; + + case DLG_CLOSE: + SdCloseDlg( hwndDlg, nId, bDone ); + + case IDC_BROWSE: + szResult=szDefaultBrowse; + szTitle="Select file to be used for CellServDB"; + nResult=BrowseFile(hwndDlg,szTitle,szResult,256); + CtrlSetText (szDlg, IDC_BROWSEFILE, szResult); + szDefaultBrowse=szResult; + + case IDC_CHECK_BROWSEFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE ); + EnableWindow( hwndItem, TRUE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE ); + EnableWindow( hwndItem, TRUE); + CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED); + CtrlSetState (szDlg, nId,BUTTON_CHECKED); + switch (DefaultItem) + case IDC_CHECK_WEB: + hwndItem = GetDlgItem( hwndDlg, IDC_WEB ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_PREVIOUSFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_INSTALL: + hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL); + EnableWindow( hwndItem, FALSE); + default: + ; + endswitch; + DefaultItem=nId; + case IDC_CHECK_INSTALL: + hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL ); + EnableWindow( hwndItem, TRUE); + CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED); + CtrlSetState (szDlg, nId,BUTTON_CHECKED); + switch (DefaultItem) + case IDC_CHECK_BROWSEFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE ); + EnableWindow( hwndItem, FALSE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_WEB: + hwndItem = GetDlgItem( hwndDlg, IDC_WEB ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_PREVIOUSFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE ); + EnableWindow( hwndItem, FALSE); + default: + ; + endswitch; + DefaultItem=nId; + case IDC_CHECK_WEB: + hwndItem = GetDlgItem( hwndDlg, IDC_WEB ); + EnableWindow( hwndItem, TRUE); + CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED); + CtrlSetState (szDlg, nId,BUTTON_CHECKED); + switch (DefaultItem) + case IDC_CHECK_BROWSEFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE ); + EnableWindow( hwndItem, FALSE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_INSTALL: + hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_PREVIOUSFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE ); + EnableWindow( hwndItem, FALSE); + default: + ; + endswitch; + DefaultItem=nId; + case IDC_CHECK_PREVIOUSFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_PREVIOUSFILE ); + EnableWindow( hwndItem, TRUE); + CtrlSetState (szDlg, DefaultItem,BUTTON_UNCHECKED); + CtrlSetState (szDlg, nId,BUTTON_CHECKED); + switch (DefaultItem) + case IDC_CHECK_BROWSEFILE: + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSE ); + EnableWindow( hwndItem, FALSE); + hwndItem = GetDlgItem( hwndDlg, IDC_BROWSEFILE ); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_INSTALL: + hwndItem = GetDlgItem( hwndDlg, IDC_INSTALL); + EnableWindow( hwndItem, FALSE); + case IDC_CHECK_WEB: + hwndItem = GetDlgItem( hwndDlg, IDC_WEB ); + EnableWindow( hwndItem, FALSE); + default: + ; + endswitch; + DefaultItem=nId; + default: + // check standard handling + if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then + bDone = TRUE; + endif; + endswitch; + + endwhile; + + CtrlGetText (szDlg, IDC_BROWSEFILE, szDefaultBrowse); + CtrlGetText (szDlg, IDC_WEB, szDefaultWeb); + if (nId != NEXT) then + return nId; + endif; + if InstallCellServDB(DefaultItem,szDefaultWeb,szDefaultBrowse)==FALSE then + goto doagain; + endif; + EndDialog( szDlg ); + ReleaseDialog( szDlg ); + VarRestore(SRCTARGETDIR); + Enable(LOGGING); + SdUnInit( ); + // record data produced by this dialog + SilentSetCellServDB(szDlg,1,nId,DefaultItem,szDefaultWeb,szDefaultBrowse); + return nId; +end; + +//////////////////////////////////////////////////////////////////////////////// +// +// Function Name: Template +// +// Description: This dialog will show a dialog template which can be +// used for creating any user-defined dialog with the +// Windows 95 look and feel. +// Comments: +// +//////////////////////////////////////////////////////////////////////////////// + +prototype BOOL GetUser(BYREF STRING); + +function GetUser(sUser) + NUMBER nResult; +begin + sUser=" "; + nResult=GetUserLogon(sUser); + if (nResult!=1) then + sUser=""; + endif; + return (nResult==1); +end; + + +prototype BOOL SetDriveMaps(STRING,STRING,STRING,STRING,STRING); +function SetDriveMaps(szPath,szRootDrive,szRootPath,szHomeDrive,szHomePath) +HWND handle; +begin + VarSave(SRCTARGETDIR); + DeleteFile("afsdsbmt.ini"); + VarRestore(SRCTARGETDIR); + CreateFile(handle, szPath, "afsdsbmt.ini"); + WriteLine(handle, "[AFS Submounts]"); + if (StrLength(szRootDrive)==2) then + WriteLine(handle, "all="+szRootPath); + endif; + if (StrLength(szHomeDrive)==2) then + WriteLine(handle, "home=" + szHomePath); + endif; + WriteLine(handle, "[AFS Mappings]"); + if (StrLength(szRootDrive)>0) then + WriteLine(handle, szRootDrive+"="+szRootPath); + endif; + if (StrLength(szHomeDrive)>0) then + WriteLine(handle, szHomeDrive+"="+szHomePath); + endif; + CloseFile(handle); +end; + +// Return TRUE if silent mode active +prototype BOOL SilentSetHomeRoot(STRING,NUMBER,NUMBER,BYREF STRING,BYREF STRING,BYREF STRING,BYREF STRING); +function SilentSetHomeRoot(szDlg,option,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath) +STRING svSection,szTemp,szTPath,szTShare,szTDrive,szLogname; +NUMBER nTemp,nCount,I; +HWND handle; +begin + Logitn("SilentSetHomeRoot option=%i",option); + switch (option) + case 0: //READ function + if (MODE!=SILENTMODE) then + return FALSE; + endif; // this section is a little more complicated, allowing installation of n mappings + SdMakeName( svSection, szDlg, "", nvSection ); + Logit("SdMakeName="+svSection); + SilentReadData( svSection, "Result", DATA_NUMBER,szTemp,nResult); + Logitn("nResult=%i",nResult); + if (nResult!=NEXT) then + return TRUE; + endif; + Logit("Do count"); + SilentReadData( svSection, "Count", DATA_NUMBER, szTemp,nCount); + Logitn("nCount=%i",nCount); + if nCount==0 then + return TRUE; + endif; + VarSave(SRCTARGETDIR); + TARGETDIR=WINDIR; + DeleteFile("afsdsbmt.ini"); + VarRestore(SRCTARGETDIR); + CreateFile(handle, WINDIR, "afsdsbmt.ini"); + WriteLine(handle, "[AFS Submounts]"); + for I=0 to nCount-1 + Logitn("I=%i",I); + Sprintf(szTemp,"Path_%i",I); + Logit("Path="+szTemp); + SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp); + Logit("TPath="+szTPath); + if (szTPath % "%LOGINNAME%") then + //Replace loginname with actual loging name + nTemp=StrFind(szTPath,"%LOGINNAME%"); + StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath)); + StrSub(szTPath,szTPath,0,nTemp); + if (GetUser(szLogname)) then + szTPath=szTPath+szLogname+szTemp; + endif; + endif; + Sprintf(szTemp,"Share_%i",I); + SilentReadData( svSection, szTemp, DATA_STRING, szTShare,nTemp); + WriteLine(handle, szTShare+"="+szTPath); + endfor; + WriteLine(handle, "[AFS Mappings]"); + for I=0 to nCount-1 + Sprintf(szTemp,"Drive_%i",I); + SilentReadData( svSection, szTemp, DATA_STRING, szTDrive,nTemp); + Sprintf(szTemp,"Path_%i",I); + SilentReadData( svSection, szTemp, DATA_STRING, szTPath,nTemp); + if (szTPath % "%LOGINNAME%") then + //Replace loginname with actual loging name + nTemp=StrFind(szTPath,"%LOGINNAME%"); + StrSub(szTemp,szTPath,nTemp+11,StrLength(szTPath)); + StrSub(szTPath,szTPath,0,nTemp); + if (GetUser(szLogname)) then + szTPath=szTPath+szLogname+szTemp; + endif; + endif; + WriteLine(handle, szTDrive+"="+szTPath); + endfor; + CloseFile(handle); + nResult=NEXT; + return TRUE; + default: //write + SdMakeName( svSection, szDlg, "", nvSection ); + nCount=0; + SilentWriteData( svSection, "Result", DATA_NUMBER,szTemp, nResult ); + if (StrLength(szRootDrive)==2) then + Sprintf(szTemp,"Drive_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,szRootDrive, nTemp );//root drive + Sprintf(szTemp,"Path_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,szRootPath, nTemp );//root drive + Sprintf(szTemp,"Share_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,"all", nTemp );//root drive + nCount++; + endif; + if (StrLength(szHomeDrive)==2) then + Sprintf(szTemp,"Drive_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,szHomeDrive, nTemp );//root drive + Sprintf(szTemp,"Path_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,szHomePath, nTemp );//root drive + Sprintf(szTemp,"Share_%i",nCount); + SilentWriteData( svSection,szTemp, DATA_STRING,"home", nTemp );//root drive + nCount++; + endif; + SilentWriteData( svSection, "Count", DATA_NUMBER,szTemp, nCount ); // only two can be defined through Dialog box + SetDriveMaps(WINDIR,szRootDrive,szRootPath,szHomeDrive,szHomePath); + return TRUE; + endswitch; +end; + +function SetHomeRoot( szTitle,szRootDrive,szRootPath,szHomeDrive,szHomePath ) + +STRING szDlg, szTemp,svSection; +NUMBER bDone, nId, nMessage, nTemp,AvailableDrives,nResult; +INT hwndDlg,hwndItem,hwndItem2; + +begin + szDlg = "DLG_DRIVEPATH"; + + // record data produced by this dialog + Logit("SetHomeRoot"); + if SilentSetHomeRoot(szDlg,0,nResult,szRootDrive,szRootPath,szHomeDrive,szHomePath ) then + return nResult; + endif; + + GetDefaultDrive(AvailableDrives); + // ensure general initialization is complete + if (!bSdInit) then + SdInit(); + endif; + + if (EzDefineDialog( szDlg, "", "", + DLG_DRIVEPATH ) = DLG_ERR) then + return -1; + endif; + + // Loop in dialog until the user selects a standard button + bDone = FALSE; + + while (!bDone) + + nId = WaitOnDialog( szDlg ); + + switch(nId) + + case DLG_INIT: + hwndDlg = CmdGetHwndDlg( szDlg ); + // Initialize List Control + nResult=CtrlSetList( szDlg, IDC_HOMEDRIVELIST, AvailableDrives ); + if (nResult != 0) then + // Handle error from CtrlSetList. + MessageBox ("Unable to create folder name list.", SEVERE); + bDone = TRUE; + endif; + if (CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive)!=0) then + szHomeDrive="None:"; + CtrlSetCurSel(szDlg,IDC_HOMEDRIVELIST,szHomeDrive); + endif; + + nResult=CtrlSetList( szDlg, IDC_ROOTDRIVELIST, AvailableDrives ); + if (nResult != 0) then + // Handle error from CtrlSetList. + MessageBox ("Unable to create folder name list.", SEVERE); + bDone = TRUE; + endif; + if (CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive)!=0) then + szRootDrive="None:"; + CtrlSetCurSel(szDlg,IDC_ROOTDRIVELIST,szRootDrive); + endif; + + nResult=CtrlSetText( szDlg, IDC_ROOTPATH,szRootPath ); + if (nResult != 0) then + MessageBox ("Unable to create szRootPath.", SEVERE); + bDone = TRUE; + endif; + nResult=CtrlSetText( szDlg, IDC_HOMEPATH,szHomePath ); + if (nResult != 0) then + MessageBox ("Unable to create szHomePath.", SEVERE); + bDone = TRUE; + endif; + + CtrlSetState (szDlg, IDC_ENABLEHOME,BUTTON_CHECKED); + CtrlSetState (szDlg, IDC_ENABLEROOT,BUTTON_CHECKED); + SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct ); + + //This function sets the caption for old style dialogs or + //sets the text in the top banner area of win2k style dialogs + case OK: + if (szRootDrive!=szHomeDrive) then + nId = NEXT; + bDone = TRUE; + else + MessageBox("Home and Root drives cannot be the same",WARNING); + endif; + + case BACK: + nId = BACK; + bDone = TRUE; + + case DLG_ERR: + SdError( -1, "DLG_DRIVEPATH" ); + nId = -1; + bDone = TRUE; + + case DLG_CLOSE: + SdCloseDlg( hwndDlg, nId, bDone ); + + case IDC_ENABLEROOT: + + hwndItem = GetDlgItem( hwndDlg, IDC_ROOTDRIVELIST );//get handle of control in custom dialog box + hwndItem2 = GetDlgItem( hwndDlg, IDC_ROOTPATH );//get handle of control in custom dialog box + if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then + EnableWindow( hwndItem2, TRUE); + EnableWindow( hwndItem, TRUE); + else + EnableWindow( hwndItem2, FALSE); + EnableWindow( hwndItem, FALSE); + endif; + case IDC_ENABLEHOME: + hwndItem = GetDlgItem( hwndDlg, IDC_HOMEDRIVELIST );//get handle of control in custom dialog box + hwndItem2 = GetDlgItem( hwndDlg, IDC_HOMEPATH );//get handle of control in custom dialog box + if (CtrlGetState (szDlg, nId)==BUTTON_CHECKED) then + EnableWindow( hwndItem2, TRUE); + EnableWindow( hwndItem, TRUE); + else + EnableWindow( hwndItem2, FALSE); + EnableWindow( hwndItem, FALSE); + endif; + + case IDC_HOMEDRIVELIST: + ; + case IDC_ROOTDRIVELIST: + ; + case IDC_HOMEPATH: + CtrlGetText (szDlg, nId,szHomePath); + + case IDC_ROOTPATH: + CtrlGetText (szDlg, nId,szRootPath); + + default: + // check standard handling + if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then + bDone = TRUE; + endif; + endswitch; + + endwhile; + + CtrlGetCurSel (szDlg, nId, szRootDrive); + if (CtrlGetState (szDlg, IDC_ENABLEROOT)==BUTTON_UNCHECKED) then + szRootDrive="None:"; + endif; + CtrlGetCurSel (szDlg, nId, szHomeDrive); + if (CtrlGetState (szDlg, IDC_ENABLEHOME)==BUTTON_UNCHECKED) then + szHomeDrive="None:"; + endif; + EndDialog( szDlg ); + ReleaseDialog( szDlg ); + + SdUnInit( ); + + // record data produced by this dialog + if (nId==NEXT) then + SilentSetHomeRoot(szDlg,1,nId,szRootDrive,szRootPath,szHomeDrive,szHomePath ); + endif; + ListDestroy (AvailableDrives); + return nId; + +end; + + +// ---- script function prototypes ----- + + + // your script function prototypes + + + /////////////////////////////////////////////////////////////////////////////// // // MAIN PROGRAM @@ -333,26 +1070,40 @@ end; // /////////////////////////////////////////////////////////////////////////////// program + Logit("Begin"); + nvSection=0; Disable( BACKGROUND ); - if (UseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH) < 0) then ShowError(@SETUPUTILS_NOT_FOUND, SEVERE); bInstallAborted = TRUE; goto end_install; endif; - - SetupInstall(); - + Logit("UseDLL1"); + ChangeDirectory (SUPPORTDIR); + if (UseDLL("GetWebDLL.dll") != 0) then + MessageBox ("DLL failed.\n\nCouldn't load"+SUPPORTDIR^"GetWebDLL.dll", INFORMATION); + abort; + endif; + Logit("UseDLL2"); + + SetupInstall(); + Logit("SetupInstall"); + CheckRequirements(); - - ParseCommandLine(); + Logit("CheckRequirements"); + ParseCommandLine(); + Logit("ParseCommandLine"); + SetupAppInfo(); - + Logit("SetupAppInfo"); + LocalizeComponents(); - + Logit("LocalizeComponents"); + DetectInstalledComponents(); - + Logit("DetectInstalledComponents"); + // Can't upgrade, downgrade, or reinstall the light client, so if it is // already installed, we must abort. This is because on Win9x, we can't // move in-use files, and so we can't silently uninstall the light client, @@ -395,10 +1146,20 @@ program // Install the Client if (bFullClientSel) then + RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); + Enable(LOGGING); + if RegDBSetKeyValueEx ("SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters" + ,"SmbDeviceEnabled", REGDB_NUMBER, "0", 8) < 0 then + MessageBox ("RegDBCreateKeyEx failed.", SEVERE); + abort; + endif; pApp = &appFullClient; if (InstallApp(pApp) < 0) goto end_install; endif; - + if RegDBSetKeyValueEx("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters","Cell", REGDB_STRING, szCellName, -1) < 0 then + MessageBox ("RegDBCreateKeyEx failed.", SEVERE); + abort; + endif; // Install the Light Client if (bLightClientSel) then pApp = &appLightClient; @@ -459,12 +1220,13 @@ program CreateStartMenuEntries(); - if (bFullClientSel || bLightClientSel || bCcSel) then - CheckCopyCellServDB(); - endif; +// if (bFullClientSel || bLightClientSel || bCcSel) then +// CheckCopyCellServDB(); +// endif; end_install: + UnUseDLL(SUPPORTDIR^"GetWebDLL.dll"); UnUseDLL(SUPPORTDIR ^ SETUP_UTILS_DLL_PATH); CleanUpInstall(); @@ -486,37 +1248,83 @@ endprogram // /////////////////////////////////////////////////////////////////////////////// function ShowDialogs() - NUMBER nResult; + NUMBER nResult,handle; STRING szTargetLicense; STRING szSourceLicense; + STRING sRootDrive,sHomeDrive,userID,rootPath,homePath; + NUMBER DefaultItem; + STRING szDefaultWeb,szDefaultBrowse,szDefaultInstall,szPreviousInstall; + STRING szResult[256],svResult; begin Dlg_Start: // beginning of dialogs label - Dlg_SdWelcome: nResult = DialogShowSdWelcome(); if (nResult = BACK) goto Dlg_Start; Dlg_License: - szTargetLicense = DOCUMENTATION_LICENSE_PATH; - GetLicenseFilename (szSourceLicense); - Disable( DIALOGCACHE ); - nResult = ShowLicense(szTargetLicense,szSourceLicense); - if (nResult = 0) then - abort; - endif; - Enable( DIALOGCACHE ); - +// szTargetLicense = DOCUMENTATION_LICENSE_PATH; +// GetLicenseFilename (szSourceLicense); +// Logit("ShowLicense"); +// Disable( DIALOGCACHE ); +// if (MODE!=SILENTMODE) then +// nResult = ShowLicense(szTargetLicense,szSourceLicense); +// if (nResult = 0) then +// abort; +// endif; +// Enable( DIALOGCACHE ); +// endif; + if (nResult = BACK) goto Dlg_Start; Dlg_SdCompDlg: nResult = DialogShowSdAskComponentDialog(); + Logit("DialogShowSdAskComponentDialog"); if (nResult = BACK) goto Dlg_License; Dlg_SdSelectFolder: nResult = DialogShowSdSelectFolder(); - if (nResult = BACK) goto Dlg_SdCompDlg; - - return 0; - + Logit("DialogShowSdSelectFolder"); + if (nResult = BACK) goto Dlg_SdCompDlg; + if (bFullClientSel || bLightClientSel) then + szDefaultWeb=@CELLSERVDB_WEB; + szDefaultBrowse=TARGETDIR^"*"; + szDefaultInstall=@CELLSERVDB_INSTALL; + szPreviousInstall=WINDIR^@CELLSERVDB_CONFIGNAME; + if (Is(FILE_EXISTS,szPreviousInstall)) then + DefaultItem=IDC_CHECK_PREVIOUSFILE; + else + DefaultItem=IDC_CHECK_INSTALL; + endif; + Dlg_SdSelectCellServDB: + Logit("SetCellServDB-next"); + nResult =SetCellServDB("Select AFS Cell Data base (afsdcell.ini)" + ,DefaultItem + ,szPreviousInstall + ,szDefaultWeb + ,szDefaultBrowse + ,szDefaultInstall); + Logit("SetCellServDB"); + if (nResult=BACK) goto Dlg_SdSelectFolder; + Dlg_SdSelectCellName: + nResult=SdShowDlgEdit1 ("Select AFS Cell Name","A valid cell name should be entered here.\nIf you don't know your cell name, you may enter one after installation using the AFS Control Center.","Enter Cell Name:", szCellName); + if (nResult = BACK) goto Dlg_SdSelectCellName; + if (Is(FILE_EXISTS, WINDIR^"afsdsbmt.ini")) then + Logit("AskYesNo next"); + if (AskYesNo("Previous Drive Mapping Configuration already exist.\n\nPress Yes to keep previous configuration\nPress No to change previous configuration.",YES)=YES) then + return 0; + endif; + endif; + userID=" "; + GetUser(userID); + sRootDrive="Z:"; + sHomeDrive="U:"; + rootPath="/"; + homePath = "/afs/" + szCellName + "/u/" + userID; + nResult=SetHomeRoot( "Home and Root Drive Assignment\nThese drives will be mapped each time AFS is connected!",sRootDrive,rootPath,sHomeDrive,homePath ); + Logit("SetHomeRoot"); + if (nResult = BACK) goto Dlg_SdSelectCellServDB; + endif; + Logit("ShowDialogs-done"); + return 0; end; @@ -531,9 +1339,9 @@ end; function NotUpgradable(pApp) begin // The 3.5 beta is not upgradable - if ((pApp->iVer.nMajorVersion = 3) && (pApp->iVer.nMinorVersion = 5) && (pApp->iVer.nPatchLevel = 0) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then - return TRUE; - endif; +// if ((pApp->iVer.nMajorVersion = 3) && (pApp->iVer.nMinorVersion = 5) && (pApp->iVer.nPatchLevel = 0) && (pApp->iVer.szReleaseType = RELEASE_TYPE_BETA)) then +// return TRUE; +// endif; return FALSE; end; @@ -1425,6 +2233,7 @@ function SetupInstall() begin Enable( CORECOMPONENTHANDLING ); + szCellName=@CELLNAME_DEFAULT; bInstallAborted = FALSE; // Create list of end user selections to be displayed by DialogShowSdStartCopy() @@ -1549,7 +2358,7 @@ function DialogShowSdWelcome() begin szTitle = ""; - szMsg = ""; + szMsg = @WELCOME_MESSAGE; nResult = SdWelcome( szTitle, szMsg ); return nResult; @@ -1799,12 +2608,15 @@ begin ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); ComponentSetData(MEDIA, DOCS_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); - - ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE); - ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE); ComponentSelectItem(MEDIA, DOCS_COMP_NAME, FALSE); + endif; + ComponentSelectItem(MEDIA, SERVER_COMP_NAME, FALSE); + if (@CELLNAME_DEFAULT % ".") then + ComponentSelectItem(MEDIA, CC_COMP_NAME, FALSE); + else + ComponentSelectItem(MEDIA, CC_COMP_NAME, TRUE); endif; - else +else ComponentSetData(MEDIA, CLIENT_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); ComponentSetData(MEDIA, SERVER_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); ComponentSetData(MEDIA, CC_COMP_NAME, COMPONENT_FIELD_VISIBLE, FALSE, ""); @@ -2652,6 +3464,31 @@ begin end; + + + + + + + + + + + + + + + + + + + + + + + + + /////////////////////////////////////////////////////////////////////////////// // // Function: CreateStartMenuEntries @@ -2738,8 +3575,3 @@ end; // --- include script file section --- #include "sddialog.rul" - - - - - diff --git a/src/WINNT/install/Win9x/NTMakeFile b/src/WINNT/install/Win9x/NTMakeFile index d0f8d4643..fe95e91ba 100644 --- a/src/WINNT/install/Win9x/NTMakeFile +++ b/src/WINNT/install/Win9x/NTMakeFile @@ -5,8 +5,6 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html - - !INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME) !INCLUDE ..\..\..\config\NTMakefile.version OUTDIR = $(DESTDIR)\WinInstall @@ -16,7 +14,6 @@ OUTDIR = $(DESTDIR)\WinInstall COMPONENTS = \ INSTALL.BAT \ afsd.pif \ - cellservdb \ readme.RTF \ license.txt \ templet.reg \ @@ -37,8 +34,8 @@ COMPONENTS = \ $(DESTDIR)\lib\win95\pthread.dll \ $(DESTDIR)\lib\afsrpc.dll -$(COMPONENTS):: - $(DESTDIR)\bin\util_cr.exe ~ $@ "Missing $@" +$(COMPONENTS):: + $(DESTDIR)\bin\util_cr.exe ~ $@ $(COPY) $@ $(DESTDIR)\WinInstall\. !IF (EXIST(ISBUILD.MAK)) @@ -57,6 +54,6 @@ clean :: $(DEL) $(OUTDIR)\DiskIm~1\WebInstall\* prep : - $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\sock.vxd" "SOCK.VXD is missing from $(DESTDIR)\WinInstall\." - $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\MMAP.vxd" "MMAP.VXD is missing from $(DESTDIR)\WinInstall\." - $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\AFSD.EXE" "AFSD.EXE is missing from $(DESTDIR)\WinInstall\." + $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\sock.vxd" + $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\MMAP.vxd" + $(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\AFSD.EXE" diff --git a/src/WINNT/pthread/NTMakefile b/src/WINNT/pthread/NTMakefile index fc2aa88f0..d2beadb33 100644 --- a/src/WINNT/pthread/NTMakefile +++ b/src/WINNT/pthread/NTMakefile @@ -45,8 +45,8 @@ pthread_95.obj: pthread.c $(C2OBJ) pthread.c -DAFS_WIN95_ENV /Fopthread_95.obj install: $(PTHR95_DLLFILE) $(PTHR_DLLFILE) $(LIBINCLUDES) - -install9x: install + +install9x: install pthread.res: pthread.rc AFS_component_version_number.h $(RC) $*.rc diff --git a/src/WINNT/win9xpanel/CAfs.cpp b/src/WINNT/win9xpanel/CAfs.cpp index 2853f48e5..4d39b66cb 100644 --- a/src/WINNT/win9xpanel/CAfs.cpp +++ b/src/WINNT/win9xpanel/CAfs.cpp @@ -164,14 +164,27 @@ BOOL CAfs::Create(CString &msg,CString sCompName,PROCESS_INFORMATION &procInfo) /*DETACHED_PROCESS |*/ CREATE_NEW_CONSOLE | HIGH_PRIORITY_CLASS /*NORMAL_PRIORITY_CLASS*/, NULL, NULL, &m_startUpInfo, &procInfo); - LOG("AFSD Creation done - wait for notification"); if (!rc) { - msg.Format("Error creating AFS Client Console process, Status=0x%0x", GetLastError()); + LPVOID lpMsgBuf; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL + ); + msg.Format("Error creating AFS Client Console process, Status=%s.",lpMsgBuf); return FALSE; } + LOG("AFSD Creation done - wait for notification"); WPARAM wp; CWINAFSLOADAPP->WaitForEvent(logintime*1000,&wp,&msg); switch (wp) + { case AFS_EXITCODE_NORMAL: // extract machine name for logon @@ -360,6 +373,7 @@ BOOL CAfs::StartExployer(CString &msg,const char *udrive) int code; WIN32_FIND_DATA FileData; CString dir; + if ((udrive==NULL) || (strlen(udrive)==0)) return TRUE; dir.Format("%s\\*",udrive); HANDLE hFile= FindFirstFile( dir, // file name diff --git a/src/WINNT/win9xpanel/Change.cpp b/src/WINNT/win9xpanel/Change.cpp index 97171ae9b..7239359a6 100644 --- a/src/WINNT/win9xpanel/Change.cpp +++ b/src/WINNT/win9xpanel/Change.cpp @@ -118,10 +118,6 @@ BOOL CChange::OnInitDialog() szDrive[3]='*'; m_cDrive.SetCurSel(m_cDrive.FindString(0,szDrive)); } - if (stricmp(m_sDescription,"all")) return TRUE; - m_cPath.ModifyStyle(0,WS_DISABLED); - m_cShare.ModifyStyle(0,WS_DISABLED); - m_cAuto.ModifyStyle(0,WS_DISABLED); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -159,8 +155,6 @@ BOOL CChange::IsValidSubmountName (LPCTSTR pszSubmount) { if (!*pszSubmount) return FALSE; - if (stricmp(pszSubmount,"all")==0) - return FALSE; //disallow adding a share name of "all" for ( ; *pszSubmount; ++pszSubmount) { if (!isprint(*pszSubmount)) diff --git a/src/WINNT/win9xpanel/NTMakefile b/src/WINNT/win9xpanel/NTMakefile index 4f4c1404b..8cc9dce0d 100644 --- a/src/WINNT/win9xpanel/NTMakefile +++ b/src/WINNT/win9xpanel/NTMakefile @@ -48,7 +48,8 @@ RSC=rc.exe HLPDIR= .\HELP prep : - $(DESTDIR)\bin\util_cr.exe ~ "$(MSSDK)\Include\windows.h" "MSSDK must point to SDK include headers " + $(DESTDIR)\bin\util_cr.exe ~ "$(MSSDK)\Include\windows.h" "Enviornment variable MSSDK must point to SDK" + !IF "$(AFSDEV_BUILDTYPE)" == "FREE" @@ -76,7 +77,7 @@ CPP_PROJ=/nologo /MD /W3 /GX /O2 \ /D "NDEBUG" /D "_MFC" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_WINNT" /D "_AFXDLL" /D "ENCRIPT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinAfsLoad.res" $(AFSD_INC_MFC) /d "NDEBUG" /d "_AFXDLL" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinAfsLoad.res" $(AFSD_INC_MFC) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\"" /d "NDEBUG" /d "_AFXDLL" BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(INTDIR)\WinAfsLoad.bsc" BSC32_SBRS= \ @@ -137,7 +138,7 @@ CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od \ /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /D _WIN32_IE=0x0400 /D "TESTBUTTONS" /D "_MFC" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_WINNT" /D "_AFXDLL" /D "ENCRIPT" /D "NOKNOK" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinAfsLoad.res" $(AFSD_INC_MFC) /d "_DEBUG" /d "_AFXDLL" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\WinAfsLoad.res" $(AFSD_INC_MFC) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\"" /d "_DEBUG" /d "_AFXDLL" BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(INTDIR)\WinAfsLoad.bsc" BSC32_SBRS= \ diff --git a/src/WINNT/win9xpanel/WinAfsLoad.cpp b/src/WINNT/win9xpanel/WinAfsLoad.cpp index cfdb6f70f..44d418163 100644 --- a/src/WINNT/win9xpanel/WinAfsLoad.cpp +++ b/src/WINNT/win9xpanel/WinAfsLoad.cpp @@ -154,6 +154,7 @@ BOOL CWinAfsLoadApp::InitInstance() // show userid: password: connect CharLower(m_lpCmdLine); m_bShowAfs=(strstr(m_lpCmdLine,"show")!=NULL); + m_bConnect=(strstr(m_lpCmdLine,"connect")!=NULL); if (m_bLogWindow) ShowLog(TRUE); if (m_bLog) @@ -170,7 +171,7 @@ BOOL CWinAfsLoadApp::InitInstance() { cPassWord=(strstr(str,":")); } -// BOOL bConnect=(strstr(m_lpCmdLine,"connect")!=NULL); + m_bNoID=(strstr(m_lpCmdLine,"noid")!=NULL); if (m_hAfsLoadFinish) // SOME REASON THE WINDOW WAS NOT SHUT DOWN, SO LETES KILL IT { @@ -407,7 +408,7 @@ void CWinAfsLoadApp::WSANotifyFromUI(WPARAM wp,const char *msg) m_wParam=wp; m_sMsg=msg; SetEvent(CMyUIThread::m_hEventThreadKilled); - m_uNotifyMessage=0; + m_uNntifyMessage=0; break; default: break; diff --git a/src/WINNT/win9xpanel/WinAfsLoad.h b/src/WINNT/win9xpanel/WinAfsLoad.h index 1755af62b..b6cdece93 100644 --- a/src/WINNT/win9xpanel/WinAfsLoad.h +++ b/src/WINNT/win9xpanel/WinAfsLoad.h @@ -83,9 +83,7 @@ public: UINT m_uEvent; UINT m_uNotifyMessage; WPARAM m_wParam; -#if NOKNOK - BOOL m_bNokNok; -#endif + BOOL m_bNoID; //{{AFX_MSG(CWinAfsLoadApp) //}}AFX_MSG diff --git a/src/WINNT/win9xpanel/WinAfsLoad.rc b/src/WINNT/win9xpanel/WinAfsLoad.rc index 2260aea1c..b17846821 100644 --- a/src/WINNT/win9xpanel/WinAfsLoad.rc +++ b/src/WINNT/win9xpanel/WinAfsLoad.rc @@ -1,19 +1,16 @@ -//generated resource script. +//Microsoft Developer Studio generated resource script. // -/* Copyright 2000, International Business Machines Corporation and others. - All Rights Reserved. - - This software has been released under the terms of the IBM Public - License. For details, see the LICENSE file in the top-level source - directory or online at http://www.openafs.org/dl/license10.html -*/ - #include "resource.h" // Generated Help ID header file #define APSTUDIO_HIDDEN_SYMBOLS +//#include "resource.hm" #undef APSTUDIO_HIDDEN_SYMBOLS + #define APSTUDIO_READONLY_SYMBOLS +// Microsoft Developer Studio generated Help ID include file. +// Used by WinAfsLoad.rc +// #define HIDC_STATIC 0x80fcffff // IDD_SETTINGS ///////////////////////////////////////////////////////////////////////////// @@ -63,6 +60,7 @@ BEGIN "LANGUAGE 9, 1\r\n" "#pragma code_page(1252)\r\n" "#endif //_WIN32\r\n" + "#include ""res\\WinAfsLoad.rc2"" // non-Microsoft Visual C++ edited resources\r\n" "#include ""afxres.rc"" // Standard components\r\n" "#endif\r\n" "\0" @@ -265,7 +263,7 @@ END VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,1 - PRODUCTVERSION 2,0,0,0 + PRODUCTVERSION 1,0,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -290,7 +288,7 @@ BEGIN VALUE "OriginalFilename", "WinAfsLoad.EXE\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "WinAfsLoad Application\0" - VALUE "ProductVersion", "2, 0, 0, 0\0" + VALUE "ProductVersion", AFSPRODUCT_VERSION,"\0" VALUE "SpecialBuild", "\0" END END @@ -493,6 +491,10 @@ BEGIN IDH_ADD "HELP ADD" IDH_CHANGE "Help Change" IDH_MAIN "Help Main" +END + +STRINGTABLE DISCARDABLE +BEGIN IDM_CLEAR "Clear Window" END @@ -532,6 +534,7 @@ LANGUAGE 9, 1 #pragma code_page(1252) #endif //_WIN32 #include "afxres.rc" // Standard components +//#include "res\WinAfsLoad.rc2" // non-Microsoft Visual C++ edited resources #endif ///////////////////////////////////////////////////////////////////////////// diff --git a/src/WINNT/win9xpanel/WinAfsLoadDlg.cpp b/src/WINNT/win9xpanel/WinAfsLoadDlg.cpp index 45c7cf458..16e583c26 100644 --- a/src/WINNT/win9xpanel/WinAfsLoadDlg.cpp +++ b/src/WINNT/win9xpanel/WinAfsLoadDlg.cpp @@ -333,6 +333,7 @@ BOOL CWinAfsLoadDlg::OnInitDialog() LOG("ADVAPI32 %d.%d",(vernum>>16) & 0xff,vernum & 0xff); m_pEncript = (CEncript *)new CEncript(this); + // initiallze AFS and setup Progress display if (!m_cAfs.Init(this,msg)) HandleError(msg); @@ -341,7 +342,11 @@ BOOL CWinAfsLoadDlg::OnInitDialog() EnableToolTips(TRUE); m_bServiceIsActive=FALSE; - SetWindowText(AFSTITLE); + // Obtain Version String + CRegkey key(HKEY_LOCAL_MACHINE,"Software\\Open AFS\\AFS Control Center","CurrentVersion"); + key.GetString("VersionString",m_VersionString,128); + msg.Format("%s %s",AFSTITLE,m_VersionString); + SetWindowText(msg); UpdateData(TRUE); @@ -349,7 +354,6 @@ BOOL CWinAfsLoadDlg::OnInitDialog() m_sComputername=compName; m_sMountDisplay.Format("Connected Drives on Computer:%s",compName); m_sUsername=""; - m_bHomepath=FALSE; CRect rect; GetWindowRect(&m_OriginalRect); m_cOptionLine.GetWindowRect(&rect); @@ -366,28 +370,41 @@ BOOL CWinAfsLoadDlg::OnInitDialog() } CHAR pLoginName[UNLEN + 1]; size=UNLEN; - if (GetUserName(pLoginName,&size)) - m_sLoginName=pLoginName; - else - m_sLoginName="Bozo"; - CString sUser,sPass; - RegPassword(sUser,sPass,TRUE); - if ((m_sUsername=="") || (m_sLoginName.IsEmpty())) - { - m_sUsername=sUser; - } - if ((m_sPassword=="") || (m_sPassword.IsEmpty())) + if (CWINAFSLOADAPP->m_bNoID) { - m_sPassword=sPass; + CWnd *w=GetDlgItem(IDC_USERNAME); + w->EnableWindow(FALSE); + w=GetDlgItem(IDC_PASSWORD); + w->EnableWindow(FALSE); + w=GetDlgItem(IDC_SAVEUSERNAME); + w->EnableWindow(FALSE); + } else { + if (GetUserName(pLoginName,&size)) + { + m_sLoginName=pLoginName; + } else + m_sLoginName="Bozo"; + CString sUser,sPass; + RegPassword(sUser,sPass,TRUE); + if (m_sUsername=="") + { + m_sUsername=sUser; + } + if ((m_sUsername=="") && (m_sLoginName!="Bozo")) + { + m_sUsername=m_sLoginName; + } + if ((m_sPassword=="") || (m_sPassword.IsEmpty())) + { + m_sPassword=sPass; + } + if (m_sPassword.IsEmpty()) + { + m_cSaveUsername.SetCheck(FALSE); + RegLastUser(m_sUsername,TRUE); + } else + m_cSaveUsername.SetCheck(TRUE); } - - if (m_sPassword.IsEmpty()) - { - m_cSaveUsername.SetCheck(FALSE); - RegLastUser(m_sUsername,TRUE); - } else - m_cSaveUsername.SetCheck(TRUE); - // Initialize mount control list m_pImagelist = new CImageList(); @@ -621,13 +638,30 @@ void CWinAfsLoadDlg::OnSysCommand(UINT nID, LPARAM lParam) BYTE *lpData=(BYTE *)new BYTE[rc]; if (GetFileVersionInfo(wdir,wHandle,rc,lpData)) { - VS_FIXEDFILEINFO *pver; UINT len; - if (VerQueryValue(lpData,"\\",(PVOID *)&pver,&len)) - { - dlgAbout.m_sVersion.Format("WinAFSload Version %d.%d.%d",(pver->dwProductVersionMS>>16) &0xff ,pver->dwProductVersionMS & 0xff,(pver->dwProductVersionLS>>16) &0xff ); + struct TRANSLATION { + WORD langID; // language ID + WORD charset; // character set (code page) + }; + CString msg; + TRANSLATION mTrans,* pTrans; + if (VerQueryValue(lpData, + "\\VarFileInfo\\Translation", (PVOID *)&pTrans, &len) && len >= 4) { + mTrans = *pTrans; + TRACE("code page = %d\n", mTrans.charset); + } + LPCTSTR pVal; + UINT iLenVal; + CString query; + query.Format(_T("\\StringFileInfo\\%04x%04x\\%s"), + mTrans.langID, + mTrans.charset, + _T("ProductVersion")); + if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)query, + (LPVOID*)&pVal, &iLenVal)) { +// dlgAbout.m_sVersion.Format("WinAFSload Version %s",pVal); } - } + } delete lpData; } dlgAbout.DoModal(); @@ -721,17 +755,20 @@ void CWinAfsLoadDlg::OnConnect() return; } CCancel cancel(m_bConnect,FALSE); //clear m_bConnect when connection done - if (m_sUsername.IsEmpty() || m_sPassword.IsEmpty()) + if ( // if username is present then must have password + IsGetTokens() + && (m_sPassword=="") + ) { - HandleError("You must enter a username and password!"); - if (m_sUsername.IsEmpty()) m_cUsername.SetFocus(); - else m_cPassword.SetFocus(); + HandleError("You must enter a password!"); + m_cPassword.SetFocus(); return; } CProgress progress(this,7); progress.Next(); if (!m_cAfs.Create(msg,m_sComputername,m_procInfo)) { + progress.Finish(); HandleError(msg); m_procInfo.hThread=0; return; @@ -739,12 +776,13 @@ void CWinAfsLoadDlg::OnConnect() // CWINAFSLOADAPP->m_sMsg contains the host name used for login LOG("AFS Client Console started successfully [%s].",(const char *)m_sComputername); CString sDrive; - // lets find the All + CString sKey; + int iMounted=-1; for (int iItem=0;iItemm_bNoID) + { + m_cAuthenicate.ModifyStyle(WS_DISABLED,0); + if (IsGetTokens()) + m_cAuthenicate.SetWindowText("ReAuthenicate"); + else //tokens are not gotten; allow authenication + m_cAuthenicate.SetWindowText("Authenicate"); + m_cAuthenicate.Invalidate(); + } m_trayIcon.SetConnectState(0); return; } @@ -1073,7 +1154,8 @@ void CWinAfsLoadDlg::OnTrayButton4() OnSysCommand(IDM_EXPLORERAFS+64, 0); } -#define MAXKEY (SHARENAMESIZE+1)*MAXSHARES +#define MAXDRIVESIZE (SHARENAMESIZE+5)*MAXSHARES + BOOL CWinAfsLoadDlg::ProfileData(BOOL put) { CString dINI; @@ -1106,7 +1188,6 @@ BOOL CWinAfsLoadDlg::ProfileData(BOOL put) dptr=dblock+dused; wsprintf(dptr,"%s=%s%s",sKey,sAuto,sDrive); dused+=len; - if (stricmp(sKey,"all")==0) continue; //skip 'all' output len=sKey.GetLength()+sPath.GetLength()+2; if (sused+len>=scur) sblock=(char *)realloc(sblock,(scur+=BLOCKSIZE)); @@ -1121,91 +1202,41 @@ BOOL CWinAfsLoadDlg::ProfileData(BOOL put) WritePrivateProfileSection("AFS Drivemounts",dblock,dINI); delete dblock; delete sblock; - } else { - char sKey[MAXKEY+2]; + } else { //get + char sShare[SHARENAMESIZE+1]; CHAR sPath[MAX_PATH+1]; + CHAR sDriveMount[MAXDRIVESIZE+2]; CHAR sDrive[DRIVESIZE+1]; CHAR sAuto[AUTOSIZE+1]; strcpy(sAuto," "); - int len; CString path; - int keylen=GetPrivateProfileString("AFS Submounts", NULL, "", sKey, MAXKEY,tINI); - PCHAR pkey=sKey; - if (keylen>=MAXKEY) - { - CString msg; - msg.Format("Profile String Error - Too many entries (%d)",MAXSHARES); - HandleError(msg,TRUE); - return FALSE; - } - // lets scan for all and home first, we want to place them + // lets scan for all and home first, we want to place them first //mode: 0=look for all, 1=look for home, 2=finish the rest for(int mode=0;mode<3;mode++) { - while (keylen>1) + int drivelen=GetPrivateProfileString("AFS Drivemounts", NULL, "", sDriveMount, MAXDRIVESIZE,dINI); + if (drivelen>=MAXDRIVESIZE) { - switch (mode) + CString msg; + msg.Format("Profile String Error - Too many entries (%d)",MAXSHARES); + HandleError(msg,TRUE); + return FALSE; + } + PCHAR pDrivekey=sDriveMount; + while (drivelen>1) + { + if ((strlen(pDrivekey)==0) || (strlen(pDrivekey)>SHARENAMESIZE)) { - case 0: //we skip looking for all - break; - case 1: - if (stricmp(pkey,"home")!=0) - { - keylen-=(strlen(pkey)+1); - pkey+=(strlen(pkey)+1); - continue; - } - break; - default: - if((stricmp(pkey,"all")==0) || (stricmp(pkey,"home")==0)) - { - keylen-=(strlen(pkey)+1); - pkey+=(strlen(pkey)+1); - continue; - } + HandleError("Profile String Error - AFS Drivemounts - Share Name",FALSE); + ret=FALSE; break; } - if (strlen(pkey)==0) + strcpy(sShare,pDrivekey); + if (GetPrivateProfileString("AFS Drivemounts", sShare, "", sDrive, DRIVESIZE,dINI)==0) { - HandleError("Profile String Error - Empty key",FALSE); + HandleError("Profile String Error - AFS Drivemounts - Drive Name",FALSE); ret=FALSE; - keylen-=(strlen(pkey)+1); - continue; - } - if (mode!=0) - { - if ((len=GetPrivateProfileString("AFS Submounts", pkey, "", sPath, MAX_PATH,tINI))==0) - { - CString msg; - msg.Format("Profile String Error on Submount key:%s",pkey); - HandleError(msg,FALSE); - ret=FALSE; - keylen-=(strlen(pkey)+1); - pkey+=(strlen(pkey)+1); - continue; - } - } else { - strcpy(sPath,"\\"); - pkey="all"; - } - *sDrive=0; - if ((len=GetPrivateProfileString("AFS Drivemounts", pkey, "", sDrive, DRIVESIZE,dINI))==0) - { - if ((stricmp("all",pkey)==0)||(stricmp("home",pkey)==0)) - {// allow for no drive id on home - if (stricmp("home",pkey)==0) - strcpy(sDrive,"*U"); - else - strcpy(sDrive,"*Z"); - } else { - CString msg; - msg.Format("Profile String Error on Path key:%s",pkey); - HandleError(msg,TRUE); - ret=FALSE; - keylen-=(strlen(pkey)+1); - pkey+=(strlen(pkey)+1); - continue; - } + break; } if (sDrive[0]=='*') //test for leading * { @@ -1215,46 +1246,53 @@ BOOL CWinAfsLoadDlg::ProfileData(BOOL put) } else strcpy(sAuto," "); sDrive[1]=0; //force to be single character - if (stricmp("home",pkey)==0) //force auto connect for home and all - { - m_bHomepath=TRUE; - } strupr(sDrive); - if ((strlen(sDrive)!=1)||(strspn(sDrive,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")==0)) + if (strspn(sDrive,"DEFGHIJKLMNOPQRSTUVWXYZ")==0) { - if (stricmp("home",pkey)==0) - strcpy(sDrive,"U"); - else if (stricmp("all",pkey)==0) - strcpy(sDrive,"Z"); - else - strcpy(sDrive,""); + HandleError("Profile String Error - AFS Drivemounts - Drive Letter",FALSE); + ret=FALSE; + break; } strcat(sDrive,":"); - if (mode==0) - strcpy(sAuto,"*"); //no matter how it turns out 'all' is forced on. - AddToList(sDrive,sPath,pkey,sAuto); - if (mode<2) break; - keylen-=(strlen(pkey)+1); - pkey+=(strlen(pkey)+1); - } - switch (mode) - { - case 0: - if (keylen<=1) //we never found "all" - AddToList("Z:","\\","all","*"); - keylen=GetPrivateProfileString("AFS Submounts", NULL, "", sKey, MAXKEY,tINI); - pkey=sKey; - break; - case 1: - if (keylen<=1) //we never found "home" + switch (mode) + { + case 0: + if (stricmp("all",sShare)!=0) break; + if (GetPrivateProfileString("AFS Submounts", sShare, "", sPath, MAX_PATH,tINI)==0) + { + strcpy(sPath,"/"); //none defined + } + AddToList(sDrive,sPath,sShare,sAuto); + drivelen=0; + continue; + + case 1: + if (stricmp("home",sShare)!=0) break; + if (GetPrivateProfileString("AFS Submounts", sShare, "", sPath, MAX_PATH,tINI)==0) + { + HandleError("Profile String Error - AFS Drivemounts - Share Name",FALSE); + ret=FALSE; + break; + } + AddToList(sDrive,sPath,sShare,sAuto); + drivelen=0; + continue; + default: + if ((stricmp("all",sShare)==0)|| (stricmp("home",sShare)==0)) break; + if (GetPrivateProfileString("AFS Submounts", sShare, "", sPath, MAX_PATH,tINI)==0) + { + HandleError("Profile String Error - AFS Drivemounts - Share Name",FALSE); + ret=FALSE; + break; + } + AddToList(sDrive,sPath,sShare,sAuto); break; - keylen=GetPrivateProfileString("AFS Submounts", NULL, "", sKey, MAXKEY,tINI); - pkey=sKey; - break; - default: - break; + } + drivelen-=(strlen(pDrivekey)+1); + pDrivekey+=(strlen(pDrivekey)+1); } } + } return ret; } @@ -1359,11 +1397,13 @@ void CWinAfsLoadDlg::OnRemove() HandleError("You cannot remove Item from the list while connected!"); continue; } +#if 0 if (stricmp(m_cMountlist.GetItemText(nItem,COLSHARE),"all")==0) { HandleError("You cannot remove 'All' Item from the list!"); continue; } +#endif m_cMountlist.DeleteItem(nItem); } ProfileData(TRUE); @@ -1686,16 +1726,31 @@ void CWinAfsLoadDlg::OnAuthenicate() m_nShown=0; m_cAuthWarn.ShowWindow(SW_HIDE); LOG("Re-Authenication"); + if (m_sUsername=="") + { + HandleError("You must enter a user name!"); + m_cUsername.SetFocus(); + return; + } + if (m_sPassword=="") + { + HandleError("You must enter a password!"); + m_cPassword.SetFocus(); + return; + } if (!m_cAfs.Authencate(msg,m_sUsername,m_sPassword)) { HandleError(msg); return; } + m_cAuthenicate.SetWindowText("ReAuthenicate"); + m_cAuthenicate.Invalidate(); if (!m_cSaveUsername.GetCheck()) { m_sPassword.Empty(); UpdateData(FALSE); } + } diff --git a/src/WINNT/win9xpanel/WinAfsLoadDlg.h b/src/WINNT/win9xpanel/WinAfsLoadDlg.h index 19d27200a..433cb6cb6 100644 --- a/src/WINNT/win9xpanel/WinAfsLoadDlg.h +++ b/src/WINNT/win9xpanel/WinAfsLoadDlg.h @@ -37,6 +37,7 @@ public: void OnShowAddMenus(); LRESULT OnNotifyReturn(WPARAM wParam, LPARAM lParam); LRESULT OnAfsEvent(WPARAM wParam, LPARAM lParam); + BOOL IsGetTokens(){return (!CWINAFSLOADAPP->m_bNoID) && (m_sUsername!="");} // Dialog Data //{{AFX_DATA(CWinAfsLoadDlg) @@ -72,6 +73,7 @@ public: // Implementation protected: + CString m_VersionString; CAfs m_cAfs; CTrayIcon m_trayIcon; // my tray icon HICON m_hIcon; diff --git a/src/WINNT/win9xpanel/cafs.h b/src/WINNT/win9xpanel/cafs.h index 3a47075ac..3784774fd 100644 --- a/src/WINNT/win9xpanel/cafs.h +++ b/src/WINNT/win9xpanel/cafs.h @@ -13,13 +13,14 @@ #define DOSTITLEFINISH "Finished - AFS Client Console" #define APPTITLE "AFS" #define APPTITLEFINISH "Finished - AFSD" -#ifdef _DEBUG -#define CMDLINE "AFSD.PIF -startup" -//#define CMDLINE ".//debug//AFSD.EXE -startup" -#else +#ifdef DEV_IDE +#ifdef _DEBUG #define CMDLINE "AFSD.EXE -startup" -//#define CMDLINE "AFSD.PIF -startup" -//#define CMDLINE "AFSD.EXE" +#else +#define CMDLINE ".//release//AFSD.EXE -startup" +#endif +#else +#define CMDLINE "AFSD.PIF -startup" #endif #ifndef __CAFS__ diff --git a/src/afs/AIX/osi_file.c b/src/afs/AIX/osi_file.c index 246b69592..4f64a92ee 100644 --- a/src/afs/AIX/osi_file.c +++ b/src/afs/AIX/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_file.c,v 1.1.1.4 2001/07/14 22:19:32 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_file.c,v 1.1.1.5 2001/09/11 14:24:51 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -40,7 +40,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/AIX/osi_timeout.c b/src/afs/AIX/osi_timeout.c index 9867a444c..cbdab5616 100644 --- a/src/afs/AIX/osi_timeout.c +++ b/src/afs/AIX/osi_timeout.c @@ -15,7 +15,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_timeout.c,v 1.1.1.4 2001/07/14 22:19:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_timeout.c,v 1.1.1.5 2001/09/11 14:24:52 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -233,7 +233,7 @@ int timeoutcf( break; } else { - bzero(tos, sizeof(struct tos)); + memset(tos, 0, sizeof(struct tos)); } /* The trb and the tos were both allocated. */ diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index a50154436..f52e748ca 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.4 2001/07/14 22:19:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:24:53 hartmans Exp $"); #include "../h/systm.h" #include "../h/types.h" @@ -735,7 +735,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_fclear); if (!fclear_init) { - bzero(zero_buffer, PAGESIZE); + memset(zero_buffer, 0, PAGESIZE); fclear_init = 1; } /* diff --git a/src/afs/DARWIN/osi_file.c b/src/afs/DARWIN/osi_file.c index 645fff316..48dbea120 100644 --- a/src/afs/DARWIN/osi_file.c +++ b/src/afs/DARWIN/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_file.c,v 1.1.1.3 2001/07/14 22:20:00 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_file.c,v 1.1.1.4 2001/09/11 14:24:53 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -106,7 +106,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); afs_osi_cred.cr_ref++; afs_osi_cred.cr_ngroups=1; afs_osicred_initialized = 1; diff --git a/src/afs/DARWIN/osi_module.c b/src/afs/DARWIN/osi_module.c index eefbe6e52..2769f8c63 100644 --- a/src/afs/DARWIN/osi_module.c +++ b/src/afs/DARWIN/osi_module.c @@ -1,7 +1,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_module.c,v 1.1.1.3 2001/07/14 22:20:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_module.c,v 1.1.1.4 2001/09/11 14:24:54 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -17,16 +17,17 @@ extern int afs3_syscall(); extern int ioctl(); extern int setgroups(); +extern int maxvfsconf; kern_return_t afs_modload(struct kmod_info *ki, void *data) { if (sysent[AFS_SYSCALL].sy_call != nosys) { printf("AFS_SYSCALL in use. aborting\n"); return KERN_FAILURE; } - bzero(&afs_vfsconf, sizeof(struct vfsconf)); + memset(&afs_vfsconf, 0, sizeof(struct vfsconf)); strcpy(afs_vfsconf.vfc_name, "afs"); afs_vfsconf.vfc_vfsops=&afs_vfsops; - afs_vfsconf.vfc_typenum=VT_AFS; + afs_vfsconf.vfc_typenum=maxvfsconf++;/* oddly not VT_AFS */ afs_vfsconf.vfc_flags=MNT_NODEV; if (vfsconf_add(&afs_vfsconf)) { printf("AFS: vfsconf_add failed. aborting\n"); diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index d3393f777..069992e26 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -1,7 +1,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.3 2001/07/14 22:20:02 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:55 hartmans Exp $"); #include /* Standard vendor system headers */ #include /* Afs-based standard headers */ @@ -78,8 +78,8 @@ struct proc *p; mp->mnt_stat.f_iosize=8192; (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN-1, &size); - bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); - bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); + memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size); + memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN); strcpy(mp->mnt_stat.f_mntfromname, "AFS"); /* null terminated string "AFS" will fit, just leave it be. */ strcpy(mp->mnt_stat.f_fstypename, "afs"); @@ -191,10 +191,8 @@ int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p) abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1]; if (abp != &mp->mnt_stat) { abp->f_type = mp->mnt_vfc->vfc_typenum; - bcopy((caddr_t)mp->mnt_stat.f_mntonname, - (caddr_t)&abp->f_mntonname[0], MNAMELEN); - bcopy((caddr_t)mp->mnt_stat.f_mntfromname, - (caddr_t)&abp->f_mntfromname[0], MNAMELEN); + memcpy((caddr_t)&abp->f_mntonname[0], (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN); + memcpy((caddr_t)&abp->f_mntfromname[0], (caddr_t)mp->mnt_stat.f_mntfromname, MNAMELEN); } AFS_GUNLOCK(); @@ -227,7 +225,7 @@ int afs_init(struct vfsconf *vfc) { MALLOC(afs_vnodeop_p, PFI *, vfs_opv_numops*sizeof(PFI), M_TEMP, M_WAITOK); - bzero (afs_vnodeop_p, vfs_opv_numops*sizeof(PFI)); + memset(afs_vnodeop_p, 0, vfs_opv_numops*sizeof(PFI)); opv_desc_vector = afs_vnodeop_p; for (j=0; afs_vnodeop_opv_desc.opv_desc_ops[j].opve_op; j++) { diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index 19a68edbd..e27932b55 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -1,7 +1,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.3 2001/07/14 22:20:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.4 2001/09/11 14:24:55 hartmans Exp $"); #include /* Standard vendor system headers */ #include /* Afs-based standard headers */ @@ -121,7 +121,7 @@ struct vnodeopv_desc afs_vnodeop_opv_desc = struct componentname *cnp = ap->a_cnp; \ char *name; \ MALLOC(name, char *, cnp->cn_namelen+1, M_TEMP, M_WAITOK); \ - bcopy(cnp->cn_nameptr, name, cnp->cn_namelen); \ + memcpy(name, cnp->cn_nameptr, cnp->cn_namelen); \ name[cnp->cn_namelen] = '\0' #define DROPNAME() FREE(name, M_TEMP) @@ -604,7 +604,7 @@ afs_vop_pageout(ap) if ((f_offset < tvc->m.Length) && (f_offset + size) > tvc->m.Length) { size_t io = tvc->m.Length - f_offset; - bzero((caddr_t)(ioaddr + pl_offset + io), size - io); + memset((caddr_t)(ioaddr + pl_offset + io), 0, size - io); } } #endif /* ] USV */ @@ -888,10 +888,10 @@ abortit: goto abortit; MALLOC(fname, char *, fcnp->cn_namelen+1, M_TEMP, M_WAITOK); - bcopy(fcnp->cn_nameptr, fname, fcnp->cn_namelen); + memcpy(fname, fcnp->cn_nameptr, fcnp->cn_namelen); fname[fcnp->cn_namelen] = '\0'; MALLOC(tname, char *, tcnp->cn_namelen+1, M_TEMP, M_WAITOK); - bcopy(tcnp->cn_nameptr, tname, tcnp->cn_namelen); + memcpy(tname, tcnp->cn_nameptr, tcnp->cn_namelen); tname[tcnp->cn_namelen] = '\0'; diff --git a/src/afs/DUX/osi_file.c b/src/afs/DUX/osi_file.c index c552da6e5..842f5a220 100644 --- a/src/afs/DUX/osi_file.c +++ b/src/afs/DUX/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_file.c,v 1.1.1.5 2001/07/14 22:19:36 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_file.c,v 1.1.1.6 2001/09/11 14:24:56 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -60,7 +60,7 @@ void *osi_UFSOpen(ainode) struct utask_nd utnd = { NULL, NULL }; struct vattr attr; - bzero(&nd, sizeof(nd)); + memset(&nd, 0, sizeof(nd)); ndp->ni_utnd = &utnd; ndp->ni_nameiop = LOOKUP; ndp->ni_cred = &afs_osi_cred; diff --git a/src/afs/DUX/osi_vfsops.c b/src/afs/DUX/osi_vfsops.c index 98fe663f6..4cc1497fc 100644 --- a/src/afs/DUX/osi_vfsops.c +++ b/src/afs/DUX/osi_vfsops.c @@ -13,7 +13,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.5 2001/07/14 22:19:38 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.6 2001/09/11 14:24:57 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -90,10 +90,10 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data, if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname) panic("malloc failure in afs_mount\n"); - bzero(afsp->m_stat.f_mntonname, MNAMELEN); - bzero(afsp->m_stat.f_mntfromname, MNAMELEN); + memset(afsp->m_stat.f_mntonname, 0, MNAMELEN); + memset(afsp->m_stat.f_mntfromname, 0, MNAMELEN); AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code); - bcopy("AFS", afsp->m_stat.f_mntfromname, 4); + memcpy(afsp->m_stat.f_mntfromname, "AFS", 4); AFS_GUNLOCK(); (void) mp_afs_statfs(afsp); AFS_GLOCK(); @@ -307,12 +307,12 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp) fidp->fid_len = AFS_SIZEOFSMALLFID; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } else { - bcopy((caddr_t)addr, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)addr, AFS_FIDDATASIZE); } } else { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } AFS_GUNLOCK(); return 0; diff --git a/src/afs/FBSD/osi_file.c b/src/afs/FBSD/osi_file.c index 10a2a87df..9bc6ad875 100644 --- a/src/afs/FBSD/osi_file.c +++ b/src/afs/FBSD/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_file.c,v 1.1.1.3 2001/07/14 22:20:03 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_file.c,v 1.1.1.4 2001/09/11 14:24:57 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -38,7 +38,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); afs_osi_cred.cr_ref++; afs_osicred_initialized = 1; } diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index b052ea289..0684307dc 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -13,7 +13,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.3 2001/07/14 22:20:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:58 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -90,10 +90,10 @@ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data, if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname) panic("malloc failure in afs_mount\n"); - bzero(afsp->m_stat.f_mntonname, MNAMELEN); - bzero(afsp->m_stat.f_mntfromname, MNAMELEN); + memset(afsp->m_stat.f_mntonname, 0, MNAMELEN); + memset(afsp->m_stat.f_mntfromname, 0, MNAMELEN); AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code); - bcopy("AFS", afsp->m_stat.f_mntfromname, 4); + memcpy(afsp->m_stat.f_mntfromname, "AFS", 4); AFS_GUNLOCK(); (void) mp_afs_statfs(afsp); AFS_GLOCK(); @@ -299,12 +299,12 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp) fidp->fid_len = AFS_SIZEOFSMALLFID; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } else { - bcopy((caddr_t)addr, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)addr, AFS_FIDDATASIZE); } } else { - bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE); + memcpy(fidp->fid_data, (caddr_t)&Sfid, AFS_FIDDATASIZE); } AFS_GUNLOCK(); return 0; diff --git a/src/afs/HPUX/osi_file.c b/src/afs/HPUX/osi_file.c index e777f0c1d..81954b0b0 100644 --- a/src/afs/HPUX/osi_file.c +++ b/src/afs/HPUX/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_file.c,v 1.1.1.4 2001/07/14 22:19:38 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_file.c,v 1.1.1.5 2001/09/11 14:24:59 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -39,7 +39,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/HPUX/osi_vnodeops.c b/src/afs/HPUX/osi_vnodeops.c index dcd39a526..cb2998a25 100644 --- a/src/afs/HPUX/osi_vnodeops.c +++ b/src/afs/HPUX/osi_vnodeops.c @@ -12,7 +12,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.4 2001/07/14 22:19:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:25:01 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -77,14 +77,14 @@ m_cpytoc(m, off, len, cp) return (len); ml = MIN(len, m->m_len - off); - bcopy(mtod(m, caddr_t)+off, cp, (u_int)ml); + memcpy(cp, mtod(m, caddr_t)+off, (u_int)ml); cp += ml; len -= ml; m = m->m_next; while (len && m) { ml = m->m_len; - bcopy(mtod(m, caddr_t), cp, (u_int)ml); + memcpy(cp, mtod(m, caddr_t), (u_int)ml); cp += ml; len -= ml; m = m->m_next; @@ -1350,7 +1350,7 @@ afs_pageout(vp,prp, start, end, flags) filevp = VM_GET_PAGEOUT_VNODE(&vm_info); /* always page out to back store */ VASSERT(filevp != NULL); - bzero((caddr_t)&args, sizeof(fsdata_t)); + memset((caddr_t)&args, 0, sizeof(fsdata_t)); args.remote_down = 0; /* assume remote file servers are up */ args.remote = 1; /* we are remote */ args.bsize = 0; /* filled up later by afs_vm_checkpage() */ @@ -2039,7 +2039,7 @@ afs_readdir(vp, uiop, cred) if ((caddr_t) odp + odp->d_reclen > obufend) break; /* record offset *after* we're sure to use this entry */ - bcopy((char *)&idp->__d_off, (char *)&tmp_offset, sizeof tmp_offset); + memcpy((char *)&tmp_offset, (char *)&idp->__d_off, sizeof tmp_offset); offset = tmp_offset; } @@ -2098,7 +2098,7 @@ afs_readdir3(vp, uiop, cred) (caddr_t)idp < ibufend; idp = (struct __dirent32 *) ((caddr_t) idp + idp->__d_reclen), odp = (struct __dirent64 *) ((caddr_t) odp + odp->__d_reclen)) { - bcopy((char *)&idp->__d_off, (char *)&odp->__d_off, sizeof odp->__d_off); + memcpy((char *)&odp->__d_off, (char *)&idp->__d_off, sizeof odp->__d_off); odp->__d_ino = idp->__d_ino; odp->__d_namlen = idp->__d_namlen; (void) strcpy(odp->__d_name, idp->__d_name); @@ -2223,7 +2223,7 @@ printf("afsHash: enter\n"); osi_Panic("afs: cannot create SEMA Hashtable\n"); /* initialize the hash table and associated locks */ - bzero((char *)hashTable, sizeOfHashTable * sizeof(Bucket )); + memset((char *)hashTable, 0, sizeOfHashTable * sizeof(Bucket )); for ( i=0;i < sizeOfHashTable; i ++) hashLockInit( hashTable[i].lock); hashLockInit(afsHashLock); @@ -2289,7 +2289,7 @@ printf("afsHashInsertFind: %d FOUND\n", key); osi_Panic("afs: SEMA Hashtable cannot create new entry\n"); /* create new entry */ ptr->key = key; - bzero((char *)&ptr->element, sizeof(ptr->element)); + memset((char *)&ptr->element, 0, sizeof(ptr->element)); ptr->refCnt = 1; /* this guy */ /* insert new entry in bucket */ diff --git a/src/afs/IRIX/osi_file.c b/src/afs/IRIX/osi_file.c index 262a331bf..322af9a13 100644 --- a/src/afs/IRIX/osi_file.c +++ b/src/afs/IRIX/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_file.c,v 1.1.1.5 2001/07/14 22:19:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_file.c,v 1.1.1.6 2001/09/11 14:25:01 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -74,7 +74,7 @@ void *osi_UFSOpen(ino_t ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/IRIX/osi_groups.c b/src/afs/IRIX/osi_groups.c index 24c17dfae..2a646345b 100644 --- a/src/afs/IRIX/osi_groups.c +++ b/src/afs/IRIX/osi_groups.c @@ -18,7 +18,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_groups.c,v 1.1.1.4 2001/07/14 22:19:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_groups.c,v 1.1.1.5 2001/09/11 14:25:01 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -89,7 +89,7 @@ int fixup_pags(int **credpp, int ngroups, gid_t *gidset, int old_afs_pag, return EINVAL; /* sorry */ cr = crdup(OSI_GET_CURRENT_CRED()); /* we will replace all the groups. */ - bzero((char*)&cr->cr_groups, ngroups_max * sizeof(gid_t)); + memset((char*)&cr->cr_groups, 0, ngroups_max * sizeof(gid_t)); /* Now cobble the new groups list together. */ new = 0; diff --git a/src/afs/IRIX/osi_inode.c b/src/afs/IRIX/osi_inode.c index c16636b4c..4a04d99f0 100644 --- a/src/afs/IRIX/osi_inode.c +++ b/src/afs/IRIX/osi_inode.c @@ -42,7 +42,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_inode.c,v 1.1.1.5 2001/07/14 22:19:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_inode.c,v 1.1.1.6 2001/09/11 14:25:02 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -460,7 +460,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, } else createdDir = 1; - bzero((char*)&dattr, sizeof(dattr)); + memset((char*)&dattr, 0, sizeof(dattr)); dattr.atd_version = AFS_XFS_ATD_VERS; dattr.atd_volume = rw_vno; AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char*)&dattr, @@ -482,7 +482,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, return code; } - bzero((char*)&attrs, sizeof(attrs)); + memset((char*)&attrs, 0, sizeof(attrs)); attrs.at_pino = vattr.va_nodeid; VN_RELE(dvp); @@ -510,8 +510,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen, if (!code) { /* Set attributes. */ - bcopy((char*)params, (char*)attrs.at_param, - sizeof(afs_inode_params_t)); + memcpy((char*)attrs.at_param, (char*)params, sizeof(afs_inode_params_t)); attrs.at_attr_version = AFS_XFS_ATTR_VERS; attrs.at_name_version = name_version; AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char*)&attrs, @@ -1200,12 +1199,11 @@ afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo, } if (!code) { - bzero((char*)&data, sizeof(data)); + memset((char*)&data, 0, sizeof(data)); data.ili_info.inodeNumber = inode; data.ili_info.byteCount = vattr.va_size; data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK); - bcopy((char*)attrs.at_param, (char*)data.ili_info.param, - sizeof(data.ili_info.param)); + memcpy((char*)data.ili_info.param, (char*)attrs.at_param, sizeof(data.ili_info.param)); data.ili_attr_version = attrs.at_attr_version; data.ili_name_version = attrs.at_name_version; data.ili_tag = attrs.at_tag; diff --git a/src/afs/IRIX/osi_vnodeops.c b/src/afs/IRIX/osi_vnodeops.c index 81203468a..ca25d700e 100644 --- a/src/afs/IRIX/osi_vnodeops.c +++ b/src/afs/IRIX/osi_vnodeops.c @@ -13,7 +13,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.6 2001/07/14 22:19:44 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.7 2001/09/11 14:25:03 hartmans Exp $"); #ifdef AFS_SGI62_ENV #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -810,7 +810,7 @@ afs_strategy(OSI_VC_ARG(avc), bp) /* we are responsible for zero'ing the page */ caddr_t c; c = bp_mapin(bp); - bzero(c, bp->b_bcount); + memset(c, 0, bp->b_bcount); iodone(bp); ReleaseReadLock(&avc->lock); return; diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 45d96de54..4f3f0bf3f 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -14,11 +14,12 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.7 2001/07/14 22:19:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.8 2001/09/11 14:25:03 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" #include "../h/mm.h" +#include "../h/slab.h" #include "../afs/afs_atomlist.h" #include "../afs/afs_lhash.h" @@ -86,7 +87,7 @@ static void *linux_alloc(unsigned int asize) /* if we can use kmalloc use it to allocate the required memory. */ if (asize < MAX_KMALLOC_SIZE) { - new = (void *)(long)kmalloc(asize, GFP_KERNEL); + new = (void *)(unsigned long)kmalloc(asize, GFP_KERNEL); if (new) /* piggy back alloc type */ (unsigned long)new |= KM_TYPE; } diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 259ffc19c..b26040655 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -16,7 +16,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.7 2001/07/14 22:19:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.8 2001/09/11 14:25:04 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -100,8 +100,8 @@ int setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, int change_pare /* Intercept the standard system call. */ -extern int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); -asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist) +extern long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); +asmlinkage long afs_xsetgroups(int gidsetsize, gid_t *grouplist) { int code; cred_t *cr = crref(); diff --git a/src/afs/LINUX/osi_vfs.h b/src/afs/LINUX/osi_vfs.h index ac09f995a..b5f92e125 100644 --- a/src/afs/LINUX/osi_vfs.h +++ b/src/afs/LINUX/osi_vfs.h @@ -27,6 +27,9 @@ typedef struct vnode { struct list_head i_dentry; #if defined(AFS_LINUX24_ENV) struct list_head i_dirty_buffers; +#endif +#if defined(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS) + struct list_head i_dirty_data_buffers; #endif unsigned long i_ino; unsigned int i_count; @@ -54,6 +57,9 @@ typedef struct vnode { unsigned short i_bytes; #endif struct semaphore i_sem; +#ifdef STRUCT_INODE_HAS_I_TRUNCATE_SEM + struct rw_semaphore i_truncate_sem; +#endif #if defined(AFS_LINUX24_ENV) struct semaphore i_zombie; #else @@ -75,12 +81,21 @@ typedef struct vnode { struct address_space i_data; #else struct vm_area_struct *i_mmap; +#if defined(STRUCT_INODE_HAS_I_MMAP_SHARED) + struct vm_area_struct *i_mmap_shared; +#endif struct page *i_pages; +#endif +#if defined(STRUCT_INODE_HAS_I_MAPPING_OVERLOAD) + int i_mapping_overload; #endif struct dquot *i_dquot[MAXQUOTAS]; #if defined(AFS_LINUX24_ENV) struct pipe_inode_info *i_pipe; struct block_device *i_bdev; +#if defined(STRUCT_INODE_HAS_I_CDEV) + struct char_device *i_cdev; +#endif unsigned long i_dnotify_mask; struct dnotify_struct *i_dnotify; #endif diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index e729b08b9..91b7704f6 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -15,7 +15,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.8 2001/07/14 22:19:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.9 2001/09/11 14:25:07 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -244,9 +244,7 @@ void afs_delete_inode(struct inode *ip) struct vcache *vc = (struct vcache*)ip; AFS_GLOCK(); - ObtainWriteLock(&vc->lock, 504); osi_clear_inode(ip); - ReleaseWriteLock(&vc->lock); AFS_GUNLOCK(); } @@ -334,6 +332,14 @@ int afs_statfs(struct super_block *sbp, struct statfs *statp, int size) } +void +afs_umount_begin(struct super_block *sbp) +{ + afs_shuttingdown=1; + afs_put_super(sbp); + afs_was_mounted=0; +} + #if defined(AFS_LINUX24_ENV) struct super_operations afs_sops = { read_inode: afs_read_inode, @@ -341,6 +347,7 @@ struct super_operations afs_sops = { delete_inode: afs_delete_inode, put_super: afs_put_super, statfs: afs_statfs, + umount_begin: afs_umount_begin, }; #else struct super_operations afs_sops = { @@ -354,7 +361,7 @@ struct super_operations afs_sops = { afs_statfs, NULL, /* afs_remount_fs - see doc above */ NULL, /* afs_clear_inode */ - NULL, /* afs_umount_begin */ + afs_umount_begin, }; #endif diff --git a/src/afs/SOLARIS/osi_file.c b/src/afs/SOLARIS/osi_file.c index 20babf31e..5f4323345 100644 --- a/src/afs/SOLARIS/osi_file.c +++ b/src/afs/SOLARIS/osi_file.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_file.c,v 1.1.1.5 2001/07/14 22:19:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_file.c,v 1.1.1.6 2001/09/11 14:25:08 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -189,7 +189,7 @@ void *osi_UFSOpen(ainode) } if (!afs_osicred_initialized) { /* valid for alpha_osf, SunOS, Ultrix */ - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ afs_osicred_initialized = 1; } diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 74d4c063a..485a4e0c2 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.6 2001/07/14 22:19:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.7 2001/09/11 14:25:09 hartmans Exp $"); #if defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV) /* @@ -265,10 +265,6 @@ struct AFS_UCRED *acred; afs_int32 toffset; #endif - if (!pl) return 0; /* punt asynch requests */ - - len = PAGESIZE; - pl[0] = NULL; /* Make sure it's empty */ if (!acred) #ifdef AFS_SUN5_ENV osi_Panic("GetOnePage: !acred"); @@ -276,9 +272,36 @@ struct AFS_UCRED *acred; acred = u.u_cred; /* better than nothing */ #endif - /* first, obtain the proper lock for the VM system */ avc = (struct vcache *) vp; /* cast to afs vnode */ +#ifdef AFS_SUN5_ENV + if (avc->credp /*&& AFS_NFSXLATORREQ(acred)*/ && AFS_NFSXLATORREQ(avc->credp)) { + acred = avc->credp; + } +#endif + if (code = afs_InitReq(&treq, acred)) return code; + + if (!pl) { + /* + * This is a read-ahead request, e.g. due to madvise. + */ + tdc = afs_GetDCache(avc, (afs_int32)off, &treq, &offset, &nlen, 1); + if (!tdc) return 0; + + if (!(tdc->flags & DFNextStarted)) { + ObtainReadLock(&avc->lock); + afs_PrefetchChunk(avc, tdc, acred, &treq); + ReleaseReadLock(&avc->lock); + } + afs_PutDCache(tdc); + return 0; + } + + len = PAGESIZE; + pl[0] = NULL; /* Make sure it's empty */ + + /* first, obtain the proper lock for the VM system */ + /* if this is a read request, map the page in read-only. This will * allow us to swap out the dcache entry if there are only read-only * pages created for the chunk, which helps a *lot* when dealing @@ -290,12 +313,6 @@ struct AFS_UCRED *acred; mapForRead = 1; if (protp) *protp = PROT_ALL; -#ifdef AFS_SUN5_ENV - if (avc->credp /*&& AFS_NFSXLATORREQ(acred)*/ && AFS_NFSXLATORREQ(avc->credp)) { - acred = avc->credp; - } -#endif - if (code = afs_InitReq(&treq, acred)) return code; #ifndef AFS_SUN5_ENV if (AFS_NFSXLATORREQ(acred)) { if (rw == S_READ) { @@ -323,7 +340,7 @@ retry: } afs_BozonLock(&avc->pvnLock, avc); - ObtainSharedLock(&avc->lock,566); + ObtainReadLock(&avc->lock); afs_Trace4(afs_iclSetp, CM_TRACE_PAGEIN, ICL_TYPE_POINTER, (afs_int32) vp, ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len, @@ -337,7 +354,7 @@ retry: * the locks and try again when the VM purge is done. */ ObtainWriteLock(&avc->vlock, 550); if (avc->activeV) { - ReleaseSharedLock(&avc->lock); + ReleaseReadLock(&avc->lock); ReleaseWriteLock(&avc->vlock); afs_BozonUnlock(&avc->pvnLock, avc); afs_PutDCache(tdc); @@ -359,7 +376,7 @@ retry: /* Check to see whether the cache entry is still valid */ if (!(avc->states & CStatd) || !hsame(avc->m.DataVersion, tdc->f.versionNo)) { - ReleaseSharedLock(&avc->lock); + ReleaseReadLock(&avc->lock); afs_BozonUnlock(&avc->pvnLock, avc); afs_PutDCache(tdc); goto retry; @@ -438,19 +455,17 @@ retry: buf->b_blkno = btodb(toffset); bp_mapin(buf); /* map it in to our address space */ #ifndef AFS_SUN5_ENV - ReleaseSharedLock(&avc->lock); + ReleaseReadLock(&avc->lock); #endif #if defined(AFS_SUN5_ENV) AFS_GLOCK(); - UpgradeSToWLock(&avc->lock, 564); code = afs_ustrategy(buf, acred); /* do the I/O */ - ConvertWToSLock(&avc->lock); AFS_GUNLOCK(); #else code = afs_ustrategy(buf); /* do the I/O */ #endif #ifndef AFS_SUN5_ENV - ObtainSharedLock(&avc->lock,245); + ObtainReadLock(&avc->lock); #endif #ifdef AFS_SUN5_ENV /* Before freeing unmap the buffer */ @@ -495,8 +510,13 @@ retry: AFS_GLOCK(); pl[slot] = (struct page *) 0; + /* + * XXX This seems kind-of wrong: we shouldn't be modifying + * avc->states while not holding the write lock (even + * though nothing really uses CHasPages..) + */ avc->states |= CHasPages; - ReleaseSharedLock(&avc->lock); + ReleaseReadLock(&avc->lock); #ifdef AFS_SUN5_ENV ObtainWriteLock(&afs_xdcache,246); if (!mapForRead) { @@ -526,7 +546,7 @@ retry: for(i=0; ilock); + ReleaseReadLock(&avc->lock); afs_BozonUnlock(&avc->pvnLock, avc); #ifdef AFS_SUN5_ENV afs_PutDCache(tdc); diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index f678d81fe..8230a549f 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -14,7 +14,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.6 2001/07/14 22:19:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.7 2001/09/11 14:25:10 hartmans Exp $"); #ifdef UKERNEL @@ -1419,7 +1419,7 @@ struct afsconf_dir *adir; { /* build address list */ for(i=0;ihostAddr[i].sin_addr, &hosts[i], sizeof(afs_int32)); + memcpy(&hosts[i], &aci->hostAddr[i].sin_addr, sizeof(afs_int32)); if (aci->linkedCell) cellFlags |= 4; /* Flag that linkedCell arg exists, for upwards compatibility */ @@ -1649,7 +1649,7 @@ void uafs_Init( rn, cacheFiles); exit(1); } - bzero(pathname_for_V, (cacheFiles * sizeof(char *))); + memset(pathname_for_V, 0, (cacheFiles * sizeof(char *))); if (afsd_debug) printf("%s: %d pathname_for_V entries at 0x%x, %d bytes\n", rn, cacheFiles, (cacheFiles * sizeof(AFSD_INO_T))); @@ -1747,7 +1747,7 @@ void uafs_Init( " flags = 0x%x, dcache entries %d\n", rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags, dCacheSize); - bzero(&cparams, sizeof(cparams)); + memset(&cparams, 0, sizeof(cparams)); cparams.cacheScaches = cacheStatEntries; cparams.cacheFiles = cacheFiles; cparams.cacheBlocks = cacheBlocks; diff --git a/src/afs/VNOPS/afs_vnop_fid.c b/src/afs/VNOPS/afs_vnop_fid.c index 22830fbec..85aadce61 100644 --- a/src/afs/VNOPS/afs_vnop_fid.c +++ b/src/afs/VNOPS/afs_vnop_fid.c @@ -17,7 +17,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.5 2001/07/14 22:19:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.6 2001/09/11 14:25:12 hartmans Exp $"); #if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -130,12 +130,12 @@ struct fid **fidpp; || USE_SMALLFID(credp) #endif ) { - bcopy((caddr_t)&Sfid, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)&Sfid, SizeOfSmallFid); } else { - bcopy((caddr_t)addr, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)addr, SizeOfSmallFid); } } else { - bcopy((caddr_t)&Sfid, fidpp->fid_data, SizeOfSmallFid); + memcpy(fidpp->fid_data, (caddr_t)&Sfid, SizeOfSmallFid); } #else /* malloc a fid pointer ourselves. */ @@ -143,12 +143,12 @@ struct fid **fidpp; (*fidpp)->fid_len = SizeOfSmallFid; if (afs_NFSRootOnly) { if (rootvp) { - bcopy((char *)&Sfid, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)&Sfid, SizeOfSmallFid); } else { - bcopy((char *)addr, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)addr, SizeOfSmallFid); } } else { - bcopy((char *)&Sfid, (*fidpp)->fid_data, SizeOfSmallFid); + memcpy((*fidpp)->fid_data, (char *)&Sfid, SizeOfSmallFid); } #endif return (0); diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index f233ad85c..9b609f76a 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -15,7 +15,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.5 2001/07/14 22:19:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.6 2001/09/11 14:25:13 hartmans Exp $"); #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) @@ -104,9 +104,9 @@ afs_ustrategy(abp) if (code == 0) { if (tuio.afsio_resid > 0) #if defined(AFS_FBSD_ENV) - bzero(abp->b_saveaddr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid); + memset(abp->b_saveaddr + abp->b_bcount - tuio.afsio_resid, 0, tuio.afsio_resid); #else - bzero(abp->b_un.b_addr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid); + memset(abp->b_un.b_addr + abp->b_bcount - tuio.afsio_resid, 0, tuio.afsio_resid); #endif /* AFS_FBSD_ENV */ #ifdef AFS_AIX32_ENV /* diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index b327b46a7..9a5c9b082 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -20,7 +20,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.6 2001/07/14 22:19:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.7 2001/09/11 14:25:15 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -171,7 +171,7 @@ afs_MemWrite(avc, auio, aio, acred, noLock) return (EFBIG); } #endif -#ifdef AFS_VM_RDWR_ENV +#if (!defined(AFS_VM_RDWR_ENV)||defined(AFS_LINUX20_ENV)) /* * If write is implemented via VM, afs_FakeOpen() is called from the * high-level write op. @@ -280,7 +280,7 @@ afs_MemWrite(avc, auio, aio, acred, noLock) if (filePos > avc->m.Length) avc->m.Length = filePos; #endif -#ifndef AFS_VM_RDWR_ENV +#if (!defined(AFS_VM_RDWR_ENV)||defined(AFS_LINUX20_ENV)) /* * If write is implemented via VM, afs_DoPartialWrite() is called from * the high-level write op. diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index 10de52162..5f668b556 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_buffer.c,v 1.1.1.4 2001/07/14 22:19:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_buffer.c,v 1.1.1.5 2001/09/11 14:24:36 hartmans Exp $"); #include "../afs/sysincludes.h" #if !defined(UKERNEL) @@ -536,6 +536,6 @@ void shutdown_bufferpackage() { nbuffers = 0; timecounter = 1; for(i=0;i #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.4 2001/07/14 22:19:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.5 2001/09/11 14:24:37 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -719,7 +719,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers */ dataBytes = sizeof(struct afs_CMStats); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)&afs_cmstats, (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -739,7 +739,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers afs_CountServers(); dataBytes = sizeof(afs_stats_cmperf); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)&afs_stats_cmperf, (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -757,14 +757,12 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers */ afs_stats_cmperf.numPerfCalls++; afs_CountServers(); - bcopy((char *)(&afs_stats_cmperf), - (char *)(&(afs_stats_cmfullperf.perf)), - sizeof(struct afs_stats_CMPerf)); + memcpy((char *)(&(afs_stats_cmfullperf.perf)), (char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf)); afs_stats_cmfullperf.numFullPerfCalls++; dataBytes = sizeof(afs_stats_cmfullperf); dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); - bcopy((char *)(&afs_stats_cmfullperf), (char *)dataBuffP, dataBytes); + memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes); a_dataP->AFSCB_CollData_len = dataBytes>>2; a_dataP->AFSCB_CollData_val = dataBuffP; break; @@ -1126,23 +1124,14 @@ int SRXAFSCB_GetCellServDB( afs_int32 i, j; struct cell *tcell; struct afs_q *cq, *tq; - char *t_name; + char *t_name, *p_name = NULL; #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ AFS_STATCNT(SRXAFSCB_GetCellServDB); - t_name = (char *)rxi_Alloc(AFSNAMEMAX); - if (t_name == NULL) { -#ifdef RX_ENABLE_LOCKS - AFS_GUNLOCK(); -#endif /* RX_ENABLE_LOCKS */ - return ENOMEM; - } - - t_name[0] = '\0'; - bzero(a_hosts, AFSMAXCELLHOSTS * sizeof(afs_int32)); + memset(a_hosts, 0, AFSMAXCELLHOSTS * sizeof(afs_int32)); /* search the list for the cell with this index */ ObtainReadLock(&afs_xcell); @@ -1150,12 +1139,29 @@ int SRXAFSCB_GetCellServDB( tq = QNext(cq); if (i == a_index) { tcell = QTOC(cq); - strcpy(t_name, tcell->cellName); + p_name = tcell->cellName; for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) { a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip); } } } + + if (p_name) + i = strlen(p_name); + else + i = 0; + t_name = (char *)rxi_Alloc(i+1); + if (t_name == NULL) { +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + return ENOMEM; + } + + t_name[i] = '\0'; + if (p_name) + bcopy(p_name, t_name, i); + ReleaseReadLock(&afs_xcell); #ifdef RX_ENABLE_LOCKS @@ -1191,25 +1197,16 @@ int SRXAFSCB_GetLocalCell( struct rx_call *a_call, char **a_name) { + int plen; struct cell *tcell; struct afs_q *cq, *tq; - char *t_name; + char *t_name, *p_name = NULL; #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ AFS_STATCNT(SRXAFSCB_GetLocalCell); - t_name = (char *)rxi_Alloc(AFSNAMEMAX); - if (t_name == NULL) { -#ifdef RX_ENABLE_LOCKS - AFS_GUNLOCK(); -#endif /* RX_ENABLE_LOCKS */ - return ENOMEM; - } - - t_name[0] = '\0'; - /* Search the list for the primary cell. Cell number 1 is only * the primary cell is when no other cell is explicitly marked as * the primary cell. */ @@ -1218,13 +1215,30 @@ int SRXAFSCB_GetLocalCell( tq = QNext(cq); tcell = QTOC(cq); if (tcell->states & CPrimary) { - strcpy(t_name, tcell->cellName); + p_name = tcell->cellName; break; } if (tcell->cell == 1) { - strcpy(t_name, tcell->cellName); + p_name = tcell->cellName; } } + + if (p_name) + plen = strlen(p_name); + else + plen = 0; + t_name = (char *)rxi_Alloc(plen+1); + if (t_name == NULL) { +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + return ENOMEM; + } + + t_name[plen] = '\0'; + if (p_name) + bcopy(p_name, t_name, plen); + ReleaseReadLock(&afs_xcell); #ifdef RX_ENABLE_LOCKS diff --git a/src/afs/afs_cbqueue.c b/src/afs/afs_cbqueue.c index 227a72a98..e4b3ac654 100644 --- a/src/afs/afs_cbqueue.c +++ b/src/afs/afs_cbqueue.c @@ -74,7 +74,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cbqueue.c,v 1.1.1.4 2001/07/14 22:19:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cbqueue.c,v 1.1.1.5 2001/09/11 14:24:37 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -367,7 +367,7 @@ int doLockInit; { register int i; -bzero((char *)cbHashT, CBHTSIZE*sizeof(struct bucket)); +memset((char *)cbHashT, 0, CBHTSIZE*sizeof(struct bucket)); for (i=0;i #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cell.c,v 1.1.1.6 2001/07/14 22:19:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cell.c,v 1.1.1.7 2001/09/11 14:24:38 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -386,7 +386,7 @@ afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport tc->states |= aflags; tc->timeout = timeout; - bzero((char *)tc->cellHosts, sizeof(tc->cellHosts)); + memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts)); for (i=0; i #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_conn.c,v 1.1.1.6 2001/07/14 22:19:20 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_conn.c,v 1.1.1.7 2001/09/11 14:24:38 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -172,7 +172,7 @@ struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport, */ UpgradeSToWLock(&afs_xconn,37); tc = (struct conn *) afs_osi_Alloc(sizeof(struct conn)); - bzero((char *)tc, sizeof(struct conn)); + memset((char *)tc, 0, sizeof(struct conn)); tc->user = tu; tc->port = aport; diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 9ceb9e585..79fb2635b 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -13,7 +13,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.5 2001/07/14 22:19:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.6 2001/09/11 14:24:39 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -1432,14 +1432,18 @@ struct tlocal1 { /* these fields are protected by the lock on the vcache and luck * on the dcache */ -#define updateV2DC(l,v,d,src) { if (l) ObtainWriteLock(&((v)->lock),src);\ - if (hsame((v)->m.DataVersion, (d)->f.versionNo) && (v)->callback) { \ - (v)->quick.dc = (d); \ - (v)->quick.stamp = (d)->stamp = MakeStamp(); \ - (v)->quick.minLoc = AFS_CHUNKTOBASE((d)->f.chunk); \ - /* Don't think I need these next two lines forever */ \ - (v)->quick.len = (d)->f.chunkBytes; \ - (v)->h1.dchint = (d); } if(l) ReleaseWriteLock(&((v)->lock)); } +#define updateV2DC(l,v,d,src) { \ + if (!l || 0 == NBObtainWriteLock(&((v)->lock),src)) { \ + if (hsame((v)->m.DataVersion, (d)->f.versionNo) && (v)->callback) { \ + (v)->quick.dc = (d); \ + (v)->quick.stamp = (d)->stamp = MakeStamp(); \ + (v)->quick.minLoc = AFS_CHUNKTOBASE((d)->f.chunk); \ + /* Don't think I need these next two lines forever */ \ + (v)->quick.len = (d)->f.chunkBytes; \ + (v)->h1.dchint = (d); \ + } \ + if(l) ReleaseWriteLock(&((v)->lock)); \ + } } struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) register struct vcache *avc; /*Held*/ @@ -2646,18 +2650,18 @@ void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, /* Allocate and zero the pointer array to the dcache entries */ afs_indexTable = (struct dcache **) afs_osi_Alloc(sizeof(struct dcache *) * afiles); - bzero((char *)afs_indexTable, sizeof(struct dcache *) * afiles); + memset((char *)afs_indexTable, 0, sizeof(struct dcache *) * afiles); afs_indexTimes = (afs_hyper_t *) afs_osi_Alloc(afiles * sizeof(afs_hyper_t)); - bzero((char *)afs_indexTimes, afiles * sizeof(afs_hyper_t)); + memset((char *)afs_indexTimes, 0, afiles * sizeof(afs_hyper_t)); afs_indexUnique = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_uint32)); - bzero((char *)afs_indexUnique, afiles * sizeof(afs_uint32)); + memset((char *)afs_indexUnique, 0, afiles * sizeof(afs_uint32)); afs_indexFlags = (u_char *) afs_osi_Alloc(afiles * sizeof(u_char)); - bzero((char *)afs_indexFlags, afiles * sizeof(char)); + memset((char *)afs_indexFlags, 0, afiles * sizeof(char)); /* Allocate and thread the struct dcache entries themselves */ tdp = afs_Initial_freeDSList = (struct dcache *) afs_osi_Alloc(aDentries * sizeof(struct dcache)); - bzero((char *)tdp, aDentries * sizeof(struct dcache)); + memset((char *)tdp, 0, aDentries * sizeof(struct dcache)); #ifdef AFS_AIX32_ENV pin((char *)afs_indexTable, sizeof(struct dcache *) * afiles);/* XXX */ pin((char *)afs_indexTimes, sizeof(afs_hyper_t) * afiles); /* XXX */ diff --git a/src/afs/afs_exporter.c b/src/afs/afs_exporter.c index dd57b69ad..8e7b48935 100644 --- a/src/afs/afs_exporter.c +++ b/src/afs/afs_exporter.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_exporter.c,v 1.1.1.4 2001/07/14 22:19:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_exporter.c,v 1.1.1.5 2001/09/11 14:24:40 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -37,7 +37,7 @@ char *data; } length = (size ? size : sizeof(struct afs_exporter)); ex = (struct afs_exporter *) afs_osi_Alloc(length); - bzero((char *)ex, length); + memset((char *)ex, 0, length); MObtainWriteLock(&afs_xexp,308); for (op = root_exported; op; op = op->exp_next) { if (!op->exp_next) diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index cef2af937..e9673fc49 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -16,7 +16,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_init.c,v 1.1.1.6 2001/07/14 22:19:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_init.c,v 1.1.1.7 2001/09/11 14:24:40 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -695,8 +695,8 @@ shutdown_cache() cacheInfoModTime = 0; afs_fsfragsize = 1023; - bzero((char *)&afs_stats_cmperf, sizeof(afs_stats_cmperf)); - bzero((char *)&cacheDev, sizeof(struct osi_dev)); + memset((char *)&afs_stats_cmperf, 0, sizeof(afs_stats_cmperf)); + memset((char *)&cacheDev, 0, sizeof(struct osi_dev)); osi_dnlc_shutdown(); } } /*shutdown_cache*/ @@ -860,7 +860,7 @@ void shutdown_AFS() afs_FVIndex = -1; afs_server = (struct rx_service *)0; RWLOCK_INIT(&afs_xconn, "afs_xconn"); - bzero((char *)&afs_rootFid, sizeof(struct VenusFid)); + memset((char *)&afs_rootFid, 0, sizeof(struct VenusFid)); RWLOCK_INIT(&afs_xuser, "afs_xuser"); RWLOCK_INIT(&afs_xvolume, "afs_xvolume"), RWLOCK_INIT(&afs_xcell, "afs_xcell"); RWLOCK_INIT(&afs_xserver, "afs_xserver"), LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock"); diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 2fa9cf0df..5c3fdd745 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_memcache.c,v 1.1.1.4 2001/07/14 22:19:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_memcache.c,v 1.1.1.5 2001/09/11 14:24:41 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #ifndef AFS_LINUX22_ENV @@ -73,7 +73,7 @@ afs_InitMemCache(size, blkSize, flags) if (blk == NULL) goto nomem; (memCache+index)->data = blk; - bzero((memCache+index)->data, memCacheBlkSize); + memset((memCache+index)->data, 0, memCacheBlkSize); } #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) afs_InitDualFSCacheOps((struct vnode*)0); @@ -132,7 +132,7 @@ afs_MemReadBlk(mceP, offset, dest, size) if(bytesRead > 0) { AFS_GUNLOCK(); - bcopy(mceP->data + offset, dest, bytesRead); + memcpy(dest, mceP->data + offset, bytesRead); AFS_GLOCK(); } else @@ -170,7 +170,7 @@ afs_MemReadvBlk(mceP, offset, iov, nio, size) for (i = 0 , size = bytesRead ; i < nio && size > 0 ; i++) { bytesToRead = (size < iov[i].iov_len) ? size : iov[i].iov_len; AFS_GUNLOCK(); - bcopy(mceP->data + offset, iov[i].iov_base, bytesToRead); + memcpy(iov[i].iov_base, mceP->data + offset, bytesToRead); AFS_GLOCK(); offset += bytesToRead; size -= bytesToRead; @@ -227,15 +227,15 @@ afs_MemWriteBlk(mceP, offset, src, size) /* may overlap, but this is OK */ AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = size+offset; } AFS_GUNLOCK(); if (mceP->size < offset) - bzero(mceP->data+mceP->size, offset-mceP->size); - bcopy(src, mceP->data + offset, size); + memset(mceP->data+mceP->size, 0, offset-mceP->size); + memcpy(mceP->data + offset, src, size); AFS_GLOCK(); mceP->size = (size+offset < mceP->size) ? mceP->size : size + offset; @@ -264,17 +264,17 @@ afs_MemWritevBlk(mceP, offset, iov, nio, size) /* may overlap, but this is OK */ AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = size+offset; } if (mceP->size < offset) - bzero(mceP->data+mceP->size, offset-mceP->size); + memset(mceP->data+mceP->size, 0, offset-mceP->size); for (bytesWritten = 0, i = 0 ; i < nio && size > 0 ; i++) { bytesToWrite = (size < iov[i].iov_len) ? size : iov[i].iov_len; AFS_GUNLOCK(); - bcopy(iov[i].iov_base, mceP->data + offset, bytesToWrite); + memcpy(mceP->data + offset, iov[i].iov_base, bytesToWrite); AFS_GLOCK(); offset += bytesToWrite; bytesWritten += bytesToWrite; @@ -301,14 +301,14 @@ afs_MemWriteUIO(blkno, uioP) mceP->data = afs_osi_Alloc(uioP->uio_resid + uioP->uio_offset); AFS_GUNLOCK(); - bcopy(oldData, mceP->data, mceP->size); + memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData,mceP->dataSize); mceP->dataSize = uioP->uio_resid + uioP->uio_offset; } if (mceP->size < uioP->uio_offset) - bzero(mceP->data+mceP->size, (int)(uioP->uio_offset-mceP->size)); + memset(mceP->data+mceP->size, 0, (int)(uioP->uio_offset-mceP->size)); AFS_UIOMOVE(mceP->data+uioP->uio_offset, uioP->uio_resid, UIO_WRITE, uioP, code); if (uioP->uio_offset > mceP->size) mceP->size = uioP->uio_offset; diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index 83952eeeb..c83173b05 100644 --- a/src/afs/afs_nfsclnt.c +++ b/src/afs/afs_nfsclnt.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsclnt.c,v 1.1.1.4 2001/07/14 22:19:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsclnt.c,v 1.1.1.5 2001/09/11 14:24:41 hartmans Exp $"); #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV) #ifndef AFS_DEC_ENV @@ -72,9 +72,9 @@ register afs_int32 uid, host; } } np = (struct nfsclientpag *) afs_osi_Alloc(sizeof (struct nfsclientpag)); - bzero((char *)np, sizeof(struct nfsclientpag)); + memset((char *)np, 0, sizeof(struct nfsclientpag)); /* Copy the necessary afs_exporter fields */ - bcopy((char *)afs_nfsexporter, (char *)np, sizeof(struct afs_exporter)); + memcpy((char *)np, (char *)afs_nfsexporter, sizeof(struct afs_exporter)); np->next = afs_nfspags[i]; afs_nfspags[i] = np; np->uid = uid; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index 8499bd353..bfb29ca24 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.6 2001/07/14 22:19:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.7 2001/09/11 14:24:42 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -72,7 +72,7 @@ void osi_Init() if ( !afs_osicred_initialized ) { - bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED)); + memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED)); crhold(&afs_osi_cred); /* don't let it evaporate */ afs_osicred_initialized = 1; } @@ -935,7 +935,7 @@ const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr) cr.cr_ref=1; cr.cr_uid=pr->p_cred->pc_ucred->cr_uid; cr.cr_ngroups=pr->p_cred->pc_ucred->cr_ngroups; - bcopy(pr->p_cred->pc_ucred->cr_groups, cr.cr_groups,NGROUPS * + memcpy(cr.cr_groups, pr->p_cred->pc_ucred->cr_groups, NGROUPS * sizeof(gid_t)); pcred_unlock(pr); rv = &cr; diff --git a/src/afs/afs_osi_uio.c b/src/afs/afs_osi_uio.c index bc5227227..ee17fa622 100644 --- a/src/afs/afs_osi_uio.c +++ b/src/afs/afs_osi_uio.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_uio.c,v 1.1.1.4 2001/07/14 22:19:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_uio.c,v 1.1.1.5 2001/09/11 14:24:42 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -33,11 +33,11 @@ register struct iovec *aoutvec; { AFS_STATCNT(afsio_copy); if (ainuio->afsio_iovcnt > AFS_MAXIOVCNT) return EINVAL; - bcopy((char *)ainuio, (char *)aoutuio, sizeof(struct uio)); + memcpy((char *)aoutuio, (char *)ainuio, sizeof(struct uio)); tvec = ainuio->afsio_iov; aoutuio->afsio_iov = aoutvec; for(i=0;iafsio_iovcnt;i++){ - bcopy((char *)tvec, (char *)aoutvec, sizeof(struct iovec)); + memcpy((char *)aoutvec, (char *)tvec, sizeof(struct iovec)); tvec++; /* too many compiler bugs to do this as one expr */ aoutvec++; } diff --git a/src/afs/afs_osi_vget.c b/src/afs/afs_osi_vget.c index ab18cd008..771a25a2d 100644 --- a/src/afs/afs_osi_vget.c +++ b/src/afs/afs_osi_vget.c @@ -14,7 +14,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_vget.c,v 1.1.1.4 2001/07/14 22:19:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_vget.c,v 1.1.1.5 2001/09/11 14:24:43 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -37,7 +37,7 @@ int afs_osi_vget(struct vcache **avcpp, struct fid *afidp, register afs_int32 code = 0, cellindex; afs_int32 ret; - bcopy(afidp->fid_data, (char *)&Sfid, SIZEOF_SMALLFID); + memcpy((char *)&Sfid, afidp->fid_data, SIZEOF_SMALLFID); #ifdef AFS_OSF_ENV Sfid.Vnode = afidp->fid_reserved; #endif diff --git a/src/afs/afs_osidnlc.c b/src/afs/afs_osidnlc.c index 95de075e5..bfeed8ef7 100644 --- a/src/afs/afs_osidnlc.c +++ b/src/afs/afs_osidnlc.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osidnlc.c,v 1.1.1.4 2001/07/14 22:19:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osidnlc.c,v 1.1.1.5 2001/09/11 14:24:43 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -174,7 +174,7 @@ retry: tnc->dirp = adp; tnc->vp = avc; tnc->key = key; - bcopy (aname, (char *)tnc->name, ts-aname+1); /* include the NULL */ + memcpy((char *)tnc->name, aname, ts-aname+1); /* include the NULL */ InsertEntry(tnc); } else { @@ -446,8 +446,8 @@ int osi_dnlc_purge() } else { /* did get the lock */ ncfreelist = (struct nc *) 0; - bzero ((char *)nameCache, sizeof(struct nc) * NCSIZE); - bzero ((char *)nameHash, sizeof(struct nc *) * NHSIZE); + memset((char *)nameCache, 0, sizeof(struct nc) * NCSIZE); + memset((char *)nameHash, 0, sizeof(struct nc *) * NHSIZE); for (i=0; i #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_segments.c,v 1.1.1.4 2001/07/14 22:19:27 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_segments.c,v 1.1.1.5 2001/09/11 14:24:45 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -237,7 +237,7 @@ afs_StoreAllSegments(avc, areq, sync) minj = 0 ; do { - bzero ((char *)dcList, NCHUNKSATONCE * sizeof(struct dcache *)); + memset((char *)dcList, 0, NCHUNKSATONCE * sizeof(struct dcache *)); high = 0; moredata = FALSE; @@ -448,7 +448,7 @@ afs_StoreAllSegments(avc, areq, sync) while (sbytes > 0) { tlen = (sbytes > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : sbytes); - bzero(tbuffer, tlen); + memset(tbuffer, 0, tlen); #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 1729981e8..e596e613e 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -32,7 +32,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.8 2001/07/14 22:19:27 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.9 2001/09/11 14:24:45 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -380,26 +380,22 @@ void afs_CountServers() afs_stats_cmperf.fs_UpDown[0].sumOfRecordAges = 0; afs_stats_cmperf.fs_UpDown[0].ageOfYoungestRecord = 0; afs_stats_cmperf.fs_UpDown[0].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.fs_UpDown[0].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.fs_UpDown[0].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.fs_UpDown[1].sumOfRecordAges = 0; afs_stats_cmperf.fs_UpDown[1].ageOfYoungestRecord = 0; afs_stats_cmperf.fs_UpDown[1].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.fs_UpDown[1].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.fs_UpDown[1].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.vl_UpDown[0].sumOfRecordAges = 0; afs_stats_cmperf.vl_UpDown[0].ageOfYoungestRecord = 0; afs_stats_cmperf.vl_UpDown[0].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.vl_UpDown[0].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.vl_UpDown[0].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); afs_stats_cmperf.vl_UpDown[1].sumOfRecordAges = 0; afs_stats_cmperf.vl_UpDown[1].ageOfYoungestRecord = 0; afs_stats_cmperf.vl_UpDown[1].ageOfOldestRecord = 0; - bzero((char *) afs_stats_cmperf.vl_UpDown[1].downIncidents, - AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); + memset((char *) afs_stats_cmperf.vl_UpDown[1].downIncidents, 0, AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS * sizeof(afs_int32)); /* * Compute the current time, used to figure out server record ages. @@ -661,7 +657,7 @@ struct server *afs_FindServer (afs_int32 aserver, ushort aport, i = afs_uuid_hash(uuidp) % NSERVERS; for (ts = afs_servers[i]; ts; ts = ts->next) { if ( (ts->flags & SRVR_MULTIHOMED) && - (bcmp((char *)uuidp, (char *)&ts->sr_uuid, sizeof(*uuidp)) == 0) && + (memcmp((char *)uuidp, (char *)&ts->sr_uuid, sizeof(*uuidp)) == 0) && (!ts->addr || (ts->addr->sa_portal == aport)) ) return ts; } @@ -972,8 +968,8 @@ typedef struct ill_s { /**/ #endif #ifdef AFS_USERSPACE_IP_ADDR -#ifndef min -#define min(A,B) ((A)<(B)) ? (A) : (B) +#ifndef afs_min +#define afs_min(A,B) ((A)<(B)) ? (A) : (B) #endif /* * The IP addresses and ranks are determined by afsd (in user space) and @@ -1004,12 +1000,12 @@ afsi_SetServerIPRank(sa, addr, subnetmask) if ( (serverAddr & netMask ) == myNet ) { if ( (serverAddr & subnetmask ) == mySubnet) { if ( serverAddr == myAddr ) { /* same machine */ - sa->sa_iprank = min(sa->sa_iprank, TOPR); + sa->sa_iprank = afs_min(sa->sa_iprank, TOPR); } else { /* same subnet */ - sa->sa_iprank = min(sa->sa_iprank, HI); + sa->sa_iprank = afs_min(sa->sa_iprank, HI); } } else { /* same net */ - sa->sa_iprank = min(sa->sa_iprank, MED); + sa->sa_iprank = afs_min(sa->sa_iprank, MED); } } } @@ -1382,7 +1378,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, newts = (struct server *) afs_osi_Alloc(sizeof(struct server)); if (!newts) panic("malloc of server struct"); afs_totalServers++; - bzero((char *)newts, sizeof(struct server)); + memset((char *)newts, 0, sizeof(struct server)); /* Add the server struct to the afs_servers[] hash chain */ srvhash = (uuidp ? (afs_uuid_hash(uuidp)%NSERVERS) : SHash(aserverp[0])); @@ -1423,7 +1419,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, newsa = (struct srvAddr *) afs_osi_Alloc(sizeof(struct srvAddr)); if (!newsa) panic("malloc of srvAddr struct"); afs_totalSrvAddrs++; - bzero((char *)newsa, sizeof(struct srvAddr)); + memset((char *)newsa, 0, sizeof(struct srvAddr)); /* Add the new srvAddr to the afs_srvAddrs[] hash chain */ newsa->next_bkt = afs_srvAddrs[iphash]; @@ -1471,7 +1467,7 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers, if (!orphts) { orphts = (struct server *) afs_osi_Alloc(sizeof(struct server)); if (!orphts) panic("malloc of lo server struct"); - bzero((char *)orphts, sizeof(struct server)); + memset((char *)orphts, 0, sizeof(struct server)); afs_totalServers++; /* Add the orphaned server to the afs_servers[] hash chain. diff --git a/src/afs/afs_stat.c b/src/afs/afs_stat.c index cf4940092..537cf8122 100644 --- a/src/afs/afs_stat.c +++ b/src/afs/afs_stat.c @@ -12,7 +12,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_stat.c,v 1.1.1.4 2001/07/14 22:19:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_stat.c,v 1.1.1.5 2001/09/11 14:24:46 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -48,10 +48,9 @@ void afs_InitStats() /* * First step is to zero everything out. */ - bzero((char *)(&afs_cmstats), sizeof(struct afs_CMStats)); - bzero((char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf)); - bzero((char *)(&afs_stats_cmfullperf), - sizeof(struct afs_stats_CMFullPerf)); + memset((char *)(&afs_cmstats), 0, sizeof(struct afs_CMStats)); + memset((char *)(&afs_stats_cmperf), 0, sizeof(struct afs_stats_CMPerf)); + memset((char *)(&afs_stats_cmfullperf), 0, sizeof(struct afs_stats_CMFullPerf)); /* * Some fields really should be non-zero at the start, so set 'em up. diff --git a/src/afs/afs_user.c b/src/afs/afs_user.c index 4949f4f35..81c08b7aa 100644 --- a/src/afs/afs_user.c +++ b/src/afs/afs_user.c @@ -13,7 +13,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_user.c,v 1.1.1.6 2001/07/14 22:19:28 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_user.c,v 1.1.1.7 2001/09/11 14:24:47 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -479,7 +479,7 @@ struct unixuser *afs_GetUser(auid, acell, locktype) #ifndef AFS_NOSTATS afs_stats_cmfullperf.authent.PAGCreations++; #endif /* AFS_NOSTATS */ - bzero((char *)tu, sizeof(struct unixuser)); + memset((char *)tu, 0, sizeof(struct unixuser)); tu->next = afs_users[i]; afs_users[i] = tu; if (RmtUser) { diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 55339b2c6..b43be2bb9 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -38,7 +38,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.7 2001/07/14 22:19:27 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.8 2001/09/11 14:24:48 hartmans Exp $"); #include "../afs/sysincludes.h" /*Standard vendor system headers*/ #include "../afs/afsincludes.h" /*AFS-based standard headers*/ @@ -752,7 +752,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif /* AFS_MACH_ENV */ #if defined(AFS_SGI_ENV) { char name[METER_NAMSZ]; - bzero(tvc, sizeof(struct vcache)); + memset(tvc, 0, sizeof(struct vcache)); tvc->v.v_number = ++afsvnumbers; tvc->vc_rwlockid = OSI_NO_LOCKID; initnsema(&tvc->vc_rwlock, 1, makesname(name, "vrw", tvc->v.v_number)); @@ -777,7 +777,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif /* AFS_MACH_ENV */ #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) - bzero((char *)tvc, sizeof(struct vcache)); + memset((char *)tvc, 0, sizeof(struct vcache)); #else tvc->uncred = 0; #endif @@ -851,10 +851,10 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #ifdef AFS_AIX_ENV /* Don't forget to free the gnode space */ tvc->v.v_gnode = gnodepnt = (struct gnode *) osi_AllocSmallSpace(sizeof(struct gnode)); - bzero((char *)gnodepnt, sizeof(struct gnode)); + memset((char *)gnodepnt, 0, sizeof(struct gnode)); #endif #ifdef AFS_SGI64_ENV - bzero((void*)&(tvc->vc_bhv_desc), sizeof(tvc->vc_bhv_desc)); + memset((void*)&(tvc->vc_bhv_desc), 0, sizeof(tvc->vc_bhv_desc)); bhv_desc_init(&(tvc->vc_bhv_desc), tvc, tvc, &Afs_vnodeops); #ifdef AFS_SGI65_ENV vn_bhv_head_init(&(tvc->v.v_bh), "afsvp"); @@ -974,8 +974,8 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, #endif tvc->h1.dchint = 0; osi_dnlc_purgedp(tvc); /* this may be overkill */ - bzero((char *)&(tvc->quick),sizeof(struct vtodc)); - bzero((char *)&(tvc->callsort),sizeof(struct afs_q)); + memset((char *)&(tvc->quick), 0, sizeof(struct vtodc)); + memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q)); tvc->slocks = (struct SimpleLocks *)0; i = VCHash(afid); @@ -2602,7 +2602,7 @@ void afs_vcacheInit(int astatSize) #if !defined(AFS_OSF_ENV) /* Allocate and thread the struct vcache entries */ tvp = (struct vcache *) afs_osi_Alloc(astatSize * sizeof(struct vcache)); - bzero((char *)tvp, sizeof(struct vcache)*astatSize); + memset((char *)tvp, 0, sizeof(struct vcache)*astatSize); Initial_freeVCList = tvp; freeVCList = &(tvp[0]); diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 3f7c1e6f3..d197e5863 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -18,7 +18,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.5 2001/07/14 22:19:29 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.6 2001/09/11 14:24:48 hartmans Exp $"); #include "../afs/stds.h" #include "../afs/sysincludes.h" /* Standard vendor system headers */ @@ -464,7 +464,7 @@ static struct volume *afs_SetupVolume(volid, aname, ve, tcell, agood, type, areq struct fvolume *tf=0; tv = afs_GetVolSlot(); - bzero((char *)tv, sizeof(struct volume)); + memset((char *)tv, 0, sizeof(struct volume)); tv->cell = tcell->cell; RWLOCK_INIT(&tv->lock, "volume lock"); tv->next = afs_volumes[i]; /* thread into list */ @@ -912,11 +912,11 @@ void InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, ListAddrByAttributes attrs; afsUUID uuid; - bzero((char *)&attrs, sizeof(attrs)); + memset((char *)&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_UUID; attrs.uuid = ve->serverNumber[i]; - bzero((char *)&uuid, sizeof(uuid)); - bzero((char *)&addrs, sizeof(addrs)); + memset((char *)&uuid, 0, sizeof(uuid)); + memset((char *)&addrs, 0, sizeof(addrs)); do { tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cell, areq, SHARED_LOCK); diff --git a/src/afsd/afs.rc.darwin b/src/afsd/afs.rc.darwin index d82d4efe7..ed0509004 100644 --- a/src/afsd/afs.rc.darwin +++ b/src/afsd/afs.rc.darwin @@ -50,6 +50,7 @@ if kmodstat | grep -q openafs ; then : else echo "AFS kernel extensions failed to initialize. Skipping AFS startup." + exit 1 fi # diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index cbc7a90ba..b9547960b 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -48,13 +48,14 @@ * This option is now disabled. * -logfile Place where to put the logfile (default in /etc/AFSLog. * -waitclose make close calls always synchronous (slows em down, tho) + * -files_per_subdir [n] number of files per cache subdir. (def=2048) * -shutdown Shutdown afs daemons *---------------------------------------------------------------------------*/ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.8 2001/07/14 22:20:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.9 2001/09/11 14:30:47 hartmans Exp $"); #define VFS 1 @@ -201,7 +202,7 @@ char fullpn_VolInfoFile[1024]; /*Full pathname of VOLINFOFILE*/ char fullpn_AFSLogFile[1024]; /*Full pathname of AFSLOGFILE*/ char fullpn_CacheInfo[1024]; /*Full pathname of CACHEINFO*/ char fullpn_VFile[1024]; /*Full pathname of data cache files*/ -char *vFileNumber; /*Ptr to the number part of above pathname*/ +char *vFilePtr; /*Ptr to the number part of above pathname*/ int sawCacheMountDir = 0; /* from cmd line */ int sawCacheBaseDir = 0; int sawCacheBlocks = 0; @@ -215,6 +216,7 @@ afs_int32 lookingForHomeCell; /*Are we still looking for the home cell?*/ int createAndTrunc = O_CREAT | O_TRUNC; /*Create & truncate on open*/ int ownerRWmode = 0600; /*Read/write OK by owner*/ static int filesSet = 0; /*True if number of files explicitly set*/ +static int nFilesPerDir = 2048; /* # files per cache dir */ static int nDaemons = 2; /* Number of background daemons */ static int chunkSize = 0; /* 2^chunkSize bytes per chunk */ static int dCacheSize = 300; /* # of dcache entries */ @@ -241,6 +243,17 @@ int afsd_CloseSynch = 0; /*Are closes synchronous or not? */ #else #define AFSD_INO_T afs_uint32 #endif +struct afsd_file_list { + int fileNum; + struct afsd_file_list *next; +}; +struct afsd_file_list **cache_dir_filelist = NULL; +int *cache_dir_list = NULL; /* Array of cache subdirs */ +int *dir_for_V = NULL; /* Array: dir of each cache file. + * -1: file does not exist + * -2: file exists in top-level + * >=0: file exists in Dxxx + */ AFSD_INO_T *inode_for_V; /* Array of inodes for desired * cache files */ int missing_DCacheFile = 1; /*Is the DCACHEFILE missing?*/ @@ -403,6 +416,7 @@ int cs; * * Arguments: * fname : Char ptr to the filename to parse. + * max : integer for the highest number to accept * * Returns: * >= 0 iff the file is really a data cache file numbered from 0 to cacheFiles-1, or @@ -415,21 +429,23 @@ int cs; * None. *---------------------------------------------------------------------------*/ -int GetVFileNumber(fname) +static int doGetXFileNumber(fname, filechar, maxNum) char *fname; + char filechar; + int maxNum; { int computedVNumber; /*The computed file number we return*/ int filenameLen; /*Number of chars in filename*/ int currDigit; /*Current digit being processed*/ /* - * The filename must have at least two characters, the first of which must be a ``V'' + * The filename must have at least two characters, the first of which must be a ``filechar'' * and the second of which cannot be a zero unless the file is exactly two chars long. */ filenameLen = strlen(fname); if (filenameLen < 2) return(-1); - if (fname[0] != 'V') + if (fname[0] != filechar) return(-1); if ((filenameLen > 2) && (fname[1] == '0')) return(-1); @@ -453,6 +469,21 @@ int GetVFileNumber(fname) return(-1); } +int GetVFileNumber(fname, maxFile) + char *fname; + int maxFile; +{ + return doGetXFileNumber(fname, 'V', maxFile); +} + +int GetDDirNumber(fname, maxDir) + char *fname; + int maxDir; +{ + return doGetXFileNumber(fname, 'D', maxDir); +} + + /*----------------------------------------------------------------------------- * CreateCacheFile * @@ -462,6 +493,8 @@ int GetVFileNumber(fname) * * Arguments: * fname : Full pathname of file to create. + * statp : A pointer to a stat buffer which, if NON-NULL, will be + * filled by fstat() * * Returns: * 0 iff the file was created, @@ -474,8 +507,81 @@ int GetVFileNumber(fname) * As described. *---------------------------------------------------------------------------*/ -int CreateCacheFile(fname) +static int CreateCacheSubDir (basename, dirNum) + char *basename; + int dirNum; +{ + static char rn[] = "CreateCacheSubDir"; /* Routine Name */ + char dir[1024]; + int ret; + + /* Build the new cache subdirectory */ + sprintf (dir, "%s/D%d", basename, dirNum); + + if (afsd_verbose) + printf("%s: Creating cache subdir '%s'\n", + rn, dir); + + if ((ret = mkdir(dir, 0700)) != 0) { + printf("%s: Can't create '%s', error return is %d (%d)\n", + rn, dir, ret, errno); + if (errno != EEXIST) + return (-1); + } + + /* Mark this directory as created */ + cache_dir_list[dirNum] = 0; + + /* And return success */ + return (0); +} + +static int MoveCacheFile (basename, fromDir, toDir, cacheFile, maxDir) + char *basename; + int fromDir, toDir, cacheFile, maxDir; +{ + static char rn[] = "MoveCacheFile"; + char from[1024], to[1024]; + int ret; + + if (cache_dir_list[toDir] < 0 && + (ret = CreateCacheSubDir(basename, toDir))) { + printf("%s: Can't create directory '%s/D%d'\n", rn, basename, toDir); + return ret; + } + + /* Build the from,to dir */ + if (fromDir < 0) { + /* old-style location */ + snprintf (from, sizeof(from), "%s/V%d", basename, cacheFile); + } else { + snprintf (from, sizeof(from), "%s/D%d/V%d", basename, fromDir, cacheFile); + } + + snprintf (to, sizeof(from), "%s/D%d/V%d", basename, toDir, cacheFile); + + if (afsd_verbose) + printf("%s: Moving cacheFile from '%s' to '%s'\n", + rn, from, to); + + if ((ret = rename (from, to)) != 0) { + printf("%s: Can't rename '%s' to '%s', error return is %d (%d)\n", + rn, from, to, ret, errno); + return -1; + } + + /* Reset directory pointer; fix file counts */ + dir_for_V[cacheFile] = toDir; + cache_dir_list[toDir]++; + if (fromDir < maxDir && fromDir >= 0) + cache_dir_list[fromDir]--; + + return 0; +} + +int CreateCacheFile(fname, statp) char *fname; + struct stat *statp; { static char rn[] = "CreateCacheFile"; /*Routine name*/ int cfd; /*File descriptor to AFS cache file*/ @@ -490,6 +596,14 @@ int CreateCacheFile(fname) rn, fname, cfd, errno); return(-1); } + if (statp != NULL) { + closeResult = fstat (cfd, statp); + if (closeResult) { + printf("%s: Can't stat newly-created AFS cache file '%s' (code %d)\n", + rn, fname, errno); + return(-1); + } + } closeResult = close(cfd); if (closeResult) { printf("%s: Can't close newly-created AFS cache file '%s' (code %d)\n", @@ -505,7 +619,7 @@ int CreateCacheFile(fname) * * Description: * Sweep through the AFS cache directory, recording the inode number for - * each valid data cache file there. Also, delete any file that doesn't beint32 + * each valid data cache file there. Also, delete any file that doesn't belong * in the cache directory during this sweep, and remember which of the other * residents of this directory were seen. After the sweep, we create any data * cache files that were missing. @@ -528,10 +642,14 @@ int CreateCacheFile(fname) * explained above. *---------------------------------------------------------------------------*/ -int SweepAFSCache(vFilesFound) - int *vFilesFound; + +static int doSweepAFSCache(vFilesFound,directory,dirNum,maxDir) + int *vFilesFound; + char *directory; /* /path/to/cache/directory */ + int dirNum; /* current directory number */ + int maxDir; /* maximum directory number */ { - static char rn[] = "SweepAFSCache"; /*Routine name*/ + static char rn[] = "doSweepAFSCache"; /* Routine Name */ char fullpn_FileToDelete[1024]; /*File to be deleted from cache*/ char *fileToDelete; /*Ptr to last component of above*/ DIR *cdirp; /*Ptr to cache directory structure*/ @@ -541,36 +659,30 @@ int SweepAFSCache(vFilesFound) struct dirent *currp; /*Current directory entry*/ #endif int vFileNum; /*Data cache file's associated number*/ - - if (cacheFlags & AFSCALL_INIT_MEMCACHE) { - if (afsd_debug) - printf("%s: Memory Cache, no cache sweep done\n", rn); - *vFilesFound = 0; - return 0; - } + int thisDir; /* A directory number */ + int highDir = 0; if (afsd_debug) - printf("%s: Opening cache directory '%s'\n", - rn, cacheBaseDir); + printf("%s: Opening cache directory '%s'\n", rn, directory); - if (chmod(cacheBaseDir, 0700)) { /* force it to be 700 */ - printf("%s: Can't 'chmod 0700' the cache dir, '%s'.\n", - rn, cacheBaseDir); + if (chmod(directory, 0700)) { /* force it to be 700 */ + printf("%s: Can't 'chmod 0700' the cache dir, '%s'.\n", rn, directory); return (-1); } - cdirp = opendir(cacheBaseDir); + cdirp = opendir(directory); if (cdirp == (DIR *)0) { - printf("%s: Can't open AFS cache directory, '%s'.\n", - rn, cacheBaseDir); + printf("%s: Can't open AFS cache directory, '%s'.\n", rn, directory); return(-1); } /* - * Scan the directory entries, remembering data cache file inodes and the existance - * of other important residents. Delete all files that don't belong here. + * Scan the directory entries, remembering data cache file inodes + * and the existance of other important residents. Recurse into + * the data subdirectories. + * + * Delete all files and directories that don't belong here. */ - *vFilesFound = 0; - sprintf(fullpn_FileToDelete, "%s/", cacheBaseDir); + sprintf(fullpn_FileToDelete, "%s/", directory); fileToDelete = fullpn_FileToDelete + strlen(fullpn_FileToDelete); #ifdef AFS_SGI62_ENV @@ -592,24 +704,87 @@ int SweepAFSCache(vFilesFound) } /* - * Guess current entry is for a data cache file. + * If dirNum < 0, we are a top-level cache directory and should + * only contain sub-directories and other sundry files. Therefore, + * V-files are valid only if dirNum >= 0, and Directories are only + * valid if dirNum < 0. */ - vFileNum = GetVFileNumber(currp->d_name); - if (vFileNum >= 0) { + + if (*(currp->d_name) == 'V' && + ((vFileNum = GetVFileNumber(currp->d_name, cacheFiles)) >= 0)) { /* - * Found a valid data cache filename. Remember this file's inode and bump - * the number of files found. + * Found a valid data cache filename. Remember this + * file's inode, directory, and bump the number of files found + * total and in this directory. */ inode_for_V[vFileNum] = currp->d_ino; + dir_for_V[vFileNum] = dirNum; /* remember this directory */ + + if (!maxDir) { + /* If we're in a real subdir, mark this file to be moved + * if we've already got too many files in this directory + */ + assert(dirNum >= 0); + cache_dir_list[dirNum]++; /* keep directory's file count */ + if (cache_dir_list[dirNum] > nFilesPerDir) { + /* Too many files -- add to filelist */ + struct afsd_file_list *tmp = (struct afsd_file_list *) + malloc(sizeof(*tmp)); + if (!tmp) + printf ("%s: MALLOC FAILED allocating file_list entry\n", + rn); + else { + tmp->fileNum = vFileNum; + tmp->next = cache_dir_filelist[dirNum]; + cache_dir_filelist[dirNum] = tmp; + } + } + } (*vFilesFound)++; } - else if (strcmp(currp->d_name, DCACHEFILE) == 0) { + else if (dirNum < 0 && (*(currp->d_name) == 'D') && + GetDDirNumber(currp->d_name, 1<<30) >= 0) { + int retval = 0; + if ((vFileNum = GetDDirNumber(currp->d_name, maxDir)) >= 0) { + /* Found a valid cachefile sub-Directory. Remember this number + * and recurse into it. Note that subdirs cannot have subdirs. + */ + retval = 1; + } else if ((vFileNum = GetDDirNumber(currp->d_name, 1<<30)) >= 0) { + /* This directory is going away, but figure out if there + * are any cachefiles in here that should be saved by + * moving them to other cache directories. This directory + * will be removed later. + */ + retval = 2; + } + + /* Save the highest directory number we've seen */ + if (vFileNum > highDir) + highDir = vFileNum; + + /* If this directory is staying, be sure to mark it as 'found' */ + if (retval == 1) cache_dir_list[vFileNum] = 0; + + /* Print the dirname for recursion */ + sprintf(fileToDelete, "%s", currp->d_name); + + /* Note: vFileNum is the directory number */ + retval = doSweepAFSCache(vFilesFound, fullpn_FileToDelete, + vFileNum, (retval == 1 ? 0 : -1)); + if (retval) { + printf ("%s: Recursive sweep failed on directory %s\n", + rn, currp->d_name); + return retval; + } + } + else if (dirNum < 0 && strcmp(currp->d_name, DCACHEFILE) == 0) { /* * Found the file holding the dcache entries. */ missing_DCacheFile = 0; } - else if (strcmp(currp->d_name, VOLINFOFILE) == 0) { + else if (dirNum < 0 && strcmp(currp->d_name, VOLINFOFILE) == 0) { /* * Found the file holding the volume info. */ @@ -630,55 +805,149 @@ int SweepAFSCache(vFilesFound) } else { /* - * This file doesn't belong in the cache. Nuke it. + * This file/directory doesn't belong in the cache. Nuke it. */ sprintf(fileToDelete, "%s", currp->d_name); if (afsd_verbose) printf("%s: Deleting '%s'\n", rn, fullpn_FileToDelete); if (unlink(fullpn_FileToDelete)) { - printf("%s: Can't unlink '%s', errno is %d\n", - rn, fullpn_FileToDelete, errno); + if (errno == EISDIR && *fileToDelete == 'D') { + if (rmdir(fullpn_FileToDelete)) { + printf("%s: Can't rmdir '%s', errno is %d\n", + rn, fullpn_FileToDelete, errno); + } + } else + printf("%s: Can't unlink '%s', errno is %d\n", + rn, fullpn_FileToDelete, errno); } } } - /* - * Create all the cache files that are missing. - */ - if (missing_DCacheFile) { - if (afsd_verbose) - printf("%s: Creating '%s'\n", - rn, fullpn_DCacheFile); - if (CreateCacheFile(fullpn_DCacheFile)) - printf("%s: Can't create '%s'\n", - rn, fullpn_DCacheFile); - } - if (missing_VolInfoFile) { - if (afsd_verbose) - printf("%s: Creating '%s'\n", - rn, fullpn_VolInfoFile); - if (CreateCacheFile(fullpn_VolInfoFile)) - printf("%s: Can't create '%s'\n", - rn, fullpn_VolInfoFile); - } + if (dirNum < 0) { - if (*vFilesFound < cacheFiles) { - /* - * We came up short on the number of data cache files found. Scan through the inode - * list and create all missing files. + /* + * Create all the cache files that are missing. */ - for (vFileNum = 0; vFileNum < cacheFiles; vFileNum++) - if (inode_for_V[vFileNum] == (AFSD_INO_T)0) { - sprintf(vFileNumber, "%d", vFileNum); - if (afsd_verbose) - printf("%s: Creating '%s'\n", - rn, fullpn_VFile); - if (CreateCacheFile(fullpn_VFile)) - printf("%s: Can't create '%s'\n", - rn, fullpn_VFile); + if (missing_DCacheFile) { + if (afsd_verbose) + printf("%s: Creating '%s'\n", + rn, fullpn_DCacheFile); + if (CreateCacheFile(fullpn_DCacheFile, NULL)) + printf("%s: Can't create '%s'\n", + rn, fullpn_DCacheFile); + } + if (missing_VolInfoFile) { + if (afsd_verbose) + printf("%s: Creating '%s'\n", + rn, fullpn_VolInfoFile); + if (CreateCacheFile(fullpn_VolInfoFile, NULL)) + printf("%s: Can't create '%s'\n", + rn, fullpn_VolInfoFile); + } + + /* ADJUST CACHE FILES */ + + /* First, let's walk through the list of files and figure out + * if there are any leftover files in extra directories or + * missing files. Move the former and create the latter in + * subdirs with extra space. + */ + + thisDir = 0; /* Keep track of which subdir has space */ + + for (vFileNum = 0; vFileNum < cacheFiles; vFileNum++) { + if (dir_for_V[vFileNum] == -1) { + /* This file does not exist. Create it in the first + * subdir that still has extra space. + */ + while (thisDir < maxDir && + cache_dir_list[thisDir] >= nFilesPerDir) + thisDir++; + if (thisDir >= maxDir) + printf("%s: can't find directory to create V%d\n", rn, vFileNum); + else { + struct stat statb; + assert (inode_for_V[vFileNum] == (AFSD_INO_T)0); + sprintf(vFilePtr, "D%d/V%d", thisDir, vFileNum); + if (afsd_verbose) + printf("%s: Creating '%s'\n", rn, fullpn_VFile); + if (cache_dir_list[thisDir] < 0 && + CreateCacheSubDir(directory, thisDir)) + printf("%s: Can't create directory for '%s'\n", + rn, fullpn_VFile); + if (CreateCacheFile(fullpn_VFile, &statb)) + printf("%s: Can't create '%s'\n", rn, fullpn_VFile); + else { + inode_for_V[vFileNum] = statb.st_ino; + dir_for_V[vFileNum] = thisDir; + cache_dir_list[thisDir]++; + (*vFilesFound)++; + } } - } + + } else if (dir_for_V[vFileNum] >= maxDir || + dir_for_V[vFileNum] == -2) { + /* This file needs to move; move it to the first subdir + * that has extra space. (-2 means it's in the toplevel) + */ + while (thisDir < maxDir && cache_dir_list[thisDir] >= nFilesPerDir) + thisDir++; + if (thisDir >= maxDir) + printf("%s: can't find directory to move V%d\n", rn, vFileNum); + else { + if (MoveCacheFile (directory, dir_for_V[vFileNum], thisDir, + vFileNum, maxDir)) { + /* Cannot move. Ignore this file??? */ + /* XXX */ + } + } + } + } /* for */ + + /* At this point, we've moved all of the valid cache files + * into the valid subdirs, and created all the extra + * cachefiles we need to create. Next, rebalance any subdirs + * with too many cache files into the directories with not + * enough cache files. Note that thisDir currently sits at + * the lowest subdir that _may_ have room. + */ + + for (dirNum = 0; dirNum < maxDir; dirNum++) { + struct afsd_file_list *thisFile; + + for (thisFile = cache_dir_filelist[dirNum]; + thisFile && cache_dir_list[dirNum] >= nFilesPerDir; + thisFile = thisFile->next) { + while (thisDir < maxDir && cache_dir_list[thisDir] >= nFilesPerDir) + thisDir++; + if (thisDir >= maxDir) + printf("%s: can't find directory to move V%d\n", rn, vFileNum); + else { + if (MoveCacheFile (directory, dirNum, thisDir, + thisFile->fileNum, maxDir)) { + /* Cannot move. Ignore this file??? */ + /* XXX */ + } + } + } /* for each file to move */ + } /* for each directory */ + + /* Remove any directories >= maxDir -- they should be empty */ + for (; highDir >= maxDir; highDir--) { + sprintf(fileToDelete, "D%d", highDir); + if (unlink(fullpn_FileToDelete)) { + if (errno == EISDIR && *fileToDelete == 'D') { + if (rmdir(fullpn_FileToDelete)) { + printf("%s: Can't rmdir '%s', errno is %d\n", + rn, fullpn_FileToDelete, errno); + } + } else + printf("%s: Can't unlink '%s', errno is %d\n", + rn, fullpn_FileToDelete, errno); + } + } + } /* dirNum < 0 */ /* * Close the directory, return success. @@ -690,6 +959,61 @@ int SweepAFSCache(vFilesFound) return(0); } +int SweepAFSCache(vFilesFound) + int *vFilesFound; +{ + static char rn[] = "SweepAFSCache"; /*Routine name*/ + int maxDir = (cacheFiles + nFilesPerDir - 1 ) / nFilesPerDir; + int i; + + *vFilesFound = 0; + + if (cacheFlags & AFSCALL_INIT_MEMCACHE) { + if (afsd_debug) + printf("%s: Memory Cache, no cache sweep done\n", rn); + return 0; + } + + if (cache_dir_list == NULL) { + cache_dir_list = (int *) malloc (maxDir * sizeof(*cache_dir_list)); + if (cache_dir_list == NULL) { + printf("%s: Malloc Failed!\n", rn); + return (-1); + } + for (i=0; i < maxDir; i++) + cache_dir_list[i] = -1; /* Does not exist */ + } + + if (cache_dir_filelist == NULL) { + cache_dir_filelist = (struct afsd_file_list **) + malloc (maxDir * sizeof(*cache_dir_filelist)); + if (cache_dir_filelist == NULL) { + printf("%s: Malloc Failed!\n", rn); + return (-1); + } + memset (cache_dir_filelist, 0, maxDir * sizeof(*cache_dir_filelist)); + } + + if (dir_for_V == NULL) { + dir_for_V = (int *) malloc (cacheFiles * sizeof(*dir_for_V)); + if (dir_for_V == NULL) { + printf("%s: Malloc Failed!\n", rn); + return (-1); + } + for (i=0; i < cacheFiles; i++) + dir_for_V[i] = -1; /* Does not exist */ + } + + /* Note, setting dirNum to -2 here will cause cachefiles found in + * the toplevel directory to be marked in directory "-2". This + * allows us to differentiate between 'file not seen' (-1) and + * 'file seen in top-level' (-2). Then when we try to move the + * file into a subdirectory, we know it's in the top-level instead + * of some other cache subdir. + */ + return doSweepAFSCache (vFilesFound, cacheBaseDir, -2, maxDir); +} + static ConfigCell(aci, arock, adir) register struct afsconf_cell *aci; char *arock; @@ -955,6 +1279,15 @@ mainproc(as, arock) printf("afsd: No AFSDB support; ignoring -afsdb"); #endif } + if (as->parms[25].items) { + /* -files_per_subdir */ + int res = atoi(as->parms[25].items->data); + if ( res < 10 || res > 2^30) { + printf("afsd:invalid number of files per subdir, \"%s\". Ignored\n", as->parms[25].items->data); + } else { + nFilesPerDir = res; + } + } /* * Pull out all the configuration info for the workstation's AFS cache and @@ -984,7 +1317,7 @@ mainproc(as, arock) if ((logfd = fopen(fullpn_AFSLogFile,"r+")) == 0) { if (afsd_verbose) printf("%s: Creating '%s'\n", rn, fullpn_AFSLogFile); - if (CreateCacheFile(fullpn_AFSLogFile)) { + if (CreateCacheFile(fullpn_AFSLogFile, NULL)) { printf("%s: Can't create '%s' (You may want to use the -logfile option)\n", rn, fullpn_AFSLogFile); exit(1); } @@ -1088,8 +1421,8 @@ mainproc(as, arock) */ sprintf(fullpn_DCacheFile, "%s/%s", cacheBaseDir, DCACHEFILE); sprintf(fullpn_VolInfoFile, "%s/%s", cacheBaseDir, VOLINFOFILE); - sprintf(fullpn_VFile, "%s/V", cacheBaseDir); - vFileNumber = fullpn_VFile + strlen(fullpn_VFile); + sprintf(fullpn_VFile, "%s/", cacheBaseDir); + vFilePtr = fullpn_VFile + strlen(fullpn_VFile); #if 0 fputs(AFS_GOVERNMENT_MESSAGE, stdout); @@ -1536,6 +1869,7 @@ char **argv; { | CMD_HIDE #endif ), "Enable AFSDB support"); + cmd_AddParm(ts, "-files_per_subdir", CMD_SINGLE, CMD_OPTIONAL, "log(2) of the number of cache files per cache subdirectory"); return (cmd_Dispatch(argc, argv)); } diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index f67986a98..070765b66 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afsmonitor/afsmonitor.c,v 1.1.1.6 2001/07/14 22:20:30 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afsmonitor/afsmonitor.c,v 1.1.1.7 2001/09/11 14:31:07 hartmans Exp $"); #include #include @@ -319,7 +319,7 @@ char *name; #ifdef AFS_SUN5_ENV /* On solaris the above does not resolve hostnames to full names */ if (he != (struct hostent *)0) { - bcopy(he->h_addr, ip_addr, he->h_length); + memcpy(ip_addr, he->h_addr, he->h_length); he = gethostbyaddr(ip_addr, he->h_length, he->h_addrtype); } #endif @@ -1507,7 +1507,7 @@ char *a_config_filename; fprintf(stderr,"[ %s ] Memory Allocation error 1",rn); afsmon_Exit(25); } - bzero(curr_host->thresh,numBytes); + memset(curr_host->thresh, 0, numBytes); } curr_host = curr_host->next;; } @@ -1525,7 +1525,7 @@ char *a_config_filename; fprintf(stderr,"[ %s ] Memory Allocation error 2",rn); afsmon_Exit(35); } - bzero(curr_host->thresh,numBytes); + memset(curr_host->thresh, 0, numBytes); } curr_host = curr_host->next;; } @@ -1710,8 +1710,7 @@ int a_newProbeCycle; /* start of a new probe cycle ? */ /* copy hostname and probe number and probe time and probe status. if the probe failed return now */ - bcopy(xstat_fs_Results.connP->hostName, tmp_fsPR->connP->hostName, - sizeof(xstat_fs_Results.connP->hostName)); + memcpy(tmp_fsPR->connP->hostName, xstat_fs_Results.connP->hostName, sizeof(xstat_fs_Results.connP->hostName)); tmp_fsPR->probeNum = xstat_fs_Results.probeNum; tmp_fsPR->probeTime = xstat_fs_Results.probeTime; tmp_fsPR->probeOK = xstat_fs_Results.probeOK; @@ -1722,23 +1721,14 @@ int a_newProbeCycle; /* start of a new probe cycle ? */ } /* copy connection information */ -#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) - bcopy(&(xstat_fs_Results.connP->skt), &(tmp_fsPR->connP->skt), - sizeof(struct sockaddr_in)); -#else - bcopy(xstat_fs_Results.connP->skt, tmp_fsPR->connP->skt, - sizeof(struct sockaddr_in)); -#endif + memcpy(&(tmp_fsPR->connP->skt), &(xstat_fs_Results.connP->skt), sizeof(struct sockaddr_in)); - bcopy(xstat_fs_Results.connP->hostName, tmp_fsPR->connP->hostName, - sizeof(xstat_fs_Results.connP->hostName)); + memcpy(tmp_fsPR->connP->hostName, xstat_fs_Results.connP->hostName, sizeof(xstat_fs_Results.connP->hostName)); tmp_fsPR->collectionNumber = xstat_fs_Results.collectionNumber; /* copy the probe data information */ tmp_fsPR->data.AFS_CollData_len = xstat_fs_Results.data.AFS_CollData_len; - bcopy(xstat_fs_Results.data.AFS_CollData_val, - tmp_fsPR->data.AFS_CollData_val, - xstat_fs_Results.data.AFS_CollData_len * sizeof(afs_int32)); + memcpy(tmp_fsPR->data.AFS_CollData_val, xstat_fs_Results.data.AFS_CollData_val, xstat_fs_Results.data.AFS_CollData_len * sizeof(afs_int32)); /* we have a valid results structure so mark the list item used */ @@ -2198,8 +2188,7 @@ struct xstat_fs_ProbeResults *a_fsResults; /* backup the display data of the probe cycle that just completed - ie., store curr_fsData in prev_fsData */ - bcopy((char *)curr_fsData, (char *)prev_fsData, - (numFS * sizeof(struct fs_Display_Data)) ); + memcpy((char *)prev_fsData, (char *)curr_fsData, (numFS * sizeof(struct fs_Display_Data)) ); /* initialize curr_fsData but retain the threshold flag information. @@ -2210,7 +2199,7 @@ struct xstat_fs_ProbeResults *a_fsResults; for(i=0; iprobeOK = 0; curr_fsDataP->ovfCount = 0; - bzero((char *)curr_fsDataP->data, numBytes); + memset((char *)curr_fsDataP->data, 0, numBytes); curr_fsDataP++; } @@ -2439,8 +2428,7 @@ int a_newProbeCycle; /* start of new probe cycle ? */ /* copy hostname and probe number and probe time and probe status. if the probe failed return now */ - bcopy(xstat_cm_Results.connP->hostName, tmp_cmPR->connP->hostName, - sizeof(xstat_cm_Results.connP->hostName)); + memcpy(tmp_cmPR->connP->hostName, xstat_cm_Results.connP->hostName, sizeof(xstat_cm_Results.connP->hostName)); tmp_cmPR->probeNum = xstat_cm_Results.probeNum; tmp_cmPR->probeTime = xstat_cm_Results.probeTime; tmp_cmPR->probeOK = xstat_cm_Results.probeOK; @@ -2452,25 +2440,16 @@ int a_newProbeCycle; /* start of new probe cycle ? */ /* copy connection information */ -#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) - bcopy(&(xstat_cm_Results.connP->skt), &(tmp_cmPR->connP->skt), - sizeof(struct sockaddr_in)); -#else - bcopy(xstat_cm_Results.connP->skt, tmp_cmPR->connP->skt, - sizeof(struct sockaddr_in)); -#endif + memcpy(&(tmp_cmPR->connP->skt), &(xstat_cm_Results.connP->skt), sizeof(struct sockaddr_in)); /**** NEED TO COPY rx_connection INFORMATION HERE ******/ - bcopy(xstat_cm_Results.connP->hostName, tmp_cmPR->connP->hostName, - sizeof(xstat_cm_Results.connP->hostName)); + memcpy(tmp_cmPR->connP->hostName, xstat_cm_Results.connP->hostName, sizeof(xstat_cm_Results.connP->hostName)); tmp_cmPR->collectionNumber = xstat_cm_Results.collectionNumber; /* copy the probe data information */ tmp_cmPR->data.AFSCB_CollData_len = xstat_cm_Results.data.AFSCB_CollData_len; - bcopy(xstat_cm_Results.data.AFSCB_CollData_val, - tmp_cmPR->data.AFSCB_CollData_val, - xstat_cm_Results.data.AFSCB_CollData_len * sizeof(afs_int32)); + memcpy(tmp_cmPR->data.AFSCB_CollData_val, xstat_cm_Results.data.AFSCB_CollData_val, xstat_cm_Results.data.AFSCB_CollData_len * sizeof(afs_int32)); /* we have a valid results structure so mark the list item used */ @@ -2953,8 +2932,7 @@ struct xstat_cm_ProbeResults *a_cmResults; /* backup the display data of the probe cycle that just completed - ie., store curr_cmData in prev_cmData */ - bcopy((char *)curr_cmData, (char *)prev_cmData, - (numCM * sizeof(struct cm_Display_Data)) ); + memcpy((char *)prev_cmData, (char *)curr_cmData, (numCM * sizeof(struct cm_Display_Data)) ); /* initialize curr_cmData but retain the threshold flag information. @@ -2965,7 +2943,7 @@ struct xstat_cm_ProbeResults *a_cmResults; for(i=0; iprobeOK = 0; curr_cmDataP->ovfCount = 0; - bzero((char *)curr_cmDataP->data, numBytes); + memset((char *)curr_cmDataP->data, 0, numBytes); curr_cmDataP++; } @@ -3359,7 +3337,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-1); } - bzero(curr_fsData,numBytes); + memset(curr_fsData, 0, numBytes); numBytes = numFS * sizeof(struct fs_Display_Data); prev_fsData = (struct fs_Display_Data *) malloc(numBytes); @@ -3367,7 +3345,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-5); } - bzero(prev_fsData,numBytes); + memset(prev_fsData, 0, numBytes); /* fill in the host names */ tmp_fsData1 = curr_fsData; @@ -3394,7 +3372,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-10); } - bzero(curr_cmData,numBytes); + memset(curr_cmData, 0, numBytes); numBytes = numCM * sizeof(struct cm_Display_Data); prev_cmData = (struct cm_Display_Data *) malloc(numBytes); @@ -3402,7 +3380,7 @@ init_print_buffers() fprintf(stderr,"[ %s ] Memory allocation failure\n",rn); return(-15); } - bzero(prev_cmData,numBytes); + memset(prev_cmData, 0, numBytes); /* fill in the host names */ tmp_cmData1 = curr_cmData; @@ -3496,7 +3474,7 @@ afsmon_execute() return(-1); } - bzero(FSSktArray, FSsktbytes); + memset(FSSktArray, 0, FSsktbytes); /* Fill in the socket information for each fileserve */ @@ -3510,7 +3488,7 @@ afsmon_execute() return(-1); } strncpy(curr_FS->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/ - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7000); /*FileServer port*/ @@ -3567,7 +3545,7 @@ afsmon_execute() return(-1); } - bzero(CMSktArray, CMsktbytes); + memset(CMSktArray, 0, CMsktbytes); /* Fill in the socket information for each CM */ @@ -3581,7 +3559,7 @@ afsmon_execute() return(-1); } strncpy(curr_CM->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/ - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7001); /*Cache Manager port*/ diff --git a/src/afsweb/apache_afs_cache.c b/src/afsweb/apache_afs_cache.c index d427ae530..ee7ef6fe7 100644 --- a/src/afsweb/apache_afs_cache.c +++ b/src/afsweb/apache_afs_cache.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afsweb/apache_afs_cache.c,v 1.1.1.4 2001/07/14 22:20:32 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afsweb/apache_afs_cache.c,v 1.1.1.5 2001/09/11 14:31:09 hartmans Exp $"); #include "apache_afs_cache.h" @@ -473,10 +473,10 @@ int getTokenLen(char *buf) afs_int32 EndTimestamp; } token; tp=buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ rc=(len+sizeof(afs_int32)); tp += (sizeof(afs_int32) + len); /* skip secret token and its length */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { #ifdef DEBUG fprintf(stderr, "apache_afs_cache.c:getExpiration:" @@ -508,9 +508,9 @@ long getExpiration(char *buf) } token; tp = buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ tp += (sizeof(afs_int32) + len); /* skip secret token and its length */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { #ifdef DEBUG fprintf(stderr, "apache_afs_cache.c:getExpiration:" @@ -520,6 +520,6 @@ long getExpiration(char *buf) } tp += sizeof(afs_int32); /* skip length of clear token */ - bcopy(tp, &token, sizeof(struct ClearToken)); /* copy the token */ + memcpy(&token, tp, sizeof(struct ClearToken)); /* copy the token */ return token.EndTimestamp; } diff --git a/src/afsweb/apache_afs_client.c b/src/afsweb/apache_afs_client.c index 7233e583d..eda7e7c9f 100644 --- a/src/afsweb/apache_afs_client.c +++ b/src/afsweb/apache_afs_client.c @@ -376,17 +376,17 @@ static int setToken(char *tokenBuf, int tokenLen) #ifdef OLDSETPAG /* skip over the secret token */ temp = tokenBuf; - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* skip over the clear token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); doneSETPAG = 1; - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); i |= 0x8000; - bcopy(&i, temp, sizeof(afs_int32)); + memcpy(temp, &i, sizeof(afs_int32)); temp += sizeof(afs_int32); #endif @@ -455,9 +455,9 @@ int authenticateUser(request_rec *r, char *defaultCell, strcpy(global_default_cell, defaultCell); } - bzero(user,APACHEAFS_USERNAME_MAX); - bzero(passwd,APACHEAFS_PASSWORD_MAX); - bzero(cell,APACHEAFS_CELLNAME_MAX); + memset(user, 0, APACHEAFS_USERNAME_MAX); + memset(passwd, 0, APACHEAFS_PASSWORD_MAX); + memset(cell, 0, APACHEAFS_CELLNAME_MAX); if (auth_line == NULL) { /* No Authorization field - we don't do anything */ /* @@ -468,9 +468,9 @@ int authenticateUser(request_rec *r, char *defaultCell, afslog(15, ("%s: No authline recieved", module_name)); haveAuth = 0; userChanged=1; - bzero(lastUser, APACHEAFS_USERNAME_MAX); - bzero(lastCell, APACHEAFS_CELLNAME_MAX); - bzero(lastCksum, SHA_HASH_BYTES); + memset(lastUser, 0, APACHEAFS_USERNAME_MAX); + memset(lastCell, 0, APACHEAFS_CELLNAME_MAX); + memset(lastCksum, 0, SHA_HASH_BYTES); rc = unlog(); afslog(25, ("%s: pid:%d No Authorization field. Unlogging ...", module_name, getpid())); @@ -503,9 +503,9 @@ int authenticateUser(request_rec *r, char *defaultCell, module_name, getpid())); haveAuth = 0; userChanged = 1; - bzero(lastUser, APACHEAFS_USERNAME_MAX); - bzero(lastCell, APACHEAFS_CELLNAME_MAX); - bzero(lastCksum, SHA_HASH_BYTES); + memset(lastUser, 0, APACHEAFS_USERNAME_MAX); + memset(lastCell, 0, APACHEAFS_CELLNAME_MAX); + memset(lastCksum, 0, SHA_HASH_BYTES); rc = unlog(); if (rc) { sprintf(err_msg, "%s: Error unlogging from AFS cell - rc: %d, errno:%d", @@ -773,7 +773,7 @@ static int geturi(request_rec *r, char *buf) afsassert(r); afsassert(buf); - bzero(buf, APACHEAFS_CELLNAME_MAX); + memset(buf, 0, APACHEAFS_CELLNAME_MAX); pos = strchr(r->uri,'/'); if (pos != NULL) { pos++; @@ -820,7 +820,7 @@ static int parseAuthName_int(request_rec *r, char *buf, char *msg) afsassert(buf); afsassert(msg); - bzero(blank, sizeof(blank)); + memset(blank, 0, sizeof(blank)); afslog(50, ("%s: Parsing Authorization Required reply. buf:%s", module_name, buf)); pos = strchr(buf, '<'); @@ -873,7 +873,7 @@ static int parseAuthName_int(request_rec *r, char *buf, char *msg) pos++; strcat(msg, pos); strcpy(buf, msg); - bzero(msg, 1024); + memset(msg, 0, 1024); parseAuthName_int(r, buf, msg); return 0; } @@ -899,7 +899,7 @@ static int parseAuthName(request_rec *r, char *buf) afsassert(r); afsassert(buf); - bzero(msg, sizeof(msg)); + memset(msg, 0, sizeof(msg)); pos=strchr(buf,'<'); while (pos != NULL) { @@ -910,7 +910,7 @@ static int parseAuthName(request_rec *r, char *buf) return -1; } strcpy(buf, msg); - bzero(msg, sizeof(msg)); + memset(msg, 0, sizeof(msg)); pos = strchr(buf, '<'); } afslog(50, ("%s: Parsing WWW Auth required reply. final message:%s", diff --git a/src/afsweb/apache_afs_utils.c b/src/afsweb/apache_afs_utils.c index 2309120b1..aa12df4fc 100644 --- a/src/afsweb/apache_afs_utils.c +++ b/src/afsweb/apache_afs_utils.c @@ -74,17 +74,17 @@ flipPrimary(char *tokenBuf) char * temp = tokenBuf; /* skip over the secret token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* skip over the clear token */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); temp += (i + sizeof(afs_int32)); /* set the primary flag */ - bcopy(temp, &i, sizeof(afs_int32)); + memcpy(&i, temp, sizeof(afs_int32)); i |= 0x8000; - bcopy(&i, temp, sizeof(afs_int32)); + memcpy(temp, &i, sizeof(afs_int32)); temp += sizeof(afs_int32); return 0; } @@ -222,21 +222,21 @@ void parseToken(char *buf) assert ( buf != NULL ); tp = buf; - bcopy(tp, &len, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */ tp += (sizeof(afs_int32)+ len); /* skip secret token */ - bcopy(tp, &len, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */ if (len != sizeof(struct ClearToken)) { fprintf(stderr, "weblog:parseToken: error getting length of ClearToken\n"); return; } tp += sizeof(afs_int32); /* skip length of cleartoken */ - bcopy(tp, &clearToken, sizeof(struct ClearToken)); /* copy cleartoken */ + memcpy(&clearToken, tp, sizeof(struct ClearToken)); /* copy cleartoken */ tp += len; /* skip clear token itself */ - bcopy(tp, &len, sizeof(afs_int32)); /* copy the primary flag */ + memcpy(&len, tp, sizeof(afs_int32)); /* copy the primary flag */ tp += sizeof(afs_int32); /* skip primary flag */ /* tp now points to the cell name */ diff --git a/src/afsweb/apache_includes/1.2/conf.h b/src/afsweb/apache_includes/1.2/conf.h index c7a7d757d..ee6f0be2a 100644 --- a/src/afsweb/apache_includes/1.2/conf.h +++ b/src/afsweb/apache_includes/1.2/conf.h @@ -87,7 +87,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT @@ -96,7 +98,6 @@ typedef int rlim_t; #define NO_KILLPG #undef NO_SETSID #define HAVE_SYS_RESOURCE_H -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP @@ -299,7 +300,7 @@ extern int strncasecmp(const char *,const char *,unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *,const char *,unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -335,7 +336,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -347,7 +347,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define HAVE_RESOURCE #define HAVE_MMAP @@ -364,7 +363,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -447,7 +445,6 @@ int initgroups (char *, int); #define NO_KILLPG #undef NO_SETSID #define HAVE_RESOURCE 1 -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP diff --git a/src/afsweb/apache_includes/1.3.1/ap_config.h b/src/afsweb/apache_includes/1.3.1/ap_config.h index cbb216145..d12a44bb0 100644 --- a/src/afsweb/apache_includes/1.3.1/ap_config.h +++ b/src/afsweb/apache_includes/1.3.1/ap_config.h @@ -141,7 +141,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT #define NEED_DIFFTIME @@ -151,7 +153,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ !defined(USE_PTHREAD_SERIALIZED_ACCEPT) #define USE_FCNTL_SERIALIZED_ACCEPT @@ -252,7 +253,7 @@ typedef int rlim_t; #endif #define USE_FCNTL_SERIALIZED_ACCEPT #ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) +#define memmove(a,b,c) memcpy(a, b, c) #endif #if AIX >= 42 #define NET_SIZE_T size_t @@ -446,7 +447,7 @@ extern int strncasecmp(const char *, const char *, unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -489,7 +490,6 @@ extern char *crypt(); #define NEED_STRNCASECMP #endif /* ENCORE */ #endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT #define USE_FCNTL_SERIALIZED_ACCEPT @@ -513,7 +513,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD #define USE_MMAP_FILES @@ -533,7 +532,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT #define ap_inet_addr inet_network @@ -653,7 +651,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD diff --git a/src/afsweb/apache_includes/1.3.6/ap_config.h b/src/afsweb/apache_includes/1.3.6/ap_config.h index 81f89068a..a33d5630d 100644 --- a/src/afsweb/apache_includes/1.3.6/ap_config.h +++ b/src/afsweb/apache_includes/1.3.6/ap_config.h @@ -166,7 +166,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT #define NEED_DIFFTIME @@ -176,7 +178,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ !defined(USE_PTHREAD_SERIALIZED_ACCEPT) #define USE_FCNTL_SERIALIZED_ACCEPT @@ -277,7 +278,7 @@ typedef int rlim_t; #endif #define USE_FCNTL_SERIALIZED_ACCEPT #ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) +#define memmove(a,b,c) memcpy(a, b, c) #endif #if AIX >= 42 #define NET_SIZE_T size_t @@ -517,7 +518,7 @@ extern int strncasecmp(const char *, const char *, unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -560,7 +561,6 @@ extern char *crypt(); #define NEED_STRNCASECMP #endif /* ENCORE */ #endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT #define USE_FCNTL_SERIALIZED_ACCEPT @@ -589,7 +589,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD #define USE_MMAP_FILES @@ -613,7 +612,6 @@ extern char *crypt(); #define NEED_STRCASECMP #define NEED_STRNCASECMP #endif -#define bzero(a,b) memset(a,0,b) /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT #define ap_inet_addr inet_network @@ -737,7 +735,6 @@ typedef int rlim_t; #undef HAVE_GMTOFF #define NO_KILLPG #undef NO_SETSID -#define bzero(a,b) memset(a,0,b) #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP 1 #define USE_MMAP_SCOREBOARD diff --git a/src/afsweb/apache_includes/conf.h b/src/afsweb/apache_includes/conf.h index c7a7d757d..ee6f0be2a 100644 --- a/src/afsweb/apache_includes/conf.h +++ b/src/afsweb/apache_includes/conf.h @@ -87,7 +87,9 @@ char *mktemp(char *template); #include #define NEED_STRERROR typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) +#ifndef HAVE_MEMMOVE +#define memmove(a,b,c) memcpy(a, b, c) +#endif #define NO_LINGCLOSE #define USE_FLOCK_SERIALIZED_ACCEPT @@ -96,7 +98,6 @@ typedef int rlim_t; #define NO_KILLPG #undef NO_SETSID #define HAVE_SYS_RESOURCE_H -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP @@ -299,7 +300,7 @@ extern int strncasecmp(const char *,const char *,unsigned); /* These are to let -Wall compile more cleanly */ extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *,const char *,unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); +extern int set42sig(), getopt(), getpeername(); extern int listen(), bind(), socket(), getsockname(); extern int accept(), gethostname(), connect(), lstat(); extern int select(), killpg(), shutdown(); @@ -335,7 +336,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -347,7 +347,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define HAVE_RESOURCE #define HAVE_MMAP @@ -364,7 +363,6 @@ extern char *crypt(); #undef NEED_STRDUP #define NEED_STRCASECMP #define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf /* A lot of SVR4 systems need this */ #define USE_FCNTL_SERIALIZED_ACCEPT @@ -447,7 +445,6 @@ int initgroups (char *, int); #define NO_KILLPG #undef NO_SETSID #define HAVE_RESOURCE 1 -#define bzero(a,b) memset(a,0,b) #define JMP_BUF sigjmp_buf #define USE_FCNTL_SERIALIZED_ACCEPT #define HAVE_MMAP diff --git a/src/afsweb/weblog.c b/src/afsweb/weblog.c index cacd88c3b..3702e2fa2 100644 --- a/src/afsweb/weblog.c +++ b/src/afsweb/weblog.c @@ -24,7 +24,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/afsweb/weblog.c,v 1.1.1.5 2001/07/14 22:20:33 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afsweb/weblog.c,v 1.1.1.6 2001/09/11 14:31:11 hartmans Exp $"); #include #include @@ -338,7 +338,7 @@ static int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, token.startTime = starttime; token.endTime = endtime; - bcopy(session_key, (char *) &token.sessionKey, sizeof(token.sessionKey)); + memcpy((char *) &token.sessionKey, session_key, sizeof(token.sessionKey)); token.kvno = tkt_type; token.ticketLen = ticket_len; if (ticket_len > MAXKTCTICKETLEN) { @@ -346,7 +346,7 @@ static int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, "Maximum length accepted by AFS cache manager is %d\n", MAXKTCTICKETLEN); return -1; } - bcopy((char *) ticket_p, (char *) token.ticket, ticket_len); + memcpy((char *) token.ticket, (char *) ticket_p, ticket_len); sprintf(client.name, "AFS ID %d", unix_id); strcpy(client.instance, ""); @@ -370,7 +370,7 @@ static char *make_string(s_p, length) fprintf(stderr, "dlog: out of memory\n"); exit(1); } - bcopy(s_p, new_p, length); + memcpy(new_p, s_p, length); new_p[length] = '\0'; return new_p; } @@ -493,7 +493,7 @@ static int decode_reply(buf, buflen, reply_p) case ASN_OCTET_STRING: if (context == 1 && len == sizeof(reply_p->session_key)) { saw_session_key++; - bcopy(buf, reply_p->session_key, len); + memcpy(reply_p->session_key, buf, len); } buf += len; break; @@ -710,7 +710,7 @@ static int getDFScreds(char *name, char *realm, char *passwd, des_string_to_key(passwd, passwd_key); /* Destroy the password. */ - bzero(passwd, strlen(passwd)); + memset(passwd, 0, strlen(passwd)); /* @@ -731,8 +731,8 @@ static int getDFScreds(char *name, char *realm, char *passwd, /* * Destroy the key block: it's no longer needed. */ - bzero(schedule, sizeof(schedule)); - bzero(passwd_key, sizeof(passwd_key)); + memset(schedule, 0, sizeof(schedule)); + memset(passwd_key, 0, sizeof(passwd_key)); /* @@ -811,7 +811,7 @@ CommandProc (as, arock) char type[10]; /* authentication type AFS or DFS */ /* blow away command line arguments */ - for (i=1; i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/audit/audit.c,v 1.1.1.5 2001/07/14 22:20:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/audit/audit.c,v 1.1.1.6 2001/09/11 14:31:18 hartmans Exp $"); #include #include @@ -94,10 +94,10 @@ static aixmakebuf (audEvent, vaList) case AUD_FID : /* AFSFid - contains 3 entries */ vaFid = (struct AFSFid *) va_arg(vaList, int); if (vaFid) { - bcopy(vaFid, bufferPtr, sizeof(struct AFSFid)); + memcpy(bufferPtr, vaFid, sizeof(struct AFSFid)); } else { - bzero (bufferPtr, sizeof(struct AFSFid)); + memset(bufferPtr, 0, sizeof(struct AFSFid)); } bufferPtr += sizeof(struct AFSFid); break; @@ -113,13 +113,13 @@ static aixmakebuf (audEvent, vaList) if (Fids && Fids->AFSCBFids_len) { *((u_int *)bufferPtr) = Fids->AFSCBFids_len; bufferPtr += sizeof(u_int); - bcopy(Fids->AFSCBFids_val, bufferPtr, sizeof(struct AFSFid)); + memcpy(bufferPtr, Fids->AFSCBFids_val, sizeof(struct AFSFid)); } else { struct AFSFid dummy; *((u_int *)bufferPtr) = 0; bufferPtr += sizeof(u_int); - bzero (bufferPtr, sizeof(struct AFSFid)); + memset(bufferPtr, 0, sizeof(struct AFSFid)); } bufferPtr += sizeof(struct AFSFid); break; diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index cc00297ac..666b2769d 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/auth/cellconfig.c,v 1.1.1.8 2001/07/16 07:16:46 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/auth/cellconfig.c,v 1.1.1.9 2001/09/11 14:31:21 hartmans Exp $"); #include #include @@ -224,7 +224,7 @@ register char *adir; { LOCK_GLOBAL_MUTEX /* zero structure and fill in name; rest is done by internal routine */ tdir = (struct afsconf_dir *) malloc(sizeof(struct afsconf_dir)); - bzero(tdir, sizeof(struct afsconf_dir)); + memset(tdir, 0, sizeof(struct afsconf_dir)); tdir->name = (char *) malloc(strlen(adir)+1); strcpy(tdir->name, adir); @@ -401,7 +401,7 @@ char clones[]; curEntry = 0; } curEntry = (struct afsconf_entry *) malloc(sizeof(struct afsconf_entry)); - bzero(curEntry, sizeof(struct afsconf_entry)); + memset(curEntry, 0, sizeof(struct afsconf_entry)); code = ParseCellLine(tbuffer, curEntry->cellInfo.name, linkedcell); if (code) { afsconf_CloseInternal(adir); @@ -781,7 +781,7 @@ register struct afsconf_dir *adir; { if (adir->keystr) free(adir->keystr); /* reinit */ - bzero(adir, sizeof(struct afsconf_dir)); + memset(adir, 0, sizeof(struct afsconf_dir)); adir->name = tname; /* restore it */ return 0; } @@ -858,7 +858,7 @@ struct afsconf_keys *astr; code = afsconf_Check(adir); if (code) return AFSCONF_FAILURE; - bcopy(adir->keystr, astr, sizeof(struct afsconf_keys)); + memcpy(astr, adir->keystr, sizeof(struct afsconf_keys)); UNLOCK_GLOBAL_MUTEX return 0; } @@ -892,7 +892,7 @@ afs_int32 afsconf_GetLatestKey(adir, avno, akey) } } if (bestk) { /* found any */ - if (akey) bcopy(bestk->key, akey, 8); /* copy out latest key */ + if (akey) memcpy(akey, bestk->key, 8); /* copy out latest key */ if (avno) *avno = bestk->kvno; /* and kvno to caller */ UNLOCK_GLOBAL_MUTEX return 0; @@ -919,7 +919,7 @@ char *akey; for(tk = adir->keystr->key,i=0;ikvno == avno) { - bcopy(tk->key, akey, 8); + memcpy(akey, tk->key, 8); UNLOCK_GLOBAL_MUTEX return 0; } @@ -938,7 +938,7 @@ struct afsconf_dir *adir; register afs_int32 i; char tbuffer[256]; - bcopy(adir->keystr, &tkeys, sizeof(struct afsconf_keys)); + memcpy(&tkeys, adir->keystr, sizeof(struct afsconf_keys)); /* convert it to net byte order */ for(i = 0; ikey[tk->nkeys++]; } tkey->kvno = akvno; - bcopy(akey, tkey->key, 8); + memcpy(tkey->key, akey, 8); i = SaveKeys(adir); afsconf_Touch(adir); UNLOCK_GLOBAL_MUTEX @@ -1032,7 +1032,7 @@ afs_int32 akvno; /* otherwise slide the others down. i and tkey point at the guy to delete */ for(;inkeys-1; i++,tkey++) { tkey->kvno = (tkey+1)->kvno; - bcopy((tkey+1)->key, tkey->key, 8); + memcpy(tkey->key, (tkey+1)->key, 8); } tk->nkeys--; i = SaveKeys(adir); diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 153dba2f3..595337508 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -16,7 +16,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/auth/ktc.c,v 1.1.1.5 2001/07/14 22:20:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/auth/ktc.c,v 1.1.1.6 2001/09/11 14:31:22 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -275,7 +275,7 @@ afs_int32 flags; else /* valid, but no match */ ; } else found = i; /* remember this empty slot */ if (found == -1) return KTC_NOENT; - bcopy (atoken, &local_tokens[found].token, sizeof(struct ktc_token)); + memcpy(&local_tokens[found].token, atoken, sizeof(struct ktc_token)); local_tokens[found].server = *aserver; local_tokens[found].client = *aclient; local_tokens[found].valid = 1; @@ -284,13 +284,13 @@ afs_int32 flags; tp = tbuffer; /* start copying here */ if ((atoken->ticketLen < MINKTCTICKETLEN) || (atoken->ticketLen > MAXKTCTICKETLEN)) return KTC_TOOBIG; - bcopy(&atoken->ticketLen, tp, sizeof(afs_int32)); /* copy in ticket length */ + memcpy(tp, &atoken->ticketLen, sizeof(afs_int32)); /* copy in ticket length */ tp += sizeof(afs_int32); - bcopy(atoken->ticket, tp, atoken->ticketLen); /* copy in ticket */ + memcpy(tp, atoken->ticket, atoken->ticketLen); /* copy in ticket */ tp += atoken->ticketLen; /* next, copy in the "clear token", describing who we are */ ct.AuthHandle = atoken->kvno; /* hide auth handle here */ - bcopy(&atoken->sessionKey, ct.HandShakeKey, 8); + memcpy(ct.HandShakeKey, &atoken->sessionKey, 8); ct.BeginTimestamp = atoken->startTime; ct.EndTimestamp = atoken->endTime; @@ -326,9 +326,9 @@ not_vice_id: #endif temp = sizeof(struct ClearToken); - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); - bcopy(&ct, tp, sizeof(struct ClearToken)); + memcpy(tp, &ct, sizeof(struct ClearToken)); tp += sizeof(struct ClearToken); /* next copy in primary flag */ @@ -344,7 +344,7 @@ not_vice_id: if (flags & AFS_SETTOK_SETPAG) temp |= 0x8000; - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* finally copy in the cell name */ @@ -478,7 +478,7 @@ struct ktc_token *atoken; { (strcmp (local_tokens[i].server.name, aserver->name) == 0) && (strcmp (local_tokens[i].server.instance, aserver->instance) == 0) && (strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) { - bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token))); + memcpy (atoken, &local_tokens[i].token, min (atokenLen, sizeof(struct ktc_token))); if (aclient) *aclient = local_tokens[i].client; UNLOCK_GLOBAL_MUTEX @@ -508,7 +508,7 @@ struct ktc_token *atoken; { if (aclient) strcpy(aclient->cell, lcell); - bcopy(&ctoken, atoken, + memcpy(atoken, &ctoken, min (atokenLen, sizeof(struct ktc_token))); afs_tf_close(); @@ -762,10 +762,10 @@ struct ktc_principal *aserver; { /* next iterator determined by earlier loop */ *aindex = index+1; - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of secret token */ tp += sizeof(afs_int32); tp += temp; /* skip ticket for now */ - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of clear token */ if (temp != sizeof(struct ClearToken)) { UNLOCK_GLOBAL_MUTEX return KTC_ERROR; @@ -1164,7 +1164,7 @@ afs_tf_close() (void) close(fd); fd = -1; /* see declaration of fd above */ } - bzero(tfbfr, sizeof(tfbfr)); + memset(tfbfr, 0, sizeof(tfbfr)); } /* @@ -1446,7 +1446,7 @@ afs_tf_create(pname,pinst) if ((fd = open(file, O_RDWR, 0)) < 0) goto out; /* can't zero it, but we can still try truncating it */ - bzero(zerobuf, sizeof(zerobuf)); + memset(zerobuf, 0, sizeof(zerobuf)); for (i = 0; i < sbuf.st_size; i += sizeof(zerobuf)) if (write(fd, zerobuf, sizeof(zerobuf)) != sizeof(zerobuf)) { @@ -1517,7 +1517,7 @@ afs_tf_dest_tkt() if ((fd = open(file, O_RDWR, 0)) < 0) goto out; - bzero(buf, BUFSIZ); + memset(buf, 0, BUFSIZ); for (i = 0; i < statb.st_size; i += BUFSIZ) if (write(fd, buf, BUFSIZ) != BUFSIZ) { diff --git a/src/auth/setkey.c b/src/auth/setkey.c index e55ca8f65..b9b4e0998 100644 --- a/src/auth/setkey.c +++ b/src/auth/setkey.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/auth/setkey.c,v 1.1.1.4 2001/07/14 22:20:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/auth/setkey.c,v 1.1.1.5 2001/09/11 14:31:23 hartmans Exp $"); #include #include @@ -20,11 +20,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/auth/setkey.c,v 1.1.1.4 2001/07/14 22:2 #include #include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_NETINET_IN_H @@ -77,7 +77,7 @@ char **argv; { printf(" Ex: setkey add 0 \"80b6a7cd7a9dadb6\"\n"); exit(1); } - bzero(tkey, sizeof(tkey)); + memset(tkey, 0, sizeof(tkey)); for(i=7, cp = argv[3] + 15;i>=0; i--,cp-=2) tkey[i] = char2hex(*cp) + char2hex(*(cp-1))*16; @@ -115,7 +115,7 @@ char **argv; { char hexbuf[17]; unsigned char c; int j; - bcopy(tkeys.key[i].key, tbuffer, 8); + memcpy(tbuffer, tkeys.key[i].key, 8); tbuffer[8] = 0; for(j=0;j<8;j++) { c = tbuffer[j]; diff --git a/src/auth/test/testcellconf.c b/src/auth/test/testcellconf.c index 42496a6b1..b113ef920 100644 --- a/src/auth/test/testcellconf.c +++ b/src/auth/test/testcellconf.c @@ -25,7 +25,7 @@ Creation date: #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/auth/test/testcellconf.c,v 1.1.1.4 2001/07/14 22:20:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/auth/test/testcellconf.c,v 1.1.1.5 2001/09/11 14:31:24 hartmans Exp $"); #include #include @@ -48,7 +48,7 @@ struct afsconf_dir *adir; { printf("Cell %s:\n", ainfo->name); for(i=0;inumServers;i++) { - bcopy(&ainfo->hostAddr[i].sin_addr, &temp, sizeof(long)); + memcpy(&temp, &ainfo->hostAddr[i].sin_addr, sizeof(long)); printf(" host %s at %x.%x\n", ainfo->hostName[i], temp, ainfo->hostAddr[i].sin_port); } return 0; diff --git a/src/auth/writeconfig.c b/src/auth/writeconfig.c index 839181723..f83de6140 100644 --- a/src/auth/writeconfig.c +++ b/src/auth/writeconfig.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/auth/writeconfig.c,v 1.1.1.5 2001/07/14 22:20:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/auth/writeconfig.c,v 1.1.1.6 2001/09/11 14:31:23 hartmans Exp $"); #include #include @@ -51,7 +51,7 @@ register struct afsconf_cell *aci; { printf("Host %s not found in host database...\n", aci->hostName[i]); return AFSCONF_FAILURE; } - bcopy(th->h_addr, &aci->hostAddr[i].sin_addr, sizeof(afs_int32)); + memcpy(&aci->hostAddr[i].sin_addr, th->h_addr, sizeof(afs_int32)); } /* otherwise we're deleting this entry */ } diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index cf83adce4..d9ba4c030 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bnode.c,v 1.1.1.5 2001/07/14 22:20:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bnode.c,v 1.1.1.6 2001/09/11 14:31:25 hartmans Exp $"); #include #include @@ -281,7 +281,7 @@ struct bnode_ops *aprocs; { } if (!tt) { tt = (struct bnode_type *) malloc(sizeof(struct bnode_type)); - bzero(tt, sizeof(struct bnode_type)); + memset(tt, 0, sizeof(struct bnode_type)); tt->next = allTypes; allTypes = tt; tt->name = atype; @@ -425,7 +425,7 @@ struct bnode_ops *abnodeops; { struct bnode **lb, *nb; /* format the bnode properly */ - bzero(abnode, sizeof(struct bnode)); + memset(abnode, 0, sizeof(struct bnode)); abnode->ops = abnodeops; abnode->name = (char *) malloc(strlen(aname)+1); strcpy(abnode->name, aname); @@ -733,13 +733,13 @@ int bnode_Init() { if (initDone) return 0; initDone = 1; - bzero(&bnode_stats, sizeof(bnode_stats)); + memset(&bnode_stats, 0, sizeof(bnode_stats)); LWP_InitializeProcessSupport(1, &junk); /* just in case */ IOMGR_Initialize(); code = LWP_CreateProcess(bproc, BNODE_LWP_STACKSIZE, /* priority */ 1, /* parm */0, "bnode-manager", &bproc_pid); if (code) return code; - bzero((char *)&newaction, sizeof(newaction)); + memset((char *)&newaction, 0, sizeof(newaction)); newaction.sa_handler = bnode_Int; code = sigaction(SIGCHLD, &newaction, NULL); if (code) return errno; @@ -831,7 +831,7 @@ char *aexecString; { code = bnode_ParseLine(aexecString, &tlist); /* try parsing first */ if (code) return code; tp = (struct bnode_proc *) malloc(sizeof(struct bnode_proc)); - bzero(tp, sizeof(struct bnode_proc)); + memset(tp, 0, sizeof(struct bnode_proc)); tp->next = allProcs; allProcs = tp; *aproc = tp; diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 17a9ab7ae..c9ac6d37f 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bos.c,v 1.1.1.6 2001/07/14 22:20:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bos.c,v 1.1.1.7 2001/09/11 14:31:25 hartmans Exp $"); #include #include @@ -178,7 +178,7 @@ struct cmd_syndesc *as; { printf("bos: can't find address for host '%s'\n", hostname); exit(1); } - bcopy(th->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, th->h_addr, sizeof(afs_int32)); /* get tokens for making authenticated connections */ localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); @@ -289,7 +289,7 @@ afs_int32 alen; { register char *tp; strcpy(aresult, adir); - tp = rindex(aname, '/'); + tp = strrchr(aname, '/'); if (!tp) { /* no '/' in name */ strcat(aresult, "/"); @@ -785,7 +785,7 @@ register struct cmd_syndesc *as; { char buf[BUFSIZ], ver[BUFSIZ]; tconn = GetConn(as, 1); - bzero(&tkey, sizeof(struct ktc_encryptionKey)); + memset(&tkey, 0, sizeof(struct ktc_encryptionKey)); if(as->parms[1].items) strcpy(buf,as->parms[1].items->data); @@ -1350,7 +1350,7 @@ struct cmd_syndesc *as; { char *orphans; char *tp; - bzero(&mrafsParm, sizeof(mrafsParm)); + memset(&mrafsParm, 0, sizeof(mrafsParm)); /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */ tconn = GetConn(as, 0); diff --git a/src/bozo/bosoprocs.c b/src/bozo/bosoprocs.c index b2e2bdfb5..1a74ad848 100644 --- a/src/bozo/bosoprocs.c +++ b/src/bozo/bosoprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.1.1.5 2001/07/14 22:20:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.1.1.6 2001/09/11 14:31:26 hartmans Exp $"); #include #include @@ -60,11 +60,11 @@ struct ktime *aktime; { code = 0; /* assume success */ switch (atype) { case 1: - bcopy(&bozo_nextRestartKT, aktime, sizeof(struct ktime)); + memcpy(aktime, &bozo_nextRestartKT, sizeof(struct ktime)); break; case 2: - bcopy(&bozo_nextDayKT, aktime, sizeof(struct ktime)); + memcpy(aktime, &bozo_nextDayKT, sizeof(struct ktime)); break; default: @@ -92,11 +92,11 @@ struct ktime *aktime; { code = 0; /* assume success */ switch (atype) { case 1: - bcopy(aktime, &bozo_nextRestartKT, sizeof(struct ktime)); + memcpy(&bozo_nextRestartKT, aktime, sizeof(struct ktime)); break; case 2: - bcopy(aktime, &bozo_nextDayKT, sizeof(struct ktime)); + memcpy(&bozo_nextDayKT, aktime, sizeof(struct ktime)); break; default: @@ -472,8 +472,8 @@ char *aname; { goto fail; } - bzero(&tcell.hostAddr[which], sizeof(struct sockaddr_in)); - bzero(tcell.hostName[which], MAXHOSTCHARS); + memset(&tcell.hostAddr[which], 0, sizeof(struct sockaddr_in)); + memset(tcell.hostName[which], 0, MAXHOSTCHARS); code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); fail: @@ -534,7 +534,7 @@ char *aname; { } } - bzero(&tcell.hostAddr[which], sizeof(struct sockaddr_in)); + memset(&tcell.hostAddr[which], 0, sizeof(struct sockaddr_in)); strcpy(tcell.hostName[which], aname); code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); @@ -572,7 +572,7 @@ struct bozo_key *akey; goto fail; } *akvno = tkeys.key[an].kvno; - bzero(akeyinfo, sizeof(struct bozo_keyInfo)); + memset(akeyinfo, 0, sizeof(struct bozo_keyInfo)); noauth = afsconf_GetNoAuthFlag(bozo_confdir); rxkad_GetServerInfo(acall->conn, &enc_level, 0, 0, 0, 0, 0); @@ -581,9 +581,9 @@ struct bozo_key *akey; */ if ((noauth) || (enc_level == rxkad_crypt)) { - bcopy(tkeys.key[an].key, akey, 8); + memcpy(akey, tkeys.key[an].key, 8); } - else bzero (akey, 8); + else memset(akey, 0, 8); code = stat(AFSDIR_SERVER_KEY_FILEPATH, &tstat); if (code == 0) { @@ -1281,7 +1281,7 @@ BOZO_GetInstanceInfo(acall, ainstance, atype, astatus) strcpy(*atype, tb->type->name); else (*atype)[0] = 0; /* null string */ - bzero(astatus, sizeof(struct bozo_status)); /* good defaults */ + memset(astatus, 0, sizeof(struct bozo_status)); /* good defaults */ astatus->goal = tb->goal; astatus->fileGoal = tb->fileGoal; astatus->procStartTime = tb->procStartTime; @@ -1316,7 +1316,7 @@ char **aparm; { bnode_Hold(tb); if (anum == 999) { if (tb->notifier) { - bcopy(tb->notifier, tp, strlen(tb->notifier)+1); + memcpy(tp, tb->notifier, strlen(tb->notifier)+1); code = 0; } else code = BZNOENT; /* XXXXX */ diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index d5f9bc22e..fe4255429 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosserver.c,v 1.1.1.7 2001/07/14 22:20:44 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosserver.c,v 1.1.1.8 2001/09/11 14:31:27 hartmans Exp $"); #include #include @@ -866,7 +866,7 @@ char **envp; bozo_Log("try the 'hostname' command\n"); exit(1); } - bzero(tcell.hostAddr, sizeof(tcell.hostAddr)); /* not computed */ + memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */ code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); if (code) { bozo_Log("could not create cell database in '%s' (code %d), quitting\n", AFSDIR_SERVER_ETC_DIRPATH, code); diff --git a/src/bozo/cronbnodeops.c b/src/bozo/cronbnodeops.c index f0fc2d2c6..a3b30926b 100644 --- a/src/bozo/cronbnodeops.c +++ b/src/bozo/cronbnodeops.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/cronbnodeops.c,v 1.1.1.4 2001/07/14 22:20:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/cronbnodeops.c,v 1.1.1.5 2001/09/11 14:31:27 hartmans Exp $"); #include #include @@ -151,7 +151,7 @@ char *acommand; { } te = (struct cronbnode *) malloc(sizeof(struct cronbnode)); - bzero(te, sizeof(struct cronbnode)); + memset(te, 0, sizeof(struct cronbnode)); code = ktime_ParsePeriodic(awhen, &te->whenToRun); if (code < 0) { free(te); diff --git a/src/bozo/ezbnodeops.c b/src/bozo/ezbnodeops.c index 4287742e9..2c5272f06 100644 --- a/src/bozo/ezbnodeops.c +++ b/src/bozo/ezbnodeops.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/ezbnodeops.c,v 1.1.1.4 2001/07/14 22:20:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/ezbnodeops.c,v 1.1.1.5 2001/09/11 14:31:28 hartmans Exp $"); #include #include @@ -91,7 +91,7 @@ char *acommand; { } te = (struct ezbnode *) malloc(sizeof(struct ezbnode)); - bzero(te, sizeof(struct ezbnode)); + memset(te, 0, sizeof(struct ezbnode)); bnode_InitBnode(te, &ezbnode_ops, ainstance); te->command = cmdpath; return (struct bnode *) te; diff --git a/src/bozo/fsbnodeops.c b/src/bozo/fsbnodeops.c index ac8c935d6..ed47e073d 100644 --- a/src/bozo/fsbnodeops.c +++ b/src/bozo/fsbnodeops.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/fsbnodeops.c,v 1.1.1.5 2001/07/14 22:20:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/fsbnodeops.c,v 1.1.1.6 2001/09/11 14:31:28 hartmans Exp $"); #include #include @@ -342,7 +342,7 @@ char *ascancmd; { } te = (struct fsbnode *) malloc(sizeof(struct fsbnode)); - bzero(te, sizeof(struct fsbnode)); + memset(te, 0, sizeof(struct fsbnode)); te->filecmd = fileCmdpath; te->volcmd = volCmdpath; te->salcmd = salCmdpath; diff --git a/src/bu_utils/fms.c b/src/bu_utils/fms.c index fdeb63a1b..e9d6af944 100644 --- a/src/bu_utils/fms.c +++ b/src/bu_utils/fms.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bu_utils/fms.c,v 1.1.1.4 2001/07/14 22:20:46 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bu_utils/fms.c,v 1.1.1.5 2001/09/11 14:31:30 hartmans Exp $"); #undef IN #include @@ -58,7 +58,7 @@ main(argc, argv) struct sigaction intaction, oldaction; struct cmd_syndesc *cptr; - bzero((char *)&intaction, sizeof(intaction)); + memset((char *)&intaction, 0, sizeof(intaction)); intaction.sa_handler = (int (*)())quitFms; sigaction(SIGINT, &intaction, &oldaction); @@ -280,7 +280,7 @@ dataBlock(usd_handle_t hTape, afs_int32 reqSize) if ( dB_buffer == 0 ) ERROR(-1); dB_buffersize = reqSize; - bzero(dB_buffer, dB_buffersize); + memset(dB_buffer, 0, dB_buffersize); } ptr = (int *) dB_buffer; diff --git a/src/bucoord/bc_status.c b/src/bucoord/bc_status.c index 5107e25b0..56828f378 100644 --- a/src/bucoord/bc_status.c +++ b/src/bucoord/bc_status.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/bc_status.c,v 1.1.1.4 2001/07/14 22:20:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/bc_status.c,v 1.1.1.5 2001/09/11 14:31:32 hartmans Exp $"); #include #include @@ -133,7 +133,7 @@ cmdDispatch() statusWatcher() { - struct rx_connection *tconn = (struct rc_connection *)0; + struct rx_connection *tconn = (struct rc_connection *)0; statusP curPollPtr = 0; struct tciStatusS statusPtr; diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index ccf1e6b4b..ca1183832 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/commands.c,v 1.1.1.5 2001/07/14 22:20:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/commands.c,v 1.1.1.6 2001/09/11 14:31:33 hartmans Exp $"); #include #include @@ -125,7 +125,7 @@ afs_int32 getSPEntries(server, partition, serverlist, ss, ps) *ss = 0; return(BC_NOMEM); } - bzero(*ss, sizeof(struct serversort)); + memset(*ss, 0, sizeof(struct serversort)); (*ss)->ipaddr = server; (*ss)->next = *serverlist; *serverlist = *ss; @@ -148,7 +148,7 @@ afs_int32 getSPEntries(server, partition, serverlist, ss, ps) *ss = 0; return(BC_NOMEM); } - bzero(*ps, sizeof(struct partitionsort)); + memset(*ps, 0, sizeof(struct partitionsort)); (*ps)->part = partition; (*ps)->next = (*ss)->partitions; (*ss)->partitions = *ps; @@ -305,7 +305,7 @@ int EvalVolumeSet2(aconfig, avs, avols, uclient) com_err(whoami, BC_NOMEM, ""); ERROR(BC_NOMEM); } - bzero(tvd, sizeof(*tvd)); + memset(tvd, 0, sizeof(*tvd)); tvd->name = (char *) malloc(strlen(entries[e].name)+10); if (!(tvd->name)) { @@ -428,7 +428,7 @@ int EvalVolumeSet1(aconfig, avs, avols, uclient) */ for (index=0; 1; index=next_index) { /*w*/ - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry, /*Routine to invoke*/ uclient, /*Ubik client structure*/ 0, /*Ubik flags*/ @@ -551,7 +551,7 @@ int EvalVolumeSet1(aconfig, avs, avols, uclient) com_err(whoami, BC_NOMEM,""); return(BC_NOMEM); } - bzero(tvd, sizeof(*tvd)); + memset(tvd, 0, sizeof(*tvd)); tvd->name = (char *) malloc(strlen(entry.name)+10); if (!(tvd->name)) @@ -1044,7 +1044,7 @@ bc_KillCmd(as, arock) tp = as->parms[0].items->data; - if (index(tp, '.') == 0) + if (strchr(tp, '.') == 0) { slot = bc_SafeATOI(tp); if (slot == -1) @@ -1181,7 +1181,7 @@ bc_VolRestoreCmd(as, arock) com_err(whoami,BC_NOMEM,""); return BC_NOMEM; } - bzero(tvol, sizeof(struct bc_volumeDump)); + memset(tvol, 0, sizeof(struct bc_volumeDump)); tvol->name = (char *) malloc(VOLSER_MAXVOLNAME +1); if (!tvol->name) @@ -1301,8 +1301,8 @@ char *arock; { } /* create a volume set corresponding to the volume pattern we've been given */ - bzero(&tvolumeSet, sizeof(tvolumeSet)); - bzero(&tvolumeEntry, sizeof(tvolumeEntry)); + memset(&tvolumeSet, 0, sizeof(tvolumeSet)); + memset(&tvolumeEntry, 0, sizeof(tvolumeEntry)); tvolumeSet.name = "TempVolumeSet"; tvolumeSet.ventries = &tvolumeEntry; tvolumeEntry.serverName = as->parms[0].items->data; @@ -1331,7 +1331,7 @@ char *arock; { } } else /* use destination host == original host */ - bcopy(&tvolumeEntry.server, &destServ, sizeof(destServ)); + memcpy(&destServ, &tvolumeEntry.server, sizeof(destServ)); /* specified other destination partition */ if (as->parms[9].items) @@ -1515,7 +1515,7 @@ bc_VolsetRestoreCmd (as, arock) /* Allocate a volumeDump structure and link it in */ tvol = (struct bc_volumeDump *) malloc(sizeof(struct bc_volumeDump)); - bzero(tvol, sizeof(struct bc_volumeDump)); + memset(tvol, 0, sizeof(struct bc_volumeDump)); tvol->name = (char *) malloc(VOLSER_MAXVOLNAME+1); if (!tvol->name) @@ -1524,7 +1524,7 @@ bc_VolsetRestoreCmd (as, arock) return BC_NOMEM; } strncpy(tvol->name, volume, VOLSER_OLDMAXVOLNAME); - bcopy(&destServer, &tvol->server, sizeof(destServer)); + memcpy(&tvol->server, &destServer, sizeof(destServer)); tvol->partition = destPartition; if (lastVol) lastVol->next = tvol; /* thread onto end of list */ @@ -1904,7 +1904,7 @@ int bc_DumpCmd(as, arock) if (parent) problemFindingDump = 1; parent = dumpEntry.id; level = dumpEntry.level+1; - bcopy(&dumpEntry, &fde, sizeof(dumpEntry)); + memcpy(&fde, &dumpEntry, sizeof(dumpEntry)); } else { /* Dump hierarchy not complete so can't base off the latest */ @@ -2763,7 +2763,7 @@ DBLookupByVolume(volumeName) tempPtr = (struct dumpedVol *) malloc(sizeof(struct dumpedVol)); if (!tempPtr) ERROR(BC_NOMEM); - bzero(tempPtr, sizeof(*tempPtr)); + memset(tempPtr, 0, sizeof(*tempPtr)); tempPtr->incTime = volumeEntry[i].clone; tempPtr->dumpID = volumeEntry[i].dump; strncpy(tempPtr->tapeName, volumeEntry[i].tape, BU_MAXTAPELEN); @@ -2925,7 +2925,7 @@ dumpInfo(dumpid, detailFlag) ERROR(BC_NOMEM); } - bzero(tapeLinkPtr, sizeof(*tapeLinkPtr)); + memset(tapeLinkPtr, 0, sizeof(*tapeLinkPtr)); code = bcdb_FindTapeSeq(dumpid, tapeNumber, &tapeLinkPtr->tapeEntry); if (code) { @@ -2987,10 +2987,9 @@ dumpInfo(dumpid, detailFlag) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero(volumeLinkPtr, sizeof(*volumeLinkPtr)); + memset(volumeLinkPtr, 0, sizeof(*volumeLinkPtr)); - bcopy(&vl.budb_volumeList_val[i], &volumeLinkPtr->volumeEntry, - sizeof(struct budb_volumeEntry)); + memcpy(&volumeLinkPtr->volumeEntry, &vl.budb_volumeList_val[i], sizeof(struct budb_volumeEntry)); /* now insert it onto the right place */ while ( (*link != 0) && diff --git a/src/bucoord/config.c b/src/bucoord/config.c index 62c7811d8..873273855 100644 --- a/src/bucoord/config.c +++ b/src/bucoord/config.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/config.c,v 1.1.1.4 2001/07/14 22:20:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/config.c,v 1.1.1.5 2001/09/11 14:31:33 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -72,7 +72,7 @@ bc_InitConfig(apath) if (!tb) return(BC_NOMEM); bc_globalConfig = tb; - bzero(tb, sizeof(struct bc_config)); + memset(tb, 0, sizeof(struct bc_config)); tb->path = (char *) malloc(strlen(apath)+1); if (!tb->path) { @@ -108,13 +108,13 @@ char *aname; { /* tlast now points to the next pointer (or head pointer) we should overwrite */ tentry = (struct bc_hostEntry *) malloc(sizeof(struct bc_hostEntry)); - bzero(tentry, sizeof(*tentry)); + memset(tentry, 0, sizeof(*tentry)); tentry->name = (char *) malloc(strlen(aname)+1); strcpy(tentry->name, aname); *tlast = tentry; tentry->next = (struct bc_hostEntry *) 0; tentry->addr.sin_family = AF_INET; - bcopy(th->h_addr, &tentry->addr.sin_addr.s_addr, sizeof(afs_int32)); + memcpy(&tentry->addr.sin_addr.s_addr, th->h_addr, sizeof(afs_int32)); tentry->addr.sin_port = 0; tentry->portOffset = aport; return 0; diff --git a/src/bucoord/dsstub.c b/src/bucoord/dsstub.c index dddba0350..ca8480ea6 100644 --- a/src/bucoord/dsstub.c +++ b/src/bucoord/dsstub.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dsstub.c,v 1.1.1.4 2001/07/14 22:20:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dsstub.c,v 1.1.1.5 2001/09/11 14:31:34 hartmans Exp $"); #include #include @@ -177,7 +177,7 @@ tailCompPtr(pathNamePtr) char *pathNamePtr; { char *ptr; - ptr = rindex(pathNamePtr, '/'); + ptr = strrchr(pathNamePtr, '/'); if ( ptr == 0 ) { /* this should never happen */ diff --git a/src/bucoord/dsvs.c b/src/bucoord/dsvs.c index a0c9885be..e27c84ab0 100644 --- a/src/bucoord/dsvs.c +++ b/src/bucoord/dsvs.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dsvs.c,v 1.1.1.4 2001/07/14 22:20:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dsvs.c,v 1.1.1.5 2001/09/11 14:31:35 hartmans Exp $"); #include #include @@ -154,9 +154,9 @@ int bc_ParseHost(aname, asockaddr) asockaddr->sin_family = AF_INET; asockaddr->sin_port = 0; addr = (b1<<24) | (b2<<16) | (b3<<8) | b4; - bcopy(&addr,&tmp1,sizeof(afs_int32)); + memcpy(&tmp1, &addr, sizeof(afs_int32)); tmp2 = htonl(tmp1); - bcopy(&tmp2, &asockaddr->sin_addr.s_addr, sizeof(afs_int32)); + memcpy(&asockaddr->sin_addr.s_addr, &tmp2, sizeof(afs_int32)); return(0); } @@ -166,7 +166,7 @@ int bc_ParseHost(aname, asockaddr) */ if (strcmp(aname, ".*") == 0) { - bzero(asockaddr, sizeof(struct sockaddr_in)); + memset(asockaddr, 0, sizeof(struct sockaddr_in)); return 0; } @@ -182,10 +182,9 @@ int bc_ParseHost(aname, asockaddr) */ asockaddr->sin_family = AF_INET; asockaddr->sin_port = 0; - bcopy(th->h_addr,&tmp1,sizeof(afs_int32)); + memcpy(&tmp1, th->h_addr, sizeof(afs_int32)); tmp2 = htonl(tmp1); - bcopy(&tmp2,&(asockaddr->sin_addr.s_addr), - sizeof(asockaddr->sin_addr.s_addr)); + memcpy(&(asockaddr->sin_addr.s_addr), &tmp2, sizeof(asockaddr->sin_addr.s_addr)); return(0); } /*bc_ParseHost*/ @@ -203,7 +202,7 @@ bc_CreateVolumeSet(aconfig, avolName, aflags) /* move to end of the list */ nset = (struct bc_volumeSet *) malloc(sizeof(struct bc_volumeSet)); - bzero(nset, sizeof(*nset)); + memset(nset, 0, sizeof(*nset)); nset->flags = aflags; nset->name = (char *) malloc(strlen(avolName)+1); strcpy(nset->name, avolName); @@ -314,7 +313,7 @@ bc_AddVolumeItem(aconfig, avolName, ahost, apart, avol) /* move to end of the list */ for(tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast); tentry = (struct bc_volumeEntry *) malloc(sizeof(struct bc_volumeEntry)); - bzero(tentry, sizeof(*tentry)); + memset(tentry, 0, sizeof(*tentry)); tentry->serverName = (char *) malloc(strlen(ahost)+1); strcpy(tentry->serverName, ahost); tentry->partname = (char *) malloc(strlen(apart)+1); @@ -381,7 +380,7 @@ afs_int32 expType; return -2; /* name specification error */ tdump = (struct bc_dumpSchedule *) malloc(sizeof(struct bc_dumpSchedule)); - bzero(tdump, sizeof(*tdump)); + memset(tdump, 0, sizeof(*tdump)); /* prepend this node to the dump schedule list */ tdump->next = aconfig->dsched; @@ -568,7 +567,7 @@ FindDump(aconfig, nodeString, parentptr, nodeptr) matchLength = 0; curptr = &nodeString[1]; /* past first / */ - separator = index(curptr, '/'); + separator = strchr(curptr, '/'); if ( separator == 0 ) matchLength = strlen(curptr) + 1; /* +1 for leading / */ else @@ -613,7 +612,7 @@ FindDump(aconfig, nodeString, parentptr, nodeptr) return(-3); } - separator = index(curptr, '/'); + separator = strchr(curptr, '/'); if ( separator == 0 ) matchLength = strlen(&nodeString[0]); else diff --git a/src/bucoord/dump.c b/src/bucoord/dump.c index 857f0d9f6..14da3ad42 100644 --- a/src/bucoord/dump.c +++ b/src/bucoord/dump.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dump.c,v 1.1.1.4 2001/07/14 22:20:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dump.c,v 1.1.1.5 2001/09/11 14:31:35 hartmans Exp $"); #include #include @@ -120,7 +120,7 @@ bc_Dumper(aindex) baseNamePtr = tailCompPtr(dumpTaskPtr->dumpName); /* setup the interface structure */ - bzero(tcdiPtr, sizeof(*tcdiPtr)); + memset(tcdiPtr, 0, sizeof(*tcdiPtr)); /* general */ strcpy(tcdiPtr->dumpPath, dumpTaskPtr->dumpName); @@ -273,7 +273,7 @@ bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer, adestPartition return(BC_NOTLOCKED); } - bzero(&bc_dumpTasks[i], sizeof(struct bc_dumpTask)); + memset(&bc_dumpTasks[i], 0, sizeof(struct bc_dumpTask)); bc_dumpTasks[i].callProc = aproc; bc_dumpTasks[i].config = aconfig; bc_dumpTasks[i].volumes = avolsToDump; @@ -298,9 +298,9 @@ bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer, adestPartition bc_dumpTasks[i].expType = dsptr->expType; } if (adestServer) - bcopy(adestServer, &bc_dumpTasks[i].destServer, sizeof(struct sockaddr_in)); + memcpy(&bc_dumpTasks[i].destServer, adestServer, sizeof(struct sockaddr_in)); else - bzero(&bc_dumpTasks[i].destServer, sizeof(struct sockaddr_in)); + memset(&bc_dumpTasks[i].destServer, 0, sizeof(struct sockaddr_in)); code = LWP_CreateProcess(bc_DmpRstStart, 20480, LWP_NORMAL_PRIORITY, i, "helper", &junk); if (code) @@ -373,7 +373,7 @@ afs_int32 size; code = ConnectButc(config, port, &tconn); if (code) return(code); - bzero(&label,sizeof(label)); + memset(&label, 0, sizeof(label)); if (afsname) strcpy(label.afsname, afsname); if (pname) @@ -421,7 +421,7 @@ bc_ReadLabel(config,port) code = ConnectButc(config, port, &tconn); if (code) return(code); - bzero(&label,sizeof(label)); + memset(&label, 0, sizeof(label)); code = TC_ReadLabel(tconn, &label, &taskId); if (code) { if (code == BUTM_NOLABEL) { diff --git a/src/bucoord/dump_sched.c b/src/bucoord/dump_sched.c index 5f7c2bd54..c34dd148a 100644 --- a/src/bucoord/dump_sched.c +++ b/src/bucoord/dump_sched.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dump_sched.c,v 1.1.1.4 2001/07/14 22:20:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/dump_sched.c,v 1.1.1.5 2001/09/11 14:31:36 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -394,7 +394,7 @@ bc_ParseDumpSchedule() return (BC_INTERNALERROR); } tds = (struct bc_dumpSchedule *)malloc(sizeof(struct bc_dumpSchedule)); - bzero(tds, sizeof(*tds)); + memset(tds, 0, sizeof(*tds)); tds->next = (struct bc_dumpSchedule *) 0; tds->name = (char *) malloc(strlen(dsname)+1); diff --git a/src/bucoord/expire.c b/src/bucoord/expire.c index 7b0519752..ec8886378 100644 --- a/src/bucoord/expire.c +++ b/src/bucoord/expire.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/expire.c,v 1.1.1.4 2001/07/14 22:20:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/expire.c,v 1.1.1.5 2001/09/11 14:31:36 hartmans Exp $"); #include #include @@ -63,7 +63,7 @@ LongTo_ktimeRelDate(longDate, kdptr) afs_int32 longDate; struct ktime_date *kdptr; { - bzero(kdptr, sizeof(*kdptr)); + memset(kdptr, 0, sizeof(*kdptr)); kdptr->day = longDate % (MAX_DAY_VALUE + 1); if ( kdptr->day != 0 ) @@ -264,7 +264,7 @@ ParseRelDate(dateStr, relDatePtr) afs_int32 value, digit_limit; afs_int32 type_index; - bzero(relDatePtr, sizeof(*relDatePtr)); + memset(relDatePtr, 0, sizeof(*relDatePtr)); type_index = 0; while ( 1 ) diff --git a/src/bucoord/main.c b/src/bucoord/main.c index 3cdefd931..8871b9a50 100644 --- a/src/bucoord/main.c +++ b/src/bucoord/main.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/main.c,v 1.1.1.5 2001/07/20 10:06:30 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/main.c,v 1.1.1.6 2001/09/11 14:31:36 hartmans Exp $"); #include #include @@ -195,7 +195,7 @@ bc_InitTextConfig() for ( i = 0; i < TB_NUM; i++ ) { - bzero(ctPtr, sizeof(*ctPtr)); + memset(ctPtr, 0, sizeof(*ctPtr)); ctPtr->textType = i; ctPtr->textVersion = -1; ctPtr++; diff --git a/src/bucoord/restore.c b/src/bucoord/restore.c index 908fef59c..38746f4c2 100644 --- a/src/bucoord/restore.c +++ b/src/bucoord/restore.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/restore.c,v 1.1.1.4 2001/07/14 22:20:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/restore.c,v 1.1.1.5 2001/09/11 14:31:37 hartmans Exp $"); #include #include @@ -44,10 +44,6 @@ extern void bc_HandleMisc(); extern char *whoami; extern struct rx_connection *bc_GetConn(); -#ifdef AFS_SGI64_ENV -extern char *rindex(); -#endif - #define BC_MAXLEVELS 20 #define MAXTAPESATONCE 10 @@ -139,7 +135,7 @@ extractTapeSeq(tapename) { char *sptr; - sptr = rindex(tapename, '.'); + sptr = strrchr(tapename, '.'); if ( !sptr ) return(-1); sptr++; return(atol(sptr)); @@ -277,7 +273,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero (di, sizeof(struct dumpinfo)); + memset(di, 0, sizeof(struct dumpinfo)); di->DumpId = dumpDescr->id; di->initialDumpId = dumpDescr->initialDumpID; @@ -303,7 +299,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero (vi, sizeof(struct volinfo)); + memset(vi, 0, sizeof(struct volinfo)); vi->volname = (char*)malloc(strlen(vname)+1); if (!vi->volname) @@ -337,7 +333,7 @@ bc_Restorer(aindex) for (di=dumpinfolist; di; di=di->next) { /* Find each of the parent dumps */ - bcopy(di, &dlevels[0], sizeof(struct dumpinfo)); + memcpy(&dlevels[0], di, sizeof(struct dumpinfo)); for (lvl=1, parent=dlevels[0].parentDumpId; parent; parent=dlevels[lvl].parentDumpId, lvl++) { @@ -479,7 +475,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); return(BC_NOMEM); } - bzero(tle, sizeof(struct bc_tapeList)); + memset(tle, 0, sizeof(struct bc_tapeList)); tle->tapeName = (char*)malloc(strlen(volumeEntries[ve].tape)+1); if (!tle->tapeName) @@ -531,7 +527,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); return(BC_NOMEM); } - bzero(ti, sizeof(struct bc_tapeItem)); + memset(ti, 0, sizeof(struct bc_tapeItem)); ti->volumeName = (char*)malloc(strlen(volumeEntries[ve].name)+1); if (!ti->volumeName) @@ -630,7 +626,7 @@ bc_Restorer(aindex) com_err(whoami,BC_NOMEM,""); ERROR(BC_NOMEM); } - bzero(tcarray, nentries*sizeof(struct tc_restoreDesc)); + memset(tcarray, 0, nentries*sizeof(struct tc_restoreDesc)); /* Fill in the array with the list above */ i = 0; diff --git a/src/bucoord/status.c b/src/bucoord/status.c index 71897687d..884bba1fc 100644 --- a/src/bucoord/status.c +++ b/src/bucoord/status.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/status.c,v 1.1.1.4 2001/07/14 22:20:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/status.c,v 1.1.1.5 2001/09/11 14:31:37 hartmans Exp $"); #include #include @@ -100,7 +100,7 @@ createStatusNode() { return(0); } - bzero(ptr, sizeof(*ptr)); + memset(ptr, 0, sizeof(*ptr)); /* link it onto the chain of status entries */ ObtainWriteLock(&statusQueueLock); diff --git a/src/bucoord/tape_hosts.c b/src/bucoord/tape_hosts.c index f51fe9614..ea9163d84 100644 --- a/src/bucoord/tape_hosts.c +++ b/src/bucoord/tape_hosts.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/tape_hosts.c,v 1.1.1.4 2001/07/14 22:20:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/tape_hosts.c,v 1.1.1.5 2001/09/11 14:31:38 hartmans Exp $"); #include #include @@ -269,7 +269,7 @@ int bc_ParseHosts() the = (struct bc_hostEntry *) malloc(sizeof(struct bc_hostEntry)); if (the == (struct bc_hostEntry *)0) return (BC_NOMEM); - bzero(the, sizeof(struct bc_hostEntry)); + memset(the, 0, sizeof(struct bc_hostEntry)); if (tlast) { tlast->next = the; @@ -284,7 +284,7 @@ int bc_ParseHosts() strcpy(the->name, hostName); the->portOffset = port; if (th) { - bcopy(th->h_addr, &the->addr.sin_addr.s_addr, 4); + memcpy(&the->addr.sin_addr.s_addr, th->h_addr, 4); the->addr.sin_family = AF_INET; the->addr.sin_port = 0; } diff --git a/src/bucoord/ttest.c b/src/bucoord/ttest.c index 3b1dc84a3..e39495d93 100644 --- a/src/bucoord/ttest.c +++ b/src/bucoord/ttest.c @@ -87,7 +87,7 @@ afs_int32 *adumpID; { printf("tape controller received request to start dump %s.\n", adumpName); *adumpID = ++transID; /* send result back to caller */ - bzero(&tdentry, sizeof(tdentry)); + memset(&tdentry, 0, sizeof(tdentry)); tdentry.created = time(0); strcpy(tdentry.name, atapeSet->format); strcat(tdentry.name, "."); @@ -111,7 +111,7 @@ afs_int32 *adumpID; { printf("created dump %d\n", tdentry.id); /* start tape (preent all fits on one tape at first */ - bzero(&ttentry, sizeof(ttentry)); + memset(&ttentry, 0, sizeof(ttentry)); sprintf(ttentry.name, tdentry.tapes.format, 1); ttentry.written = time(0); ttentry.dump = tdentry.id; /* dump we're in */ @@ -126,10 +126,10 @@ afs_int32 *adumpID; { tdescr = adumpArray->tc_dumpArray_val; for(i=0;itc_dumpArray_len;i++, tdescr++) { - bcopy(tdescr->hostID, &taddr, sizeof(taddr)); + memcpy(&taddr, tdescr->hostID, sizeof(taddr)); printf("dumping volid %s(%d) from host %08x since date %d\n", tdescr->name, tdescr->vid, taddr.sin_addr.s_addr, tdescr->date); - bzero(&tventry, sizeof(tventry)); + memset(&tventry, 0, sizeof(tventry)); strcpy(tventry.name, tdescr->name); tventry.clone = tdescr->date; tventry.seq = 0; /* frag in volume */ @@ -174,7 +174,7 @@ afs_int32 *adumpID; { printf("tape controller received request to start restore %s.\n", aname); tdescr = arestore->tc_restoreArray_val; for(i=0;itc_restoreArray_len; i++, tdescr++) { - bcopy(tdescr->hostID, &taddr, sizeof(taddr)); + memcpy(&taddr, tdescr->hostID, sizeof(taddr)); printf("restoring frag %d of volume %s from tape %s at position %d.\n New name is '%s', new vid is %d, new host is %08x, new partition is %d\n", tdescr->frag, tdescr->oldName, tdescr->tapeName, tdescr->position, tdescr->newName, tdescr->vid, taddr.sin_addr.s_addr, tdescr->partition); diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index c733151f2..36da12dc7 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/ubik_db_if.c,v 1.1.1.5 2001/07/14 22:20:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/ubik_db_if.c,v 1.1.1.6 2001/09/11 14:31:38 hartmans Exp $"); #include #include @@ -234,7 +234,7 @@ bcdb_FindDumpByID(dumpID, deptr) goto error; } - bcopy(dl.budb_dumpList_val, deptr, sizeof(*deptr)); + memcpy(deptr, dl.budb_dumpList_val, sizeof(*deptr)); exit: if ( dl.budb_dumpList_val ) @@ -245,7 +245,7 @@ exit: return(code); error: - bzero(deptr, sizeof(*deptr)); + memset(deptr, 0, sizeof(*deptr)); goto exit; } @@ -327,7 +327,7 @@ bcdb_FindTape(dumpid, tapeName, teptr) afs_int32 dbTime; afs_int32 code = 0; - bzero(teptr, sizeof(*teptr)); + memset(teptr, 0, sizeof(*teptr)); tl.budb_tapeList_len = 0; tl.budb_tapeList_val = 0; @@ -341,7 +341,7 @@ bcdb_FindTape(dumpid, tapeName, teptr) if (tl.budb_tapeList_len != 1) ERROR(BC_NOTUNIQUE); /* expecting a single descriptor */ - bcopy(tl.budb_tapeList_val, teptr, sizeof(*teptr)); + memcpy(teptr, tl.budb_tapeList_val, sizeof(*teptr)); error_exit: if ( tl.budb_tapeList_val ) @@ -359,7 +359,7 @@ bcdb_FindTapeSeq(dumpid, tapeSeq, teptr) afs_int32 dbTime; afs_int32 code = 0; - bzero(teptr, sizeof(*teptr)); + memset(teptr, 0, sizeof(*teptr)); tl.budb_tapeList_len = 0; tl.budb_tapeList_val = 0; @@ -372,7 +372,7 @@ bcdb_FindTapeSeq(dumpid, tapeSeq, teptr) if (tl.budb_tapeList_len != 1) ERROR(BC_NOTUNIQUE); /* expecting a single descriptor */ - bcopy(tl.budb_tapeList_val, teptr, sizeof(*teptr)); + memcpy(teptr, tl.budb_tapeList_val, sizeof(*teptr)); error_exit: if ( tl.budb_tapeList_val ) @@ -1191,14 +1191,14 @@ ubik_Call_SingleServer(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p if ( code ) { /* error. Clean up single server state */ - bzero(&uServer, sizeof(uServer)); + memset(&uServer, 0, sizeof(uServer)); } return(code); } else if ( (aflags & UF_END_SINGLESERVER) != 0 ) { - bzero(&uServer, sizeof(uServer)); + memset(&uServer, 0, sizeof(uServer)); return(0); } } diff --git a/src/bucoord/vol_sets.c b/src/bucoord/vol_sets.c index 30f4406e7..2a495edc5 100644 --- a/src/bucoord/vol_sets.c +++ b/src/bucoord/vol_sets.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/vol_sets.c,v 1.1.1.6 2001/07/14 22:20:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bucoord/vol_sets.c,v 1.1.1.7 2001/09/11 14:31:40 hartmans Exp $"); #include #include @@ -496,7 +496,7 @@ bc_ParseVolumeSet() * global configuration structure. */ tvs = (struct bc_volumeSet *) malloc(sizeof(struct bc_volumeSet)); - bzero(tvs, sizeof(*tvs)); + memset(tvs, 0, sizeof(*tvs)); tvs->name = (char *) malloc(strlen(vsname)+1); strcpy(tvs->name, vsname); @@ -531,7 +531,7 @@ bc_ParseVolumeSet() com_err(whoami,0, "Can't malloc() a new volume spec record!"); return(-1); } - bzero(tve, sizeof(*tve)); + memset(tve, 0, sizeof(*tve)); if (bc_ParseHost(serverName, &(tve->server))) com_err(whoami,0, "Can't get required info on host '%s'", serverName); diff --git a/src/budb/database.c b/src/budb/database.c index 97a1ac367..b4f4904ad 100644 --- a/src/budb/database.c +++ b/src/budb/database.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/database.c,v 1.1.1.4 2001/07/14 22:20:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/database.c,v 1.1.1.5 2001/09/11 14:31:41 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -44,7 +44,7 @@ afs_int32 InitDB () pollCount = 0; - bzero (&db, sizeof(db)); + memset(&db, 0, sizeof(db)); Lock_Init (&db.lock); if ((code = InitDBalloc ()) || (code = InitDBhash ())) return code; @@ -225,7 +225,7 @@ CheckInit (ut, db_init) LogDebug(0, "No data base - Building new one\n"); /* try to write a good header */ - bzero(&db.h,sizeof(db.h)); + memset(&db.h, 0, sizeof(db.h)); db.h.version = htonl(BUDB_VERSION); db.h.checkVersion = htonl(BUDB_VERSION); db.h.lastUpdate = db.h.lastDumpId = htonl(time(0)); diff --git a/src/budb/db_alloc.c b/src/budb/db_alloc.c index c1f667ff4..49b453d9e 100644 --- a/src/budb/db_alloc.c +++ b/src/budb/db_alloc.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_alloc.c,v 1.1.1.4 2001/07/14 22:20:57 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_alloc.c,v 1.1.1.5 2001/09/11 14:31:41 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -84,7 +84,7 @@ AllocBlock (ut, block, aP) } /* clear and return the block */ - bzero (block, sizeof(*block)); + memset(block, 0, sizeof(*block)); *aP = a; return 0; } @@ -103,7 +103,7 @@ FreeBlock (ut, bh, a) dbadr a; /* db address of block */ { if (a != BlockBase(a)) db_panic ("Block addr no good"); - bzero (bh, sizeof(*bh)); + memset(bh, 0, sizeof(*bh)); bh->next = db.h.freePtrs[0]; if (set_header_word (ut, freePtrs[0], htonl(a)) || dbwrite (ut, a, (char *)bh, sizeof(*bh))) return BUDB_IO; diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 09a62f680..ab1393b3b 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_dump.c,v 1.1.1.4 2001/07/14 22:20:57 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_dump.c,v 1.1.1.5 2001/09/11 14:31:41 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -620,7 +620,7 @@ writeDatabase(ut, fid) /* Read the dump entry */ if (dbAddr == dbAppAddr) { /* First time through, don't need to read the dump entry again */ - bcopy(&diskDump, &apDiskDump, sizeof(diskDump)); + memcpy(&apDiskDump, &diskDump, sizeof(diskDump)); } else { if (badEntry(dbAppAddr)) { diff --git a/src/budb/db_hash.c b/src/budb/db_hash.c index acea7c264..ef5c4f88a 100644 --- a/src/budb/db_hash.c +++ b/src/budb/db_hash.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_hash.c,v 1.1.1.4 2001/07/14 22:20:57 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_hash.c,v 1.1.1.5 2001/09/11 14:31:42 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -159,7 +159,7 @@ afs_int32 ht_AllocTable (ut, mht) mht->size = nb*sizeof(struct memoryHTBlock *); b = mht->blocks = (struct memoryHTBlock **)malloc (mht->size); - bzero (b, mht->size); + memset(b, 0, mht->size); for (i=0; i= n) db_panic ("table size inconsistent"); diff --git a/src/budb/db_text.c b/src/budb/db_text.c index 8ed6a4f46..74890c3e9 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_text.c,v 1.1.1.5 2001/07/14 22:20:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/db_text.c,v 1.1.1.6 2001/09/11 14:31:42 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -172,7 +172,7 @@ afs_int32 GetText (call, lockHandle, textType, maxLength, offset, textRemaining = BLOCK_DATA_SIZE - blockOffset; chunkSize = min(textRemaining, transferSize); - bcopy(&block.a[blockOffset], textPtr, chunkSize); + memcpy(textPtr, &block.a[blockOffset], chunkSize); /* LogDebug(5, "transfering %d bytes: %s\n", chunkSize, textPtr); */ @@ -400,7 +400,7 @@ afs_int32 SaveText (call, lockHandle, textType, offset, flags, charListPtr) chunkSize = MIN(remainingInBlock, textLength); /* copy in the data */ - bcopy(textptr, &diskBlock.a[offset % BLOCK_DATA_SIZE], chunkSize); + memcpy(&diskBlock.a[offset % BLOCK_DATA_SIZE], textptr, chunkSize); /* LogDebug(5, "text is %s\n", textptr); */ diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index 2ba92f863..a84676567 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/dbs_dump.c,v 1.1.1.4 2001/07/14 22:20:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/dbs_dump.c,v 1.1.1.5 2001/09/11 14:31:43 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -143,7 +143,7 @@ afs_int32 DumpDB (call, firstcall, maxLength, charListPtr, done) LogDebug(5, "Setup dump\n"); /* no dump in progress - setup and retake lock */ - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); /* ObtainWriteLock(&dumpSyncPtr->ds_lock); */ /* mark dump in progress */ @@ -320,7 +320,7 @@ dumpWatcher() if (code) LogError(code, "Aborting dump transaction\n"); } - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); goto exit; } /*i*/ diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index f9e09a66f..4cddfb2f9 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/ol_verify.c,v 1.1.1.4 2001/07/14 22:20:59 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/ol_verify.c,v 1.1.1.5 2001/09/11 14:31:43 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -723,12 +723,12 @@ verifyBlocks(ut) bmsize = sizeof(*ablockMap) + (blockEntries[blocktype]-1) * sizeof(ablockMap->entries[0]); ablockMap = (struct blockMap *) malloc(bmsize); if (!ablockMap) ERROR(BUDB_NOMEM); - bzero(ablockMap, bmsize); + memset(ablockMap, 0, bmsize); ablockMap->nEntries = blockEntries[blocktype]; /* save the block header in the block map */ - bcopy(&block.h, &ablockMap->header, sizeof(ablockMap->header)); + memcpy(&ablockMap->header, &block.h, sizeof(ablockMap->header)); blockMap[i] = ablockMap; } @@ -1276,7 +1276,7 @@ verifyDatabase(ut, recreateFile) /* clear verification statistics */ misc = &miscData; - bzero (&miscData, sizeof(miscData)); + memset(&miscData, 0, sizeof(miscData)); #ifdef PDEBUG miscData.maxErrors = 1000000; @@ -1309,7 +1309,7 @@ verifyDatabase(ut, recreateFile) bmsize = nBlocks*sizeof(struct blockMap *); blockMap = (struct blockMap **) malloc(bmsize); if (!blockMap) ERROR(BUDB_NOMEM); - bzero(blockMap, bmsize); + memset(blockMap, 0, bmsize); /* verify blocks and construct the block map */ Log("Read header of every block\n"); @@ -1462,7 +1462,7 @@ error_exit: if (!th) *host = 0; else { - bcopy(th->h_addr, host, sizeof(afs_int32)); + memcpy(host, th->h_addr, sizeof(afs_int32)); *host = ntohl(*host); } diff --git a/src/budb/procs.c b/src/budb/procs.c index e6944caac..6506fbdcf 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/procs.c,v 1.1.1.4 2001/07/14 22:21:02 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/procs.c,v 1.1.1.5 2001/09/11 14:31:45 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -123,7 +123,7 @@ tailCompPtr(pathNamePtr) char *pathNamePtr; { char *ptr; - ptr = rindex(pathNamePtr, '/'); + ptr = strrchr(pathNamePtr, '/'); if ( ptr == 0 ) { /* this should never happen */ @@ -516,7 +516,7 @@ SendReturnList (ut, list, FillProc, e_size, index, nextIndexP, dbTimeP, eList) eList->budb_dumpList_val = (struct budb_dumpEntry *)malloc (e_size * to_return); if (!eList->budb_dumpList_val) return(BUDB_NOMEM); } - bzero(eList->budb_dumpList_val, e_size * to_return); + memset(eList->budb_dumpList_val, 0, e_size * to_return); eList->budb_dumpList_len = to_return; e = (char *)(eList->budb_dumpList_val); @@ -707,7 +707,7 @@ static afs_int32 GetVolInfo (ut, volP, viaP, viP) else if ( !VolInfoMatch(volP,viP) ) /* Not the head volinfo struct */ { hvia = via; /* remember the head volinfo struct */ - bcopy(viP, &hvi, sizeof(hvi)); + memcpy(&hvi, viP, sizeof(hvi)); /* Search the same name chain for the correct volinfo structure */ for (via=ntohl(viP->sameNameChain); via; via=ntohl(viP->sameNameChain)) @@ -998,7 +998,7 @@ rememberDump(dumpAddrParam, dumpParam, dumpListPtrParam) ptr = (struct chosenDump *) malloc(sizeof(*ptr)); if (!ptr) return(0); - bzero(ptr, sizeof(*ptr)); + memset(ptr, 0, sizeof(*ptr)); ptr->addr = dumpAddr; ptr->date = (afs_uint32) ntohl(dumpPtr->created); @@ -1385,7 +1385,7 @@ afs_int32 CreateDump(call, dump) } /* Allocate a dump structure */ - bzero (&d, sizeof(d)); + memset(&d, 0, sizeof(d)); eval = AllocStructure (ut, dump_BLOCK, 0, &da, &d); if (eval) ABORT(eval); @@ -2040,7 +2040,7 @@ afs_int32 FindLatestDump (call, vsname, dumpPath, dumpentry) /* Construct a database dump name */ strcpy(dumpName, DUMP_TAPE_NAME); } - else if (index(dumpPath,'/') == 0) { + else if (strchr(dumpPath,'/') == 0) { int level, old, length, hash; struct dump hostDump, diskDump; struct memoryHashTable *mht; @@ -2450,7 +2450,7 @@ afs_int32 GetDumps (call, majorVersion, flags, name, start, end, /* end specifies how many dumps */ if (!end) ABORT(BUDB_BADFLAGS); - bzero(&rock, sizeof(rock)); + memset(&rock, 0, sizeof(rock)); rock.maxDumps = end; scanHashTable(ut, &db.dumpName, wantDump, rememberDump, (char *) &rock); @@ -2737,7 +2737,7 @@ afs_int32 FindLastTape (call, dumpID, dumpEntry, tapeEntry, volEntry) /* Zero volume entry if the last tape has no volumes */ if (!lastVol) { - bzero(volEntry, sizeof(*volEntry)); + memset(volEntry, 0, sizeof(*volEntry)); } else { /* Follow the volumes until we reach the last volume */ eval = dbread (ut,lastVol,&vf,sizeof(vf)); @@ -3138,7 +3138,7 @@ afs_int32 UseTape (call, tape, new) *new = 0; - bzero (&t, sizeof(t)); + memset(&t, 0, sizeof(t)); eval = AllocStructure (ut, tape_BLOCK, 0, &a, &t); if (eval) ABORT(eval); diff --git a/src/budb/server.c b/src/budb/server.c index c083b4e9f..9b6dc1a85 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/server.c,v 1.1.1.4 2001/07/14 22:21:03 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/server.c,v 1.1.1.5 2001/09/11 14:31:45 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -94,7 +94,7 @@ convert_cell_to_ubik (cellinfo, myHost, serverList) printf("prserver: couldn't get address of this host.\n"); BUDB_EXIT(1); } - bcopy(th->h_addr,myHost,sizeof(afs_int32)); + memcpy(myHost, th->h_addr, sizeof(afs_int32)); for (i=0; inumServers; i++) /* omit my host from serverList */ @@ -351,7 +351,7 @@ main(argc, argv) exit(2); } - bzero(globalConfPtr, sizeof(*globalConfPtr)); + memset(globalConfPtr, 0, sizeof(*globalConfPtr)); /* set default configuration values */ strcpy(dbDir, AFSDIR_SERVER_DB_DIRPATH); @@ -494,7 +494,7 @@ main(argc, argv) /* misc. initialization */ /* database dump synchronization */ - bzero(dumpSyncPtr, sizeof(*dumpSyncPtr)); + memset(dumpSyncPtr, 0, sizeof(*dumpSyncPtr)); Lock_Init(&dumpSyncPtr->ds_lock); rx_StartServer(0); /* start handling requests */ diff --git a/src/budb/struct_ops.c b/src/budb/struct_ops.c index eadb34e46..17b2252a1 100644 --- a/src/budb/struct_ops.c +++ b/src/budb/struct_ops.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/budb/struct_ops.c,v 1.1.1.4 2001/07/14 22:21:02 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/budb/struct_ops.c,v 1.1.1.5 2001/09/11 14:31:46 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -547,7 +547,7 @@ dumpToBudbDump(dumpPtr, budbDumpPtr) budbDumpPtr->created = dumpPtr->created; budbDumpPtr->nVolumes = dumpPtr->nVolumes; - bcopy(&dumpPtr->tapes, &budbDumpPtr->tapes, sizeof(struct budb_tapeSet)); + memcpy(&budbDumpPtr->tapes, &dumpPtr->tapes, sizeof(struct budb_tapeSet)); copy_ktcPrincipal_to_budbPrincipal(&dumpPtr->dumper, &budbDumpPtr->dumper); return(0); } @@ -611,7 +611,7 @@ default_tapeset(tapesetPtr, dumpname) struct budb_tapeSet *tapesetPtr; char *dumpname; { - bzero(tapesetPtr, sizeof(*tapesetPtr)); + memset(tapesetPtr, 0, sizeof(*tapesetPtr)); strcpy(tapesetPtr->format, dumpname); strcat(tapesetPtr->format, ".%d"); diff --git a/src/butc/dbentries.c b/src/butc/dbentries.c index 34282be71..9f4623665 100644 --- a/src/butc/dbentries.c +++ b/src/butc/dbentries.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/dbentries.c,v 1.1.1.4 2001/07/14 22:21:04 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/dbentries.c,v 1.1.1.5 2001/09/11 14:31:47 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -75,7 +75,7 @@ afs_int32 threadEntryDir(anEntry, size, type) entryPtr->dlq_type = type; entryPtr->dlq_structPtr = entry; - bcopy (anEntry, entry, size); + memcpy(entry, anEntry, size); dlqLinkb (&entries_to_flush, entryPtr); return(0); } @@ -119,7 +119,7 @@ threadEntry(anEntry, size, type) entryPtr->dlq_type = type; entryPtr->dlq_structPtr = entry; - bcopy (anEntry, entry, size); + memcpy(entry, anEntry, size); dlqLinkb (&savedEntries, (dlqlinkP)entryPtr); return(0); } @@ -164,7 +164,7 @@ afs_int32 useTape (aTapeEntryPtr, dumpID, tapename, tapeSeq, useCount, written, { afs_int32 code = 0; - bzero(aTapeEntryPtr, sizeof(struct budb_tapeEntry)); + memset(aTapeEntryPtr, 0, sizeof(struct budb_tapeEntry)); strcpy(aTapeEntryPtr->name, tapename); aTapeEntryPtr->flags = BUDB_TAPE_BEINGWRITTEN; aTapeEntryPtr->written = written; /* When label was written */ @@ -221,7 +221,7 @@ afs_int32 addVolume(aVolEntryPtr, dumpID, tapename, volname, volid, cloneDate, allo = 1; } - bzero(aVolEntryPtr, sizeof(struct budb_volumeEntry)); + memset(aVolEntryPtr, 0, sizeof(struct budb_volumeEntry)); strcpy(aVolEntryPtr->name, volname); aVolEntryPtr->flags = flags; aVolEntryPtr->id = volid; @@ -417,7 +417,7 @@ dbWatcher() break; } - bcopy(volPtr, &volumes[c], sizeof(struct budb_volumeEntry)); + memcpy(&volumes[c], volPtr, sizeof(struct budb_volumeEntry)); free(volPtr); free(entryPtr); entryPtr = (dlqlinkP)0; diff --git a/src/butc/dump.c b/src/butc/dump.c index 498a8f1d3..ee163d52a 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/dump.c,v 1.1.1.5 2001/07/14 22:21:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/dump.c,v 1.1.1.6 2001/09/11 14:31:47 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -106,7 +106,7 @@ localtime_r(t, tm) time_t *t; struct tm *tm; { - bcopy(localtime(t), tm, sizeof(struct tm)); + memcpy(tm, localtime(t), sizeof(struct tm)); } #endif @@ -910,7 +910,7 @@ dumpPass(dparamsPtr, passNumber) } /* Remember the server and partition the volume exists on */ - bzero (&server, sizeof(server)); + memset(&server, 0, sizeof(server)); server.sin_addr.s_addr = vldbEntry.serverNumber[e]; server.sin_port = 0; server.sin_family = AF_INET; @@ -1124,7 +1124,7 @@ Dumper(nodePtr) TapeLog(2, taskId, 0, 0, "Dump %s\n", nodePtr->dumpSetName); /* setup the dump parameters */ - bzero(&dparams, sizeof(dparams)); + memset(&dparams, 0, sizeof(dparams)); dparams.node = nodePtr; dparams.tapeInfoPtr = &tapeInfo; dlqInit(&savedEntries); @@ -1180,7 +1180,7 @@ Dumper(nodePtr) ErrorLog(0, taskId, code, 0, "Can't read backup database\n"); ERROR_EXIT(code); } - bzero(&dparams.lastDump, sizeof(dparams.lastDump)); + memset(&dparams.lastDump, 0, sizeof(dparams.lastDump)); } code = createDump(&dparams); /* enter dump into database */ @@ -1535,7 +1535,7 @@ getDumpTape(dparamsPtr, interactiveFlag, append) ErrorLog(0, taskId, code, tapeInfoPtr->error, "Warning: Tape error while reading label (will proceed with dump)\n"); } - bzero(&oldTapeLabel, sizeof(oldTapeLabel)); + memset(&oldTapeLabel, 0, sizeof(oldTapeLabel)); } /* Check if null tape. Prior 3.3, backup tapes have no dump id */ @@ -1689,8 +1689,8 @@ getDumpTape(dparamsPtr, interactiveFlag, append) */ for (dmp=oldTapeLabel.dumpid; dmp; dmp=de.appendedDumpID) { if (dmp == dparamsPtr->lastDump.id) { - bcopy(&dparamsPtr->lastDump, &de, sizeof(de)); - bcopy(&dparamsPtr->lastDump, &de2, sizeof(de2)); + memcpy(&de, &dparamsPtr->lastDump, sizeof(de)); + memcpy(&de2, &dparamsPtr->lastDump, sizeof(de2)); } else { code = bcdb_FindDumpByID(dmp, &de); @@ -1831,7 +1831,7 @@ makeVolumeHeader(vhptr, dparamsPtr, fragmentNumber) curDump = &nodePtr->dumps[dparamsPtr->curVolume]; - bzero(vhptr, sizeof(*vhptr)); + memset(vhptr, 0, sizeof(*vhptr)); strcpy(vhptr->volumeName, curDump->name); vhptr->volumeID = curDump->vid; vhptr->cloneDate = curDump->cloneDate; @@ -1876,7 +1876,7 @@ volumeHeader_hton(hostPtr, netPtr) volHdr.versionflags = htonl(hostPtr->versionflags); volHdr.cloneDate = htonl(hostPtr->cloneDate); - bcopy(&volHdr, netPtr, sizeof(struct volumeHeader)); + memcpy(netPtr, &volHdr, sizeof(struct volumeHeader)); } /* database related routines */ @@ -1890,7 +1890,7 @@ createDump(dparamsPtr) afs_int32 code = 0; dumpPtr = &dparamsPtr->dump; - bzero(dumpPtr, sizeof(*dumpPtr)); + memset(dumpPtr, 0, sizeof(*dumpPtr)); /* id filled in by database */ dumpPtr->parent = nodePtr->parent; diff --git a/src/butc/list.c b/src/butc/list.c index 3c8672254..1106f65de 100644 --- a/src/butc/list.c +++ b/src/butc/list.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/list.c,v 1.1.1.4 2001/07/14 22:21:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/list.c,v 1.1.1.5 2001/09/11 14:31:48 hartmans Exp $"); #ifndef AFS_NT40_ENV #include @@ -74,7 +74,7 @@ struct dumpNode **newNode; /* get space */ *newNode = (struct dumpNode *) (malloc (sizeof (struct dumpNode))); - bzero(*newNode, sizeof(struct dumpNode)); + memset(*newNode, 0, sizeof(struct dumpNode)); (*newNode)->next = dumpQHeader->next; dumpQHeader->next = *newNode; diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 0f3a9297a..d20a11780 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/lwps.c,v 1.1.1.4 2001/07/14 22:21:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/lwps.c,v 1.1.1.5 2001/09/11 14:31:48 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -102,7 +102,7 @@ struct restoreParams magic == TC_VOLENDMAGIC || \ magic == TC_VOLCONTD ) { \ \ - bcopy (&vhptr, header, sizeof(struct volumeHeader)); \ + memcpy(header, &vhptr, sizeof(struct volumeHeader)); \ return (0); \ } /* magic */ \ } /* versionflags */ \ @@ -838,7 +838,7 @@ VolHeaderToHost(hostVolHeader, tapeVolHeader) { case TAPE_VERSION_0: /* sizes in bytes and fields in host order */ - bcopy(hostVolHeader, tapeVolHeader, sizeof(struct volumeHeader)); + memcpy(tapeVolHeader, hostVolHeader, sizeof(struct volumeHeader)); break; case TAPE_VERSION_1: @@ -1110,7 +1110,7 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) } /* fill tbuffer with end of buffer */ bytesRead -= sizeof(tbuffer); - bcopy(buffer+bytesRead, tbuffer, sizeof(tbuffer)); + memcpy(tbuffer, buffer+bytesRead, sizeof(tbuffer)); tbuffersize = sizeof(tbuffer); /* Write out whatever is left over in buffer */ if (bytesRead) { @@ -1125,7 +1125,7 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) } else if ((tbuffersize + bytesRead) <= sizeof(tbuffer)) { /* Copy all of buffer into tbuffer (it will fit) */ - bcopy(buffer, tbuffer+tbuffersize, bytesRead); + memcpy(tbuffer+tbuffersize, buffer, bytesRead); tbuffersize += bytesRead; bytesRead = 0; } @@ -1141,10 +1141,10 @@ afs_int32 xbsaRestoreVolumeData(call, rparamsPtr) tbuffersize -= w; /* Move the data in tbuffer up */ - bcopy(tbuffer+towrite, tbuffer, tbuffersize); + memcpy(tbuffer, tbuffer+towrite, tbuffersize); /* Now copy buffer in */ - bcopy(buffer, tbuffer+tbuffersize, bytesRead); + memcpy(tbuffer+tbuffersize, buffer, bytesRead); tbuffersize += bytesRead; bytesRead = 0; } @@ -1681,7 +1681,7 @@ Restorer (newNode) printf("\n\n"); TLog (taskId, "Restore\n"); - bzero(&tapeInfo, sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); if (!CONF_XBSA) { tapeInfo.structVersion = BUTM_MAJORVERSION; tcode = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); @@ -1694,7 +1694,7 @@ Restorer (newNode) if ( checkAbortByTaskId(taskId) ) ERROR_EXIT(TC_ABORTEDBYREQUEST); - bzero(&rparams, sizeof(rparams)); + memset(&rparams, 0, sizeof(rparams)); rparams.nodePtr = newNode; rparams.tapeInfoPtr = &tapeInfo; Restore = newNode->restores; /* Array of vol fragments to restore */ @@ -1711,7 +1711,7 @@ Restorer (newNode) bufferBlock = (struct TapeBlock *)0; bufferBlock = (struct TapeBlock *) malloc(allocbufferSize); if (!bufferBlock) ERROR_EXIT(TC_NOMEMORY); - bzero(bufferBlock, allocbufferSize); + memset(bufferBlock, 0, allocbufferSize); startTime = time(0); for (rparams.frag=0; (rparams.frag < newNode->arraySize); rparams.frag++) { @@ -1846,7 +1846,7 @@ GetNewLabel(tapeInfoPtr, pName, AFSName, tapeLabel) struct timezone tzp; afs_uint32 size; - bzero(tapeLabel,sizeof(struct butm_tapeLabel)); + memset(tapeLabel, 0, sizeof(struct butm_tapeLabel)); if (!CONF_XBSA) { butm_GetSize(tapeInfoPtr, &size); @@ -1955,9 +1955,9 @@ FindVolTrailer2(buffera, sizea, dataSizea, bufferb, sizeb, dataSizeb, volTrailer if (!s) return 0; } - bzero(tapeVolumeHT, sizeof(tapeVolumeHT)); - if (headB) bcopy (buffera + sizea - headB, tapeVolumeHT , headB); - if (tailB) bcopy (bufferb , tapeVolumeHT + headB, tailB); + memset(tapeVolumeHT, 0, sizeof(tapeVolumeHT)); + if (headB) memcpy(tapeVolumeHT , buffera + sizea - headB, headB); + if (tailB) memcpy(tapeVolumeHT + headB, bufferb , tailB); if (ExtractTrailer (tapeVolumeHT, s, &offset, volTrailerPtr)) { found = 1; if (offset > headB) { @@ -2152,7 +2152,7 @@ Labeller (labelIfPtr) printf("\n\n"); TLog (taskId, "Labeltape\n"); - bzero(&tapeInfo, sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); tapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); if (code) @@ -2245,7 +2245,7 @@ struct tc_tapeLabel *label; printf("\n\n"); TLog (taskId, "Readlabel\n"); - bzero(&tapeInfo,sizeof(tapeInfo)); + memset(&tapeInfo, 0, sizeof(tapeInfo)); tapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&tapeInfo, &globalTapeConfig); if (code) @@ -2253,7 +2253,7 @@ struct tc_tapeLabel *label; ErrorLog(0, taskId, code, tapeInfo.error, "Can't initialize the tape module\n"); ERROR_EXIT(code); } - bzero(&newTapeLabel,sizeof(newTapeLabel)); + memset(&newTapeLabel, 0, sizeof(newTapeLabel)); interactiveFlag = autoQuery; @@ -2354,20 +2354,20 @@ readVolumeHeader (buffer, bufloc, header) (strncmp(tempvhptr->postamble, "T--NAME#",8) == 0) ) { /* Handle Cases 2 & 3 */ - bcopy (buffer+bufloc, &vhptr, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, sizeof(struct volumeHeader)); HEADER_CHECKS(vhptr, header); /* Handle Case 4 */ - bzero (&vhptr, sizeof(struct volumeHeader)); - bcopy (buffer+bufloc, &vhptr, firstSplice); - bzero (&vhptr.pad, padLen); - bcopy (buffer+bufloc+firstSplice, &vhptr.volumeID, nextSplice); + memset(&vhptr, 0, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, firstSplice); + memset(&vhptr.pad, 0, padLen); + memcpy(&vhptr.volumeID, buffer+bufloc+firstSplice, nextSplice); HEADER_CHECKS(vhptr, header); /* Handle Case 1 */ - bzero (&vhptr, sizeof(struct volumeHeader)); - bcopy (buffer+bufloc, &vhptr, firstSplice); - bcopy (buffer+bufloc+firstSplice+padLen, &vhptr+firstSplice, nextSplice); + memset(&vhptr, 0, sizeof(struct volumeHeader)); + memcpy(&vhptr, buffer+bufloc, firstSplice); + memcpy(&vhptr+firstSplice, buffer+bufloc+firstSplice+padLen, nextSplice); HEADER_CHECKS(vhptr, header); } diff --git a/src/butc/recoverDb.c b/src/butc/recoverDb.c index 62bea3da7..5cb247fde 100644 --- a/src/butc/recoverDb.c +++ b/src/butc/recoverDb.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/recoverDb.c,v 1.1.1.4 2001/07/14 22:21:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/recoverDb.c,v 1.1.1.5 2001/09/11 14:31:51 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -139,7 +139,7 @@ readDumps(taskId, tapeInfoPtr, scanInfoPtr) { afs_int32 code, c; - bcopy(&scanInfoPtr->tapeLabel, &scanInfoPtr->dumpLabel, sizeof(struct butm_tapeLabel)); + memcpy(&scanInfoPtr->dumpLabel, &scanInfoPtr->tapeLabel, sizeof(struct butm_tapeLabel)); while(1) { @@ -280,10 +280,10 @@ ScanDumps(ptr) if (ptr->addDbFlag) TLog(taskId, "ScanTape and add to the database\n"); else TLog(taskId, "Scantape\n"); - bzero(&tapeScanInfo, sizeof(tapeScanInfo)); + memset(&tapeScanInfo, 0, sizeof(tapeScanInfo)); tapeScanInfo.addDbFlag = ptr->addDbFlag; - bzero(&curTapeInfo, sizeof(curTapeInfo)); + memset(&curTapeInfo, 0, sizeof(curTapeInfo)); curTapeInfo.structVersion = BUTM_MAJORVERSION; code = butm_file_Instantiate (&curTapeInfo, &globalTapeConfig); if (code) @@ -359,7 +359,7 @@ scanVolData(taskId, curTapePtr, tapeVersion, volumeHeader, volumeTrailer, bytesR afs_int32 code = 0; afs_int32 rcode, tcode; - bzero(volumeHeader, sizeof(struct volumeHeader)); + memset(volumeHeader, 0, sizeof(struct volumeHeader)); block = (char *) malloc(2*BUTM_BLOCKSIZE); if (!block) return(TC_NOMEMORY); @@ -488,7 +488,7 @@ nextTapeLabel(prevTapeName) /* extract information from previous tape label */ strcpy(buffer, prevTapeName); - prevdot = rindex(buffer, '.'); + prevdot = strrchr(buffer, '.'); if (!prevdot) return(retval); prevdot++; @@ -800,11 +800,11 @@ validatePath(labelptr, pathptr) strcpy(tapeName, labelptr->AFSName); - tp = rindex(tapeName, '.'); + tp = strrchr(tapeName, '.'); if ( !tp ) return(1); tp++; - up = rindex(pathptr, '/'); + up = strrchr(pathptr, '/'); if ( !up ) { fprintf(stderr, "Invalid path name, missing /\n"); @@ -839,7 +839,7 @@ volumesetNamePtr(ptr) char *dotPtr; int dotIndex; - dotPtr = index(ptr, '.'); + dotPtr = strchr(ptr, '.'); if ( !dotPtr ) return(0); dotIndex = dotPtr - ptr; @@ -859,7 +859,7 @@ extractDumpName(ptr) char *dotPtr; int dotIndex; - dotPtr = rindex(ptr, '.'); + dotPtr = strrchr(ptr, '.'); if (!dotPtr) return(0); dotIndex = dotPtr - ptr; @@ -887,7 +887,7 @@ extractTapeSeq(tapename) { char *sptr; - sptr = rindex(tapename, '.'); + sptr = strrchr(tapename, '.'); if ( !sptr ) return(-1); sptr++; return(atol(sptr)); @@ -903,7 +903,7 @@ int databaseTape(tapeName) char *sptr; int c; - sptr = rindex(tapeName, '.'); + sptr = strrchr(tapeName, '.'); if ( !sptr ) return(0); c = (int)( (afs_int32)sptr - (afs_int32)tapeName ); @@ -922,7 +922,7 @@ afs_int32 RcreateDump(tapeScanInfoPtr, volHeaderPtr) struct budb_dumpEntry *dumpEntryPtr = &tapeScanInfoPtr->dumpEntry; /* construct dump entry */ - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); dumpEntryPtr->id = volHeaderPtr->dumpID; dumpEntryPtr->initialDumpID = tapeScanInfoPtr->initialDumpId; dumpEntryPtr->parent = volHeaderPtr->parentID; diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c index 023c46e09..99bc27211 100644 --- a/src/butc/tcmain.c +++ b/src/butc/tcmain.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcmain.c,v 1.1.1.4 2001/07/14 22:21:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcmain.c,v 1.1.1.5 2001/09/11 14:31:51 hartmans Exp $"); #include #include @@ -1165,7 +1165,7 @@ char **argv; */ if (argc == 1) { ts = (struct cmd_syndesc *) malloc(sizeof(struct cmd_syndesc)); - bzero(ts, sizeof(*ts)); + memset(ts, 0, sizeof(*ts)); ti = (struct cmd_item *) malloc(sizeof(struct cmd_item)); ti->next = 0; diff --git a/src/butc/tcprocs.c b/src/butc/tcprocs.c index 436db614c..ad1b83f7b 100644 --- a/src/butc/tcprocs.c +++ b/src/butc/tcprocs.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcprocs.c,v 1.1.1.4 2001/07/14 22:21:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcprocs.c,v 1.1.1.5 2001/09/11 14:31:52 hartmans Exp $"); #include #include @@ -99,7 +99,7 @@ STC_LabelTape(acid, label, taskId) ptr = (struct labelTapeIf *) malloc(sizeof(*ptr)); if (!ptr) ERROR_EXIT(TC_NOMEMORY); - bcopy(label, &ptr->label, sizeof(ptr->label)); + memcpy(&ptr->label, label, sizeof(ptr->label)); /* set up the status node */ *taskId = allocTaskId(); /* for bucoord */ diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index c91f230d6..68897d30c 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcudbprocs.c,v 1.1.1.5 2001/07/14 22:21:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butc/tcudbprocs.c,v 1.1.1.6 2001/09/11 14:31:53 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -58,7 +58,7 @@ afs_int32 CreateDBDump(dumpEntryPtr) { afs_int32 code = 0; - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); strcpy(dumpEntryPtr->name, DUMP_TAPE_NAME); strcpy(dumpEntryPtr->tapes.format, DUMP_TAPE_NAME); @@ -140,7 +140,7 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w goto getNewTape; } - bzero(&oldTapeLabel, sizeof(oldTapeLabel)); + memset(&oldTapeLabel, 0, sizeof(oldTapeLabel)); code = butm_ReadLabel(tapeInfoPtr, &oldTapeLabel, 1); /* rewind tape */ if (code) { @@ -192,8 +192,8 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w */ for (dmp=oldTapeLabel.dumpid; dmp; dmp=de.appendedDumpID) { if (dmp == lastDump.id) { - bcopy(&lastDump, &de, sizeof(de)); - bcopy(&lastDump, &de2, sizeof(de2)); + memcpy(&de, &lastDump, sizeof(de)); + memcpy(&de2, &lastDump, sizeof(de2)); } else { code = bcdb_FindDumpByID(dmp, &de); @@ -259,7 +259,7 @@ afs_int32 GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, w /* Initialize a tapeEntry for later inclusion into the database*/ listEntryPtr = (struct tapeEntryList *)malloc(sizeof(struct tapeEntryList)); if (!listEntryPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(listEntryPtr, sizeof(struct tapeEntryList)); + memset(listEntryPtr, 0, sizeof(struct tapeEntryList)); /* Remember dumpid so we can delete it later */ if ( (oldTapeLabel.structVersion >= TAPE_VERSION_3) && oldTapeLabel.dumpid ) @@ -404,14 +404,14 @@ saveDbToTape(saveDbIfPtr) } /* Determine what the last database dump was */ - bzero(&lastDump, sizeof(lastDump)); + memset(&lastDump, 0, sizeof(lastDump)); code = bcdb_FindLatestDump("", "", &lastDump); if (code) { if (code != BUDB_NODUMPNAME) { ErrorLog(0, taskId, code, 0, "Can't read backup database\n"); ERROR_EXIT(code); } - bzero(&lastDump, sizeof(lastDump)); + memset(&lastDump, 0, sizeof(lastDump)); } code = CreateDBDump(&dumpEntry); /* Create a dump for this tape */ @@ -513,7 +513,7 @@ afs_int32 makeDbDumpEntry(tapeEntPtr, dumpEntryPtr) { afs_int32 code; - bzero(dumpEntryPtr, sizeof(struct budb_dumpEntry)); + memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); dumpEntryPtr->id = tapeEntPtr->dump; dumpEntryPtr->initialDumpID = 0; @@ -627,7 +627,7 @@ afs_int32 readDbTape(tapeInfoPtr, rstTapeInfoPtr, query) /* Initialize a tapeEntry for later inclusion into the database*/ listEntryPtr = (struct tapeEntryList *) malloc(sizeof(struct tapeEntryList)); if (!listEntryPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(listEntryPtr, sizeof(struct tapeEntryList)); + memset(listEntryPtr, 0, sizeof(struct tapeEntryList)); /* Fill in tape entry so we can save it later */ strcpy(tapeEntryPtr->name, TNAME(&oldTapeLabel)); @@ -840,7 +840,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) if (!writeBlock) ERROR_EXIT(TC_NOMEMORY); writeBuffer = writeBlock + sizeof(struct blockMark); - bzero(writeBuffer, BUTM_BLKSIZE); + memset(writeBuffer, 0, BUTM_BLKSIZE); maxReadSize = 1024; /* @@ -927,7 +927,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) transferSize = (charList.charListT_len < (blockSize - writeBufNbytes)) ? charList.charListT_len : (blockSize - writeBufNbytes); - bcopy(readBufPtr, writeBufPtr, transferSize); + memcpy(writeBufPtr, readBufPtr, transferSize); charList.charListT_len -= transferSize; writeBufPtr += transferSize; readBufPtr += transferSize; @@ -943,7 +943,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) ERROR_EXIT(code); } - bzero(writeBuffer, blockSize); + memset(writeBuffer, 0, blockSize); writeBufPtr = &writeBuffer[0]; writeBufNbytes = 0; @@ -1061,7 +1061,7 @@ restoreDbEntries(tapeInfoPtr, rstTapeInfoPtr) } /* get the first item-header */ - bzero(&netItemHeader, sizeof(netItemHeader)); + memset(&netItemHeader, 0, sizeof(netItemHeader)); code = getTapeData(tapeInfoPtr, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, &hostItemHeader); @@ -1138,7 +1138,7 @@ restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader) extern struct udbHandleS udbHandle; /* Read the database header */ - bzero(&netDbHeader, sizeof(netDbHeader)); + memset(&netDbHeader, 0, sizeof(netDbHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netDbHeader, sizeof(netDbHeader)); if (code) ERROR_EXIT(code); DbHeader_ntoh(&netDbHeader, &hostDbHeader); @@ -1152,7 +1152,7 @@ restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1192,7 +1192,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) taskId = rstTapeInfoPtr->taskId; /* read dump entry */ - bzero(&netDumpEntry, sizeof(netDumpEntry)); + memset(&netDumpEntry, 0, sizeof(netDumpEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netDumpEntry, sizeof(netDumpEntry)); if (code) ERROR_EXIT(code); @@ -1216,7 +1216,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1226,7 +1226,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) { /*t*/ /* read the tape entry */ - bzero(&netTapeEntry, sizeof(netTapeEntry)); + memset(&netTapeEntry, 0, sizeof(netTapeEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netTapeEntry, sizeof(netTapeEntry)); if (code) ERROR_EXIT(code); tapeEntry_ntoh(&netTapeEntry, &hostTapeEntry); @@ -1238,7 +1238,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1248,7 +1248,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) { /*v*/ /* read the volume entry */ - bzero(&netVolumeEntry, sizeof(netVolumeEntry)); + memset(&netVolumeEntry, 0, sizeof(netVolumeEntry)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netVolumeEntry, sizeof(netVolumeEntry)); if (code) ERROR_EXIT(code); volumeEntry_ntoh(&netVolumeEntry, &hostVolumeEntry); @@ -1259,7 +1259,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) } /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1301,7 +1301,7 @@ saveTextFile(taskId, textType, fileName) ctPtr = (udbClientTextP) malloc(sizeof(*ctPtr)); if (!ctPtr) ERROR_EXIT(TC_NOMEMORY); - bzero(ctPtr, sizeof(*ctPtr)); + memset(ctPtr, 0, sizeof(*ctPtr)); ctPtr->textType = textType; /* lock the text in the database */ @@ -1435,7 +1435,7 @@ restoreText(tapeInfo, rstTapeInfoPtr, nextHeader) unlink(filename); /* get the next item-header */ - bzero(nextHeader, sizeof(*nextHeader)); + memset(nextHeader, 0, sizeof(*nextHeader)); code = getTapeData(tapeInfo, rstTapeInfoPtr, &netItemHeader, sizeof(netItemHeader)); if (code) ERROR_EXIT(code); structDumpHeader_ntoh(&netItemHeader, nextHeader); @@ -1541,7 +1541,7 @@ getTapeData(tapeInfoPtr, rstTapeInfoPtr, buffer, requestedBytes) /* copy out data */ transferBytes = (nbytes < requestedBytes ) ? nbytes : requestedBytes; - bcopy(tapeReadBufferPtr, buffer, transferBytes); + memcpy(buffer, tapeReadBufferPtr, transferBytes); tapeReadBufferPtr += transferBytes; buffer += transferBytes; nbytes -= transferBytes; diff --git a/src/butc/tdump.c b/src/butc/tdump.c index b7d90a1ae..d68146eb9 100644 --- a/src/butc/tdump.c +++ b/src/butc/tdump.c @@ -19,7 +19,7 @@ afs_int32 glong(cp, index) int index; char *cp; { afs_int32 temp; - bcopy(cp+index*4, &temp, sizeof(afs_int32)); + memcpy(&temp, cp+index*4, sizeof(afs_int32)); return temp; } diff --git a/src/butc/test.c b/src/butc/test.c index 35253ae81..49c8a9c00 100644 --- a/src/butc/test.c +++ b/src/butc/test.c @@ -73,7 +73,7 @@ char *aname; { } th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } diff --git a/src/butm/butm_test.c b/src/butm/butm_test.c index a67e48e5e..ee0377d72 100644 --- a/src/butm/butm_test.c +++ b/src/butm/butm_test.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butm/butm_test.c,v 1.1.1.4 2001/07/14 22:21:09 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butm/butm_test.c,v 1.1.1.5 2001/09/11 14:31:56 hartmans Exp $"); #include #include @@ -182,7 +182,7 @@ goto start; code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME"); PASSq ("Mount tape", 0); - bzero(tapeLabelWrite, sizeof(tapeLabelWrite)); + memset(tapeLabelWrite, 0, sizeof(tapeLabelWrite)); tapeLabelWrite.structVersion = CUR_TAPE_VERSION; tapeLabelWrite.creationTime = time(0); tapeLabelWrite.expirationDate = time(0); @@ -201,7 +201,7 @@ goto start; code = tapeInfo.ops.readLabel(&tapeInfo, &tapeLabelRead, REWIND); PASS ("Read a label", 0); - if ( bcmp(&tapeLabelWrite, &tapeLabelRead, sizeof(tapeLabelWrite)) ) + if ( memcmp(&tapeLabelWrite, &tapeLabelRead, sizeof(tapeLabelWrite)) ) printf("FAILURE: Label Read is not same as label Written\n"); else printf("PASSED: Label Read is same as label Written\n"); diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index 54901a754..f163f6710 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butm/file_tm.c,v 1.1.1.4 2001/07/14 22:21:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butm/file_tm.c,v 1.1.1.5 2001/09/11 14:31:57 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -808,7 +808,7 @@ WriteTapeBlock(info, buffer, length, blockType) { if (length == 0) ERROR_EXIT(0); bmark = (struct blockMark *)buffer; - bzero(bmark, sizeof(struct blockMark)); + memset(bmark, 0, sizeof(struct blockMark)); bmark->magic = htonl(BLOCK_MAGIC); bmark->count = htonl(length); } @@ -899,7 +899,7 @@ ReadTapeBlock(info, buffer, blockType) p = (struct progress *)info->tmRock; - bzero(buffer, BUTM_BLOCKSIZE); + memset(buffer, 0, BUTM_BLOCKSIZE); label = (struct tapeLabel *)buffer; fmark = (struct fileMark *)buffer; bmark = (struct blockMark *)buffer; @@ -1209,12 +1209,12 @@ static afs_int32 file_WriteLabel (info, label, rewind) /* Copy the label into the tape block * ---------------------------------- */ - bzero(tapeBlock, BUTM_BLOCKSIZE); + memset(tapeBlock, 0, BUTM_BLOCKSIZE); if (!label->creationTime) label->creationTime = time(0); tlabel = (struct tapeLabel *)tapeBlock; - bcopy(label, &tlabel->label, sizeof(struct butm_tapeLabel)); + memcpy(&tlabel->label, label, sizeof(struct butm_tapeLabel)); tlabel->label.structVersion = htonl(CUR_TAPE_VERSION); tlabel->label.creationTime = htonl(tlabel->label.creationTime); tlabel->label.expirationDate = htonl(tlabel->label.expirationDate); @@ -1312,7 +1312,7 @@ file_ReadLabel (info, label, rewind) if (label) { tlabel = (struct tapeLabel *) tapeBlock; - bcopy(&tlabel->label, label, sizeof(struct butm_tapeLabel)); + memcpy(label, &tlabel->label, sizeof(struct butm_tapeLabel)); label->structVersion = ntohl(label->structVersion); label->creationTime = ntohl(label->creationTime); label->expirationDate = ntohl(label->expirationDate); @@ -1413,7 +1413,7 @@ file_WriteFileData (info, data, blocks, len) if (len < BUTM_BLKSIZE) { - bzero(&dstart[len], BUTM_BLKSIZE - len); + memset(&dstart[len], 0, BUTM_BLKSIZE - len); length = len; } else @@ -1430,7 +1430,7 @@ file_WriteFileData (info, data, blocks, len) if (b < (blocks-1)) b++; else if (len) - bcopy(&dstart[BUTM_BLKSIZE], &dstart[0], len); + memcpy(&dstart[0], &dstart[BUTM_BLKSIZE], len); } error_exit: @@ -1745,7 +1745,7 @@ afs_int32 butm_file_Instantiate (info, file) if (!info) ERROR_EXIT(BUTM_BADARGUMENT); if (info->structVersion != BUTM_MAJORVERSION) ERROR_EXIT(BUTM_OLDINTERFACE); - bzero (info, sizeof(struct butm_tapeInfo)); + memset(info, 0, sizeof(struct butm_tapeInfo)); info->structVersion = BUTM_MAJORVERSION; info->ops.mount = file_Mount; info->ops.dismount = file_Dismount; diff --git a/src/butm/test_ftm.c b/src/butm/test_ftm.c index cd8e389b2..7ffdcf206 100644 --- a/src/butm/test_ftm.c +++ b/src/butm/test_ftm.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/butm/test_ftm.c,v 1.1.1.4 2001/07/14 22:21:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/butm/test_ftm.c,v 1.1.1.5 2001/09/11 14:31:57 hartmans Exp $"); #include #include @@ -220,7 +220,7 @@ int PerformDumpTest(TestInfo *tip) ERROR_EXIT (2); } - bzero(&label, sizeof(label)); + memset(&label, 0, sizeof(label)); gettimeofday(&tp, 0); label.structVersion = CUR_TAPE_VERSION; label.creationTime = tp.tv_sec; @@ -355,14 +355,14 @@ int PerformDumpTest(TestInfo *tip) tprogress = tlen = fprogress = flen = 0; while (1) { - bzero(tbuffer,BUTM_BLKSIZE); + memset(tbuffer, 0, BUTM_BLKSIZE); code = butm_ReadFileData (&info, tbuffer, BUTM_BLKSIZE, &tlen); if (code && code != BUTM_STATUS_EOF) { com_err (whoami, code, "Reading %dth tape data", i+1); ERROR_EXIT(6); } - bzero(fbuffer,BUTM_BLKSIZE); + memset(fbuffer, 0, BUTM_BLKSIZE); flen = read (fid, fbuffer, sizeof(fbuffer)); if (flen < 0) { com_err (whoami, errno, "Reading %dth file data", i+1); diff --git a/src/config/Makefile.alpha_dux40.in b/src/config/Makefile.alpha_dux40.in index ae78604e1..9884a72e7 100644 --- a/src/config/Makefile.alpha_dux40.in +++ b/src/config/Makefile.alpha_dux40.in @@ -21,9 +21,10 @@ OPTMZ=-O2 DBG=-g3 CSTATIC=-non_shared RANLIB=/bin/true -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall CP=cp #this is for the vol package -FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D +FS_CONV_OSF40D = fs_conv_dux40D +install_FS_CONV_OSF40D = $(DESTDIR)${afssrvsbindir}/fs_conv_dux40D +dest_FS_CONV_OSF40D = $(DEST)/root.server/usr/afs/bin/fs_conv_dux40D diff --git a/src/config/Makefile.alpha_dux50.in b/src/config/Makefile.alpha_dux50.in index 45cbccb9c..9c9546ec1 100644 --- a/src/config/Makefile.alpha_dux50.in +++ b/src/config/Makefile.alpha_dux50.in @@ -22,8 +22,9 @@ DBG=-g3 CP=cp CSTATIC=-non_shared RANLIB=/bin/true -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall #this is for the vol package -FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D +FS_CONV_OSF40D = fs_conv_dux40D +install_FS_CONV_OSF40D = $(DESTDIR)${afssrvsbindir}/fs_conv_dux40D +dest_FS_CONV_OSF40D = $(DEST)/root.server/usr/afs/bin/fs_conv_dux40D diff --git a/src/config/Makefile.alpha_linux_22.in b/src/config/Makefile.alpha_linux_22.in index f26b67d31..eb760eef3 100644 --- a/src/config/Makefile.alpha_linux_22.in +++ b/src/config/Makefile.alpha_linux_22.in @@ -32,17 +32,14 @@ XLIBS=@LIB_AFSDB@ AR=ar AS=as CP=cp -INSTALL=${SRCDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall LD=ld MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${SRCDIR}bin/washtool # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.djgpp.common b/src/config/Makefile.djgpp.common index a315d51e1..7fcaa6f85 100644 --- a/src/config/Makefile.djgpp.common +++ b/src/config/Makefile.djgpp.common @@ -117,7 +117,7 @@ depends : # Removes all built files # clean : - -rm -f $(TARGETS) *.o *.ss core + -$(RM) -f $(TARGETS) *.o *.ss core # # IMPLICIT RULES @@ -159,7 +159,7 @@ $(DESTBIN)/%.exe : %.exe # %.a : -$(RM) $@ - $(AR) rv $@ $^ + $(AR) crv $@ $^ $(RANLIB) $@ # new implicit rule to create executables diff --git a/src/config/Makefile.hp_ux102.in b/src/config/Makefile.hp_ux102.in index f23fc92d6..b0b318d55 100644 --- a/src/config/Makefile.hp_ux102.in +++ b/src/config/Makefile.hp_ux102.in @@ -21,8 +21,7 @@ LWP_OPTMZ=-O OPTMZ=-O DBG=-g RANLIB=ranlib -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall RM=/bin/rm CP=/bin/cp AR=/bin/ar diff --git a/src/config/Makefile.hp_ux110.in b/src/config/Makefile.hp_ux110.in index 058e1f18b..c07be9a67 100644 --- a/src/config/Makefile.hp_ux110.in +++ b/src/config/Makefile.hp_ux110.in @@ -20,9 +20,8 @@ SHLIB_SUFFIX=sl LWP_OPTMZ=-O OPTMZ=-O DBG=-g -RANLIB=ranlib -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +RANLIB=/usr/bin/ranlib +INSTALL=${TOP_SRCDIR}/pinstall/pinstall RM=/bin/rm CP=/bin/cp AR=/bin/ar diff --git a/src/config/Makefile.i386_djgpp b/src/config/Makefile.i386_djgpp index fc57153ec..7206ea95f 100644 --- a/src/config/Makefile.i386_djgpp +++ b/src/config/Makefile.i386_djgpp @@ -9,8 +9,6 @@ # # AFS_OSTYPE used to indicate suffixes and os specific subdirectories. AFS_OSTYPE = DJGPP -DESTDIR=DEST/ -SRCDIR=DEST/ # compilation and link editor flags #DBG=-g @@ -33,18 +31,15 @@ XLIBS= AR=dos-ar AS=dos-as CP=cp -INSTALL=${SRCDIR}bin/install +INSTALL=${SRCDIR}/bin/install LD=dos-ld CC=dos-gcc -bmmap RANLIB=dos-ranlib MT_CC=dos-gcc -bmmap MV=mv RM=rm -WASHTOOL=${SRCDIR}bin/washtool # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.i386_fbsd_42.in b/src/config/Makefile.i386_fbsd_42.in index a627efa32..a8a0001c0 100644 --- a/src/config/Makefile.i386_fbsd_42.in +++ b/src/config/Makefile.i386_fbsd_42.in @@ -4,9 +4,6 @@ # # AFS_OSTYPE used to indicate suffixes and os specific subdirectories. AFS_OSTYPE = FBSD -# Pointers to destination and source directories -DESTDIR=DEST/ -SRCDIR=DEST/ # Base directory for linux kernel source. Actually a prefix which is complete # when LINUX_VERS is appended to it. # LINUX_SRCDIR = /usr/src/linux- @@ -37,17 +34,14 @@ XLIBS=@LIB_AFSDB@ -lcompat AR=ar AS=as CP=cp -INSTALL=${SRCDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall LD=ld MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${SRCDIR}bin/washtool # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.i386_linux24.in b/src/config/Makefile.i386_linux24.in index 38c7dfba1..9635c318e 100644 --- a/src/config/Makefile.i386_linux24.in +++ b/src/config/Makefile.i386_linux24.in @@ -6,7 +6,7 @@ AFS_OSTYPE = LINUX LINUX_SRCDIR = /usr/src/linux- # Default list of Linux kernels to build. Build will run only if all # can be built. To build a different set, specify LINUX_VERS to make. -LINUX_VERS = 2.3.99-pre3 +LINUX_VERS = @LINUX_VERSION@ # # compilation and link editor flags @@ -35,12 +35,9 @@ MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.ppc_darwin_12.in b/src/config/Makefile.ppc_darwin_12.in index 6edb0b62e..be76178b7 100644 --- a/src/config/Makefile.ppc_darwin_12.in +++ b/src/config/Makefile.ppc_darwin_12.in @@ -3,9 +3,6 @@ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories. AFS_OSTYPE = DARWIN # -# Pointers to destination and source directories -DESTDIR=DEST/ -DESTDIR=DEST/ # # compilation and link editor flags XCFLAGS=-traditional-cpp @@ -36,7 +33,7 @@ AR=ar AS=as CC=cc CP=cp -INSTALL=${DESTDIR}bin/pinstall +INSTALL=${TOP_SRCDIR}/pinstall/pinstall LEX=lex -l LD= ld LORDER = lorder diff --git a/src/config/Makefile.ppc_darwin_13.in b/src/config/Makefile.ppc_darwin_13.in index 6edb0b62e..be76178b7 100644 --- a/src/config/Makefile.ppc_darwin_13.in +++ b/src/config/Makefile.ppc_darwin_13.in @@ -3,9 +3,6 @@ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories. AFS_OSTYPE = DARWIN # -# Pointers to destination and source directories -DESTDIR=DEST/ -DESTDIR=DEST/ # # compilation and link editor flags XCFLAGS=-traditional-cpp @@ -36,7 +33,7 @@ AR=ar AS=as CC=cc CP=cp -INSTALL=${DESTDIR}bin/pinstall +INSTALL=${TOP_SRCDIR}/pinstall/pinstall LEX=lex -l LD= ld LORDER = lorder diff --git a/src/config/Makefile.ppc_linux24.in b/src/config/Makefile.ppc_linux24.in index 72aeaef0d..00762dd0e 100644 --- a/src/config/Makefile.ppc_linux24.in +++ b/src/config/Makefile.ppc_linux24.in @@ -35,12 +35,10 @@ MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install + +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.rs_aix42.in b/src/config/Makefile.rs_aix42.in index 81c039b44..797477171 100644 --- a/src/config/Makefile.rs_aix42.in +++ b/src/config/Makefile.rs_aix42.in @@ -34,8 +34,7 @@ LEX=lex MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # This is the XBSA make flag and pathname to XBSA header files (xbsa.h) XBSA_FLAGS=-Dxbsa diff --git a/src/config/Makefile.s390_linux22.in b/src/config/Makefile.s390_linux22.in index 9de4d60c5..9f7232bff 100644 --- a/src/config/Makefile.s390_linux22.in +++ b/src/config/Makefile.s390_linux22.in @@ -40,12 +40,9 @@ MT_CC=gcc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.s390_linux24.in b/src/config/Makefile.s390_linux24.in index 74bffa280..421f6216a 100644 --- a/src/config/Makefile.s390_linux24.in +++ b/src/config/Makefile.s390_linux24.in @@ -40,12 +40,9 @@ MT_CC=gcc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.sgi_62.in b/src/config/Makefile.sgi_62.in index 587636880..8a7d9d6ca 100644 --- a/src/config/Makefile.sgi_62.in +++ b/src/config/Makefile.sgi_62.in @@ -38,8 +38,9 @@ LEX=lex MV=mv RANLIB=/bin/true RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # This is for the vol package -XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check +XFS_SIZE_CHECK = xfs_size_check +install_XFS_SIZE_CHECK = $(DESTDIR)${afssrvsbindir}/xfs_size_check +dest_XFS_SIZE_CHECK = $(DEST)/root.server/usr/afs/bin/xfs_size_check diff --git a/src/config/Makefile.sgi_63.in b/src/config/Makefile.sgi_63.in index 55aa0e339..fd33e43b0 100644 --- a/src/config/Makefile.sgi_63.in +++ b/src/config/Makefile.sgi_63.in @@ -38,5 +38,4 @@ LEX=lex MV=mv RANLIB=/bin/true RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall diff --git a/src/config/Makefile.sgi_64.in b/src/config/Makefile.sgi_64.in index 61b385dab..f8c75148e 100644 --- a/src/config/Makefile.sgi_64.in +++ b/src/config/Makefile.sgi_64.in @@ -39,8 +39,9 @@ LEX=lex MV=mv RANLIB=/bin/true RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # This is for the vol package -XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check +XFS_SIZE_CHECK = xfs_size_check +install_XFS_SIZE_CHECK = $(DESTDIR)${afssrvsbindir}/xfs_size_check +dest_XFS_SIZE_CHECK = $(DEST)/root.server/usr/afs/bin/xfs_size_check diff --git a/src/config/Makefile.sgi_65.in b/src/config/Makefile.sgi_65.in index 925e626af..a0a0c87ca 100644 --- a/src/config/Makefile.sgi_65.in +++ b/src/config/Makefile.sgi_65.in @@ -39,8 +39,9 @@ LEX=lex MV=mv RANLIB=/bin/true RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # This is for the vol package -XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check +XFS_SIZE_CHECK = xfs_size_check +install_XFS_SIZE_CHECK = $(DESTDIR)${afssrvsbindir}/xfs_size_check +dest_XFS_SIZE_CHECK = $(DEST)/root.server/usr/afs/bin/xfs_size_check diff --git a/src/config/Makefile.sparc64_linux22.in b/src/config/Makefile.sparc64_linux22.in index a8d184fd9..b550bd7d9 100644 --- a/src/config/Makefile.sparc64_linux22.in +++ b/src/config/Makefile.sparc64_linux22.in @@ -39,12 +39,9 @@ MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.sparc64_linux24.in b/src/config/Makefile.sparc64_linux24.in index a8d184fd9..b550bd7d9 100644 --- a/src/config/Makefile.sparc64_linux24.in +++ b/src/config/Makefile.sparc64_linux24.in @@ -39,12 +39,9 @@ MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.sparc_linux22.in b/src/config/Makefile.sparc_linux22.in index a8d184fd9..b550bd7d9 100644 --- a/src/config/Makefile.sparc_linux22.in +++ b/src/config/Makefile.sparc_linux22.in @@ -39,12 +39,9 @@ MT_CC=cc MV=mv RANLIB=ranlib RM=rm -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # Other OS specific requirements # YACC = bison -y LEX = flex -l -# Used in des library. -CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.sun4x_55.in b/src/config/Makefile.sun4x_55.in index 8d8d8d941..e7bc37788 100644 --- a/src/config/Makefile.sun4x_55.in +++ b/src/config/Makefile.sun4x_55.in @@ -39,8 +39,9 @@ MV=mv RANLIB=/bin/true RM=rm STRIP= /usr/ccs/bin/strip -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # this is for the vol package -FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26 +FS_CONV_SOL26 = fs_conv_sol26 +install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26 +dest_FS_CONV_SOL26 = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26 diff --git a/src/config/Makefile.sun4x_56.in b/src/config/Makefile.sun4x_56.in index e6a173bae..add178865 100644 --- a/src/config/Makefile.sun4x_56.in +++ b/src/config/Makefile.sun4x_56.in @@ -43,11 +43,12 @@ MV=mv RANLIB=/bin/true RM=rm STRIP= /usr/ccs/bin/strip -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # this is for the vol package -FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26 +FS_CONV_SOL26 = fs_conv_sol26 +install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26 +dest_FS_CONV_SOL26 = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26 # # This is the XBSA make flag and pathname to XBSA header files (xbsa.h) XBSA_FLAGS=-Dxbsa diff --git a/src/config/Makefile.sun4x_57.in b/src/config/Makefile.sun4x_57.in index 75614135c..3f5e0c07b 100644 --- a/src/config/Makefile.sun4x_57.in +++ b/src/config/Makefile.sun4x_57.in @@ -47,11 +47,12 @@ MV=mv RANLIB=/bin/true RM=rm STRIP= /usr/ccs/bin/strip -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # this is for the vol package -FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26 +FS_CONV_SOL26 = fs_conv_sol26 +install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26 +dest_FS_CONV_SOL26 = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26 # # This is the XBSA make flag and pathname to XBSA header files (xbsa.h) XBSA_FLAGS=-Dxbsa diff --git a/src/config/Makefile.sun4x_58.in b/src/config/Makefile.sun4x_58.in index 2b4bf1020..945a14282 100644 --- a/src/config/Makefile.sun4x_58.in +++ b/src/config/Makefile.sun4x_58.in @@ -40,11 +40,12 @@ MV=mv RANLIB=/bin/true RM=rm STRIP= /usr/ccs/bin/strip -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall # # this is for the vol package -FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26 +FS_CONV_SOL26 = fs_conv_sol26 +install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26 +dest_FS_CONV_SOL26 = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26 # # This is the XBSA make flag and pathname to XBSA header files (xbsa.h) XBSA_FLAGS=-Dxbsa diff --git a/src/config/Makefile.sunx86_54.in b/src/config/Makefile.sunx86_54.in index b874f4a6c..1c60eca7c 100644 --- a/src/config/Makefile.sunx86_54.in +++ b/src/config/Makefile.sunx86_54.in @@ -20,5 +20,4 @@ AR = /usr/ccs/bin/ar LD = /usr/ccs/bin/ld LORDER = /usr/ccs/bin/lorder STRIP= /usr/ccs/bin/strip -WASHTOOL=${DESTDIR}bin/washtool -INSTALL=${DESTDIR}bin/install +INSTALL=${TOP_SRCDIR}/pinstall/pinstall diff --git a/src/config/Makefile.version-CML b/src/config/Makefile.version-CML index 65b2ae1aa..0b6cef863 100644 --- a/src/config/Makefile.version-CML +++ b/src/config/Makefile.version-CML @@ -12,14 +12,14 @@ $(VERSFILE).o: $(VERSFILE).c # mkvers checks timestamps $(VERSFILE).c: - $(DESTDIR)bin/mkvers -o $(VERSFILE).c + $(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).c # only done for RX in NT # -c $(CML_PREFIX) $(VERSFILE).h: - $(DESTDIR)bin/mkvers -o $(VERSFILE).h -v + $(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).h -v $(VERSFILE).txt: - $(DESTDIR)bin/mkvers -o $(VERSFILE).txt -t + $(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).txt -t noversion: install diff --git a/src/config/Makefile.version-NOCML.in b/src/config/Makefile.version-NOCML.in index bc039f969..1e57db584 100644 --- a/src/config/Makefile.version-NOCML.in +++ b/src/config/Makefile.version-NOCML.in @@ -11,8 +11,5 @@ VERSION=@VERSION@ AFS_component_version_number.o: AFS_component_version_number.c AFS_component_version_number.c: - echo 'char cml_version_number[]="@(#) OpenAFS ${VERSION} built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c; - echo 'char* AFSVersion = "${PACKAGE} ${VERSION}"; ' >>AFS_component_version_number.c; - -noversion: install - + echo 'char cml_version_number[]="@(#) OpenAFS ${VERSION} built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c + echo 'char* AFSVersion = "${PACKAGE} ${VERSION}"; ' >>AFS_component_version_number.c diff --git a/src/config/NTMakefile b/src/config/NTMakefile index 9d27966e7..311f97aca 100644 --- a/src/config/NTMakefile +++ b/src/config/NTMakefile @@ -23,14 +23,18 @@ INCFILES =\ $(INCFILEDIR)\afs_args.h \ $(INCFILEDIR)\debug.h \ $(INCFILEDIR)\param.h \ + $(INCFILEDIR)\afsconfig.h \ $(INCFILEDIR)\afs_sysnames.h \ $(INCFILEDIR)\stds.h \ $(INCFILEDIR)\icl.h - + $(INCFILEDIR)\param.h: param.$(SYS_NAME).h $(COPY) $? $@ +$(INCFILEDIR)\afsconfig.h: afsconfig-windows.h + $(COPY) $? $@ + idirs: doclink ! IF (!EXIST($(DESTDIR))) $(MKDIR) $(DESTDIR) @@ -65,6 +69,9 @@ idirs: doclink ! IF (!EXIST($(DESTDIR)\WinInstall)) $(MKDIR) $(DESTDIR)\WinInstall ! ENDIF +! IF (!EXIST($(DESTDIR)\WinInstall\Config)) + $(MKDIR) $(DESTDIR)\WinInstall\Config +! ENDIF ! IF (!EXIST($(DESTDIR)\root.server)) $(MKDIR) $(DESTDIR)\root.server ! ENDIF @@ -89,30 +96,31 @@ idirs: doclink ! IF (!EXIST($(DESTDIR)\root.client\usr\vice\etc)) $(MKDIR) $(DESTDIR)\root.client\usr\vice\etc ! ENDIF + $(COPY) AFSCONFIG-WINDOWS.H $(DESTDIR)\include\afs\afsconfig.h -INCCOPY = \ - $(DESTDIR)\bin\rmbat.bat \ - $(DESTDIR)\bin\rmbat.rsp \ - $(DESTDIR)\bin\NTBUILD.bat - -$(DESTDIR)\bin\rmbat.bat:..\rmbat.bat +INCCOPY = \ + $(DESTDIR)\bin\rmbat.bat \ + $(DESTDIR)\bin\rmbat.rsp \ + $(DESTDIR)\bin\NTBUILD.bat + +$(DESTDIR)\bin\rmbat.bat:..\rmbat.bat $(COPY) $? $@ util_cr + $@ - -$(DESTDIR)\bin\rmbat.rsp:..\rmbat.rsp + +$(DESTDIR)\bin\rmbat.rsp:..\rmbat.rsp $(COPY) $? $@ - -$(DESTDIR)\bin\NTBUILD.bat:..\NTBUILD.bat + +$(DESTDIR)\bin\NTBUILD.bat:..\NTBUILD.bat $(COPY) $? $@ util_cr + $@ - + $(DESTDIR)\bin\NTLang.bat: NTLang.bat util_cr.exe $(COPY) NTLang.bat $(DESTDIR)\bin util_cr + $(DESTDIR)\bin\NTLang.bat - -$(DESTDIR)\NTDllmap.txt:NTDllmap.txt + +$(DESTDIR)\NTDllmap.txt:NTDllmap.txt $(COPY) $? $@ - + # Create link to docs needed for media build; allow to fail in case # symlink not available, e.g. if using a 3.4a client, since most builds # aren't media builds. @@ -133,24 +141,24 @@ NTMakefile.version: NTMakefile.version-CML NTMakefile.version-NOCML $(COPY) NTMakefile.version-NOCML NTMakefile.version ! ENDIF -INCTOOLS = \ - $(DESTDIR)\bin\mkvers.exe \ - $(DESTDIR)\bin\util_cr.exe \ - $(DESTDIR)\bin\touch.exe - +INCTOOLS = \ + $(DESTDIR)\bin\mkvers.exe \ + $(DESTDIR)\bin\util_cr.exe \ + $(DESTDIR)\bin\touch.exe + #mkvers.exe : mkvers.obj # $(EXECONLINK) - -$(DESTDIR)\bin\mkvers.exe:mkvers.exe + +$(DESTDIR)\bin\mkvers.exe:mkvers.exe $(COPY) mkvers.exe $(DESTDIR)\bin\. -$(DESTDIR)\bin\util_cr.exe:util_cr.exe +$(DESTDIR)\bin\util_cr.exe:util_cr.exe $(COPY) util_cr.exe $(DESTDIR)\bin\. - + util_cr.exe : util_cr.obj $(EXECONLINK) - -$(DESTDIR)\bin\touch.exe:touch.exe + +$(DESTDIR)\bin\touch.exe:touch.exe $(COPY) touch.exe $(DESTDIR)\bin\. langsetup: $(DESTDIR)\bin\NTLang.bat @@ -166,9 +174,9 @@ clean_version: clean:: $(DEL) $(DESTDIR)\LIB\*.DLL - $(DEL) $(DESTDIR)\bin\mkver.exe - $(DEL) $(DESTDIR)\bin\touch.exe - $(DEL) $(DESTDIR)\bin\util_cr.exe - $(DEL) mkver.exe - $(DEL) touch.exe + $(DEL) $(DESTDIR)\bin\mkver.exe + $(DEL) $(DESTDIR)\bin\touch.exe + $(DEL) $(DESTDIR)\bin\util_cr.exe + $(DEL) mkver.exe + $(DEL) touch.exe $(DEL) util_cr.exe \ No newline at end of file diff --git a/src/config/NTMakefile.i386_nt40 b/src/config/NTMakefile.i386_nt40 index 54b095fe7..83cce8977 100644 --- a/src/config/NTMakefile.i386_nt40 +++ b/src/config/NTMakefile.i386_nt40 @@ -36,6 +36,12 @@ APPVER = 4.0 !ENDIF +#define used in WinNT/2000 installation and program version display +AFSPRODUCT_VERSION=1.1.1 a +CELLNAME_DEFAULT=Your Cell Name +CELLSERVDB_INSTALL=CellServDB.GrandCentral +CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB + !IFNDEF TARGETOS TARGETOS = WINNT !ENDIF diff --git a/src/config/NTMakefile.i386_win95 b/src/config/NTMakefile.i386_win95 index 22e2feb95..2c314157a 100644 --- a/src/config/NTMakefile.i386_win95 +++ b/src/config/NTMakefile.i386_win95 @@ -36,6 +36,12 @@ APPVER = 4.0 !ENDIF +#define used in Win9x installation and program version display +AFSPRODUCT_VERSION=1.1.1 a +CELLNAME_DEFAULT=Your Cell Name +CELLSERVDB_INSTALL=CellServDB.GrandCentral +CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB + !IFNDEF TARGETOS TARGETOS = WIN95 #TARGETOS = WINNT diff --git a/src/config/NTVersioninfo.rc b/src/config/NTVersioninfo.rc index 5691c7890..ac9fae8e8 100644 --- a/src/config/NTVersioninfo.rc +++ b/src/config/NTVersioninfo.rc @@ -16,11 +16,11 @@ BEGIN BEGIN BLOCK "040904E4" BEGIN - VALUE "CompanyName", "IBM Corporation", "\0" - VALUE "LegalCopyright", "Copyright \251 IBM Corporation, 1998, 1999.", "\0" - VALUE "ProductName", "AFS for Windows", "\0" - VALUE "ProductVersion", "3.5", "\0" - VALUE "FileVersion", "3.5", "\0" + VALUE "CompanyName", "OpenAFS Project", "\0" + VALUE "LegalCopyright", "Copyright \251 IBM Corporation and others, 1998, 1999, 2000, 2001.", "\0" + VALUE "ProductName", "OpenAFS for Windows", "\0" + VALUE "ProductVersion", "1.1", "\0" + VALUE "FileVersion", "1.1", "\0" VALUE "FileDescription", AFS_VERINFO_FILE_DESCRIPTION, "\0" VALUE "Build", AFS_VERINFO_BUILD, "\0" END diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 84e3ef7fd..0323ea6ed 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -81,6 +81,10 @@ #define SYS_NAME_ID_sun4x_57 938 #define SYS_NAME_ID_sun4x_58 939 +/* Sigh. If I leave a gap here IBM will do this sequentially. If I don't + they won't allocate sunx86 IDs at all. So leave a gap and pray. */ +#define SYS_NAME_ID_sunx86_57 950 +#define SYS_NAME_ID_sunx86_58 951 #define SYS_NAME_ID_vax_ul4 1003 #define SYS_NAME_ID_vax_ul40 1004 @@ -135,6 +139,10 @@ #define SYS_NAME_ID_i386_fbsd_42 2100 +#define SYS_NAME_ID_ia64_linux2 2200 +#define SYS_NAME_ID_ia64_linux22 2201 +#define SYS_NAME_ID_ia64_linux24 2202 + /* * Placeholder to keep system-wide standard flags since this file is included by all * files (i.e in afs/param.h) diff --git a/src/config/param.i386_nt40.h b/src/config/param.i386_nt40.h index 387ef4e11..72a926f45 100644 --- a/src/config/param.i386_nt40.h +++ b/src/config/param.i386_nt40.h @@ -34,14 +34,16 @@ typedef int ssize_t; /* these macros define Unix-style functions missing in VC++5.0/NT4.0 */ #define MAXPATHLEN _MAX_PATH -#define bzero(A, S) memset((void*)(A), 0, (size_t)(S)) -#define bcopy(A, B, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) +#if 0 +#define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) +#define memcpy(B, A, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) /* There is a minor syntactic difference between memcmp and bcmp... */ -#define bcmp(A,B,S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define memcmp(A, B, S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define strchr(s, c) strchr(s, c) +#define strrchr(s, c) strrchr(s, c) +#endif #define strcasecmp(s1,s2) _stricmp(s1,s2) #define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n) -#define index(s, c) strchr(s, c) -#define rindex(s, c) strrchr(s, c) #define sleep(seconds) Sleep((seconds) * 1000) #define fsync(fileno) _commit(fileno) #define ftruncate(fd, size) _chsize((fd), (long)(size)) diff --git a/src/config/param.i386_win95.h b/src/config/param.i386_win95.h index 2e636912d..355714b5d 100644 --- a/src/config/param.i386_win95.h +++ b/src/config/param.i386_win95.h @@ -35,14 +35,16 @@ typedef int ssize_t; /* these macros define Unix-style functions missing in VC++5.0/NT4.0 */ #define MAXPATHLEN _MAX_PATH -#define bzero(A, S) memset((void*)(A), 0, (size_t)(S)) -#define bcopy(A, B, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) +#if 0 +#define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) +#define memcpy(B, A, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) /* There is a minor syntactic difference between memcmp and bcmp... */ -#define bcmp(A,B,S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define memcmp(A, B, S) (memcmp((void*)(A), (void*)(B), (size_t)(S)) ? 1 : 0) +#define strchr(s, c) strchr(s, c) +#define strrchr(s, c) strrchr(s, c) +#endif #define strcasecmp(s1,s2) _stricmp(s1,s2) #define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n) -#define index(s, c) strchr(s, c) -#define rindex(s, c) strrchr(s, c) #define sleep(seconds) Sleep((seconds) * 1000) #define fsync(fileno) _commit(fileno) #define ftruncate(fd, size) _chsize((fd), (long)(size)) diff --git a/src/config/param.sun4x_55.h b/src/config/param.sun4x_55.h index 77080d0d8..443957b91 100644 --- a/src/config/param.sun4x_55.h +++ b/src/config/param.sun4x_55.h @@ -11,7 +11,7 @@ #define AFS_PARAM_H #define AFS_VFS_ENV 1 -/* Used only in vfsck/* code; is it needed any more???? */ +/* Used only in vfsck code; is it needed any more???? */ #define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ #define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ @@ -77,6 +77,9 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF diff --git a/src/config/param.sun4x_56.h b/src/config/param.sun4x_56.h index 64abc206e..3492a22a8 100644 --- a/src/config/param.sun4x_56.h +++ b/src/config/param.sun4x_56.h @@ -13,7 +13,7 @@ #include #define AFS_VFS_ENV 1 -/* Used only in vfsck/* code; is it needed any more???? */ +/* Used only in vfsck code; is it needed any more???? */ #define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ #define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ @@ -76,6 +76,9 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF diff --git a/src/config/param.sun4x_57.h b/src/config/param.sun4x_57.h index 96456f028..4e56aaf99 100644 --- a/src/config/param.sun4x_57.h +++ b/src/config/param.sun4x_57.h @@ -11,7 +11,7 @@ #define AFS_PARAM_H #define AFS_VFS_ENV 1 -/* Used only in vfsck/* code; is it needed any more???? */ +/* Used only in vfsck code; is it needed any more???? */ #define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ #define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ @@ -102,6 +102,9 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF diff --git a/src/config/param.sun4x_58.h b/src/config/param.sun4x_58.h index a4405847e..e943d151d 100644 --- a/src/config/param.sun4x_58.h +++ b/src/config/param.sun4x_58.h @@ -2,7 +2,7 @@ #define AFS_PARAM_H #define AFS_VFS_ENV 1 -/* Used only in vfsck/* code; is it needed any more???? */ +/* Used only in vfsck code; is it needed any more???? */ #define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ #define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ @@ -99,6 +99,9 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF diff --git a/src/config/param.sun4x_58_usr.h b/src/config/param.sun4x_58_usr.h index 98d41088f..87fec13ec 100644 --- a/src/config/param.sun4x_58_usr.h +++ b/src/config/param.sun4x_58_usr.h @@ -15,6 +15,8 @@ #define AFS_USR_SUN7_ENV 1 #define AFS_USR_SUN8_ENV 1 +#define AFS_64BIT_ENV 1 + #include /*#define AFS_GLOBAL_SUNLOCK 1 /* For global locking */ diff --git a/src/config/param.sunx86_54.h b/src/config/param.sunx86_54.h index e62769c51..10c0d2839 100644 --- a/src/config/param.sunx86_54.h +++ b/src/config/param.sunx86_54.h @@ -13,7 +13,7 @@ #include #define AFS_VFS_ENV 1 -/* Used only in vfsck/* code; is it needed any more???? */ +/* Used only in vfsck code; is it needed any more???? */ #define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ #define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ diff --git a/src/config/stds.h b/src/config/stds.h index 10e184ad1..b55170eb7 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -189,7 +189,9 @@ typedef struct afs_hyper_t { /* unsigned 64 bit integers */ #if defined(AFS_LINUX20_ENV) && defined(KERNEL) /* This is here instead of osi_machdep.h so fcrypt.c can pick it up. */ #include "../h/string.h" -#define bcopy(F,T,C) memcpy((T), (F), (C)) +#if 0 +#define bcopy(F, T, C) memcpy((T), (F), (C)) +#endif #endif diff --git a/src/config/util_cr.c b/src/config/util_cr.c index eb17b8d58..15e54e0c8 100644 --- a/src/config/util_cr.c +++ b/src/config/util_cr.c @@ -15,14 +15,20 @@ #include "process.h" #include "windows.h" #include "malloc.h" +#include "time.h" void usuage() { printf("util_cr file ;remove cr (from crlf)\n\ + OR util_cr } ProductVersion in_filename out_filename ; substitute for %1-%5 in file\n\ + %1=Major version, %2=Minor version, %3=Patch(first digit) %4=(last two digits) %5=Version display string \n\ + ProductVersion=maj.min.pat.pat2 ;maj=numeric, min=numeric pat,pat2 are not more than 3 digits or 1-2 digits and one alpha \n\ + e.g 1.0.4.1, 1.0.4 a 1.0.401, 1.0.4a all represent the same version\n\ OR util_cr + file ;add cr\n \ OR util_cr * \"+[register key value] x=y\" ; add register key value\n\ OR util_cr * \"-[register key value]\" ; aremove register key value\n\ - OR util_cr & file.ini \"SectionKey=value\" ; update ini-ipr-pwf file\n\ + OR util_cr @ file.ini \"[SectionKey]variable=value\" ; update ini-ipr-pwf file\n\ + OR util_cr @ file.ini \"[SectionKey]variable=value*DatE*\" ; update ini-ipr-pwf file, insert date\n\ OR util_cr ~ ;force error\n"); exit(0xc000); } @@ -97,15 +103,151 @@ int main(int argc, char* argv[]) int l,i; char **pvar,*ch; long len; - typedef char * CHARP; + typedef char * CHARP; if (argc<3) usuage(); + if (strcmp(argv[1],"}")==0) + { + char v1[4],v2[4],v3[4],v4[4]; + char v5[132]; + char *ptr=NULL; + char *buf; + int maj; + int min; + int pat,pat2; + strcpy(v5,argv[2]); + if (argc<5) + usuage(); + if ((ptr=strtok(argv[2],". \n"))==NULL) + return 0; + maj=atoi(ptr); + if ((ptr=strtok(NULL,". \n"))==NULL) + return 0; + min=atoi(ptr); + if ((ptr=strtok(NULL,". \n"))==NULL) + return 0; + pat2=-1; + switch (strlen(ptr)) + { + case 0: + usuage(); + case 1: + pat=atoi(ptr); + if (isdigit(*ptr)!=0) + break; + usuage(); + case 2: //ONLY 1.0.44 is interpreted as 1.0.4.4 or 1.0.4a as 1.0.4.a + if (isdigit(*ptr)==0) + usuage(); + pat=*ptr-'0'; + ptr++; + if (isalpha(*ptr)==0) + { + pat2=atoi(ptr); + } else if (isalpha(*ptr)!=0) + { + pat2=tolower(*ptr)-'a'+1; + } else + usuage(); + break; + case 3://1.0.401 or 1.0.40a are the same; + if ((isdigit(*ptr)==0) // first 2 must be digit + || (isdigit(*(ptr+1)==0)) + || (*(ptr+1)!='0' && isdigit(*(ptr+2))==0) // disallow 1.0.4b0 or 1.0.41a + ) + usuage(); + pat=*ptr-'0'; + ptr++; + pat2=atoi(ptr); + ptr++; + if (isalpha(*ptr)) + pat2=tolower(*ptr)-'a'+1; + break; + default: + usuage(); + } + // last can be 1-2 digits or one alpha (if pat2 hasn't been set) + if ((ptr=strtok(NULL,". \n"))!=NULL) + { + if (pat2>=0) + usuage(); + switch (strlen(ptr)) + { + case 1: + pat2=(isdigit(*ptr))?atoi(ptr):tolower(*ptr)-'a'+1; + break; + case 2: + if ( + isdigit(*ptr)==0 + || isdigit(*(ptr+1))==0 + ) + usuage(); + pat2=atoi(ptr); + default: + usuage(); + } + } + file=fopen(argv[3],"r"); + if (file==NULL) + usuage(); + len=filelength(_fileno(file)); + buf=(char *)malloc(len+1); + len=fread(buf,sizeof(char),len,file); + buf[len]=0; //set eof + fclose(file); + file=fopen(argv[4],"w"); + if (file==NULL) + usuage(); + sprintf(v1,"%i",maj); + sprintf(v2,"%i",min); + sprintf(v3,"%i",pat); + sprintf(v4,"%02i",pat2); + while (1) + { + ptr=strstr(buf,"%"); + fwrite(buf,1,(ptr)?ptr-buf:strlen(buf),file); //write file if no % found or up to % + if (ptr==NULL) + break; + switch (*(ptr+1)) //skip first scan if buf="1...." + { + case '1': + fwrite(v1,1,strlen(v1),file); + ptr++; + break; + case '2': + fwrite(v2,1,strlen(v2),file); + ptr++; + break; + case '3': + fwrite(v3,1,strlen(v3),file); + ptr++; + break; + case '4': + fwrite(v4,1,strlen(v4),file); + ptr++; + break; + case '5': + fwrite(v5,1,strlen(v5),file); + ptr++; + break; + default: + fwrite("%",1,1,file); //either % at end of file or no %1... + break; + } + buf=ptr+1; + } + fclose(file); + return 0; + } if (strcmp(argv[1],"~")==0) - { //check for file presence - if (fopen(argv[2],"r")) - return(0); - printf("Error---%s\n",argv[3]); + { //check for file presence + if (fopen(argv[2],"r")) + return(0); + if(argc<4) + printf("ERROR --- File not present %s\n",argv[2]); + else + printf("Error---%s\n",argv[3]); exit(0xc000); } if (strcmp(argv[1],"*")==0) @@ -149,31 +291,62 @@ int main(int argc, char* argv[]) } return 0; } - if (strcmp(argv[1],"&")==0) + if (strcmp(argv[1],"@")==0) { + char msg[256],msgt[256]; + char *ptr; if (argc<4) usuage(); for (i=3;argc>=4;i++) { - char *ssect=strtok(argv[i],"["); - char *skey=strtok(argv[i],"]"); + + char *ssect=strstr(argv[i],"["); + char *skey=strstr(ssect,"]"); char *sval; - skey=strtok(NULL,"="); if ((ssect==NULL) || (skey==NULL)) { printf("format error parameter %s\n",argv[i]); exit(0xc000); } - while(*skey==' ') - skey++; - - sval=strtok(NULL,"="); + ssect++; + *skey=0; + if ((strlen(skey+1)==0)||(strlen(ssect)==0)) + { + printf("format error parameter %s\n",argv[i]); + exit(0xc000); + } + while(*++skey==' '); + sval=strstr(skey,"="); if (sval==NULL) { printf("format error parameter %s\n",argv[i]); exit(0xc000); } -// printf("parameters %s %s %s %s\n",ssect,skey,sval,argv[2]); + ptr=sval; + while(*--ptr==' ') ; + *(ptr+1)=0; + while(*++sval==' ') ; + if (ptr=strstr(sval,"*DatE*")) + {// ok so lets substitute date in this string; + char tmpbuf[32]; + *(ptr)=0; + strcpy(msg,sval); + _tzset(); + _strdate( tmpbuf ); + strcat(msg,tmpbuf); + strcat(msg,ptr+6); + sval=msg; + } + if (ptr=strstr(sval,"*TimE*")) + { + char tmpbuf[32]; + *(ptr)=0; + strcpy(msgt,sval); + _strtime( tmpbuf ); + strncat(msgt,tmpbuf,5); + strcat(msgt,ptr+6); + sval=msgt; + } if (WritePrivateProfileString(ssect,skey,sval,argv[2])==0) { LPVOID lpMsgBuf; diff --git a/src/dauth/dlog.c b/src/dauth/dlog.c index 61a62f27c..04ecfd2f8 100644 --- a/src/dauth/dlog.c +++ b/src/dauth/dlog.c @@ -71,7 +71,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/dauth/dlog.c,v 1.1.1.5 2001/07/14 22:21:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/dauth/dlog.c,v 1.1.1.6 2001/09/11 14:32:24 hartmans Exp $"); #include #include @@ -108,7 +108,7 @@ static char *getpipepass() { static char gpbuf[MAX_PASSWD_LEN]; register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -156,14 +156,14 @@ int store_afs_token(unix_id, realm_p, tkt_type, ticket_p, ticket_len, token.startTime = starttime; token.endTime = endtime; - bcopy(session_key, (char *) &token.sessionKey, sizeof(token.sessionKey)); + memcpy((char *) &token.sessionKey, session_key, sizeof(token.sessionKey)); token.kvno = tkt_type; token.ticketLen = ticket_len; if (ticket_len > MAXKTCTICKETLEN) { fprintf(stderr, "dlog: DCE ticket is too long (length %d). Maximum length accepted by AFS cache manager is %d\n", MAXKTCTICKETLEN); exit(1); } - bcopy((char *) ticket_p, (char *) token.ticket, ticket_len); + memcpy((char *) token.ticket, (char *) ticket_p, ticket_len); sprintf(client.name, "AFS ID %d", unix_id); strcpy(client.instance, ""); @@ -186,7 +186,7 @@ char *make_string(s_p, length) fprintf(stderr, "dlog: out of memory\n"); exit(1); } - bcopy(s_p, new_p, length); + memcpy(new_p, s_p, length); new_p[length] = '\0'; return new_p; } @@ -316,7 +316,7 @@ int decode_reply(buf, buflen, reply_p) case ASN_OCTET_STRING: if (context == 1 && len == sizeof(reply_p->session_key)) { saw_session_key++; - bcopy(buf, reply_p->session_key, len); + memcpy(reply_p->session_key, buf, len); } buf += len; break; @@ -467,7 +467,7 @@ CommandProc (as, arock) * Discard command line arguments, in case the password is on the * command line (to avoid it showing up from a ps command). */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd) - 1); passwd[sizeof(passwd) - 1] = '\0'; - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -704,7 +703,7 @@ bad_lifetime: } strcat(passwd, reply_p->salt); des_string_to_key(passwd, passwd_key); - bzero(passwd, strlen(passwd)); + memset(passwd, 0, strlen(passwd)); /* * Decrypt the private data returned by the DCE KDC, and forwarded @@ -724,8 +723,8 @@ bad_lifetime: /* * Destroy the key block: it's no longer needed. */ - bzero(schedule, sizeof(schedule)); - bzero(passwd_key, sizeof(passwd_key)); + memset(schedule, 0, sizeof(schedule)); + memset(passwd_key, 0, sizeof(passwd_key)); /* * Do a very quick and dirty ASN.1 decode of the relevant parts diff --git a/src/des/NTMakefile b/src/des/NTMakefile index ee9e41e70..1f15d978b 100644 --- a/src/des/NTMakefile +++ b/src/des/NTMakefile @@ -56,7 +56,7 @@ LIBOBJS = \ weak_key.obj \ read_pssword.obj \ strng_to_key.obj \ - misco.obj \ + misc.obj \ util.obj \ crypt.obj @@ -65,10 +65,6 @@ LIBFILE = $(DESTDIR)\lib\afsdes.lib $(LIBFILE): $(LIBOBJS) $(LIBARCH) -# Special case, since misc.c includes a "main" for the table generators. -misco.obj: misc.c - $(C2OBJ) misc.c /Fomisco.obj -DDONT_INCL_MAIN - ##################### # Generator Files ### ##################### @@ -113,28 +109,28 @@ ip.c: make_ip.exe # Make generators. misc.obj: AFS_component_version_number.c -make_keyperm.exe: make_keyperm.obj misc.obj +make_keyperm.exe: make_keyperm.obj misc.obj main.obj $(EXECONLINK) -make_p_table.exe: make_p_table.obj misc.obj +make_p_table.exe: make_p_table.obj misc.obj main.obj $(EXECONLINK) -make_s_table.exe: make_s_table.obj misc.obj +make_s_table.exe: make_s_table.obj misc.obj main.obj $(EXECONLINK) -make_odd.exe: make_odd.obj misc.obj +make_odd.exe: make_odd.obj misc.obj main.obj $(EXECONLINK) -make_p.exe: make_p.obj misc.obj +make_p.exe: make_p.obj misc.obj main.obj $(EXECONLINK) -make_s.exe: make_s.obj misc.obj +make_s.exe: make_s.obj misc.obj main.obj $(EXECONLINK) -make_fp.exe: make_fp.obj misc.obj +make_fp.exe: make_fp.obj misc.obj main.obj $(EXECONLINK) -make_ip.exe: make_ip.obj misc.obj +make_ip.exe: make_ip.obj misc.obj main.obj $(EXECONLINK) install: $(GENERATED_FILES) $(LIBFILE) $(INCFILES) diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 6a730b8f4..c294e857a 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -55,7 +55,11 @@ #ifdef AFS_ALPHA_LINUX20_ENV #include "conf-alpha-linux.h" #else +#ifdef AFS_IA64_LINUX20_ENV +#include "conf-ia64-linux.h" +#else #include "conf-i386-linux.h" +#endif /* AFS_IA64_LINUX20_ENV */ #endif /* AFS_ALPHA_LINUX20_ENV */ #endif /* AFS_S390_LINUX20_ENV */ #endif /* AFS_SPARC64_LINUX20_ENV */ diff --git a/src/des/cbc_encrypt.c b/src/des/cbc_encrypt.c index c71f9ef15..1c1e41a1f 100644 --- a/src/des/cbc_encrypt.c +++ b/src/des/cbc_encrypt.c @@ -23,7 +23,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/cbc_encrypt.c,v 1.1.1.4 2001/07/14 22:21:28 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/cbc_encrypt.c,v 1.1.1.5 2001/09/11 14:32:26 hartmans Exp $"); #define XPRT_CBC_ENCRYPT @@ -73,8 +73,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) if (encrypt) { #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++, (char *)&t_output[0], sizeof(t_output[0])); - bcopy((char *)ivec, (char *)&t_output[1], sizeof(t_output[1])); + memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); + memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); } else #endif @@ -87,8 +87,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -114,10 +114,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output and save it for cbc */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif @@ -140,8 +138,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* decrypt */ #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -154,8 +152,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[0])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[0])); } else #endif @@ -185,10 +183,8 @@ des_cbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/cksum.c b/src/des/cksum.c index b03e41e35..f6dc5948f 100644 --- a/src/des/cksum.c +++ b/src/des/cksum.c @@ -20,15 +20,16 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/cksum.c,v 1.1.1.5 2001/07/14 22:21:27 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/cksum.c,v 1.1.1.6 2001/09/11 14:32:26 hartmans Exp $"); #include #include -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif #include @@ -74,8 +75,8 @@ des_cbc_cksum(in,out,length,key,iv) #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&t_output[0],sizeof(t_output[0])); - bcopy((char *)ivec,(char *)&t_output[1],sizeof(t_output[1])); + memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); + memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); } else #endif @@ -88,8 +89,8 @@ des_cbc_cksum(in,out,length,key,iv) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -126,8 +127,8 @@ des_cbc_cksum(in,out,length,key,iv) /* copy temp output and save it for checksum */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++,sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output,sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/crypt.c b/src/des/crypt.c index c430fbb3b..aae130848 100644 --- a/src/des/crypt.c +++ b/src/des/crypt.c @@ -37,17 +37,18 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/crypt.c,v 1.1.1.4 2001/07/14 22:21:31 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/crypt.c,v 1.1.1.5 2001/09/11 14:32:29 hartmans Exp $"); #ifdef AFS_NT40_ENV #include #endif #include -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif /* @@ -248,8 +249,13 @@ typedef union { struct { #if defined(LONG_IS_32_BITS) /* long is often faster than a 32-bit bit field */ +#if defined(AFS_IA64_LINUX20_ENV) + int i0; + int i1; +#else long i0; long i1; +#endif #else long i0: 32; long i1: 32; @@ -500,6 +506,7 @@ crypt(key, setting) int num_iter, salt_size; C_block keyblock, rsltblock; + for (i = 0; i < 8; i++) { if ((t = 2*(unsigned char)(*key)) != 0) key++; diff --git a/src/des/des.c b/src/des/des.c index bd37a801a..3cd72956b 100644 --- a/src/des/des.c +++ b/src/des/des.c @@ -36,7 +36,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/des.c,v 1.1.1.4 2001/07/14 22:21:31 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/des.c,v 1.1.1.5 2001/09/11 14:32:30 hartmans Exp $"); #include #ifdef AFS_PTHREAD_ENV @@ -130,8 +130,8 @@ des_ecb_encrypt(clear, cipher, schedule, encrypt) } #endif if ((afs_int32) clear & 3) { - bcopy((char *)clear++,(char *)&L_save,sizeof(L_save)); - bcopy((char *)clear,(char *)&R_save,sizeof(R_save)); + memcpy((char *)&L_save, (char *)clear++, sizeof(L_save)); + memcpy((char *)&R_save, (char *)clear, sizeof(R_save)); L1 = L_save; R1 = R_save; } @@ -442,8 +442,8 @@ des_ecb_encrypt(clear, cipher, schedule, encrypt) if ((afs_int32) cipher & 3) { L_save = L2; /* cant bcopy a reg */ R_save = R2; - bcopy((char *)&L_save,(char *)cipher++,sizeof(L_save)); - bcopy((char *)&R_save,(char *)cipher,sizeof(R_save)); + memcpy((char *)cipher++, (char *)&L_save, sizeof(L_save)); + memcpy((char *)cipher, (char *)&R_save, sizeof(R_save)); } else #endif diff --git a/src/des/enc.c b/src/des/enc.c index b6e58c652..fe73aba50 100644 --- a/src/des/enc.c +++ b/src/des/enc.c @@ -8,7 +8,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/enc.c,v 1.1.1.3 2001/07/14 22:21:32 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/enc.c,v 1.1.1.4 2001/09/11 14:32:30 hartmans Exp $"); #include #include @@ -74,7 +74,7 @@ main(argc,argv) } ivec[0] = 0; ivec[1] = 0; - bcopy(key,sum,sizeof(C_Block)); + memcpy(sum, key, sizeof(C_Block)); for (;;) { if ((length = read (ind, inbuf, 512)) < 0) { fprintf (stderr, "%s: Error reading from input.\n", diff --git a/src/des/misc.c b/src/des/misc.c index 231caceae..62038e601 100644 --- a/src/des/misc.c +++ b/src/des/misc.c @@ -13,12 +13,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/misc.c,v 1.1.1.4 2001/07/14 22:21:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/misc.c,v 1.1.1.5 2001/09/11 14:32:31 hartmans Exp $"); #include #include #include "des_internal.h" +int des_debug; + /* * The DES algorithm is defined in terms of MSBFIRST, so sometimes, * e.g. VAXes, we need to fix it up. ANSI order means the DES @@ -286,70 +288,3 @@ void test_set(stream, src, testbit, dest, setbit) #endif } -extern void gen PROTOTYPE((FILE * stream)); -int des_debug; -char const *whoami; - - -#ifndef DONT_INCL_MAIN - -#include "AFS_component_version_number.c" - -int main(argc, argv) - int argc; - char *argv[]; -{ - char *filename; - char *arg; - FILE * stream; - - whoami = argv[0]; - filename = (char *)NULL; - - while (argc--, *++argv) { - arg = *argv; - if (*arg == '-') { - if (!strcmp(arg, "-d") && !strcmp(arg, "-debug")) - des_debug++; - else { - fprintf(stderr, "%s: unknown control argument %s\n", - whoami, arg); - goto usage; - } - } - else if (filename) { - fprintf(stderr, - "%s: multiple file names provided: %s, %s\n", - whoami, filename, arg); - goto usage; - } - else - filename = arg; - } - - if (!filename) { - fprintf(stderr, "%s: no file name provided\n", whoami); - goto usage; - } - - stream = fopen(filename, "w"); - if (!stream) { - perror(filename); - usage: - fprintf(stderr, "usage: %s [-debug] filename\n", whoami); - exit(1); - } - - fputs( - "/* This file is automatically generated. Do not edit it. */\n", - stream); - - /* This routine will generate the contents of the file. */ - gen(stream); - if (fclose(stream) == EOF) { - perror(filename); - exit(1); - } - exit(0); -} -#endif /* DONT_INCL_MAIN */ diff --git a/src/des/new_rnd_key.c b/src/des/new_rnd_key.c index 8fdbd4fd8..53cb8fc6d 100644 --- a/src/des/new_rnd_key.c +++ b/src/des/new_rnd_key.c @@ -18,18 +18,19 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/new_rnd_key.c,v 1.1.1.5 2001/07/14 22:21:36 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/new_rnd_key.c,v 1.1.1.6 2001/09/11 14:32:32 hartmans Exp $"); #include #include "des_internal.h" #ifdef AFS_PTHREAD_ENV #include #endif -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif #include "stats.h" @@ -242,8 +243,7 @@ static afs_int32 des_set_sequence_number(des_cblock new_sequence_number) { LOCK_RANDOM - bcopy((char *)new_sequence_number, (char *)sequence_number, - sizeof(sequence_number)); + memcpy((char *)sequence_number, (char *)new_sequence_number, sizeof(sequence_number)); UNLOCK_RANDOM return 0; } diff --git a/src/des/pcbc_encrypt.c b/src/des/pcbc_encrypt.c index a978a9c2c..886d93c61 100644 --- a/src/des/pcbc_encrypt.c +++ b/src/des/pcbc_encrypt.c @@ -26,7 +26,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/pcbc_encrypt.c,v 1.1.1.4 2001/07/14 22:21:36 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/pcbc_encrypt.c,v 1.1.1.5 2001/09/11 14:32:32 hartmans Exp $"); #include "des_internal.h" @@ -88,8 +88,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) if (encrypt) { #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -102,8 +102,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)(input+1),(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)(input+1), sizeof(t_input[1])); } else #endif @@ -135,9 +135,9 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&xor_0,sizeof(xor_0)); + memcpy((char *)&xor_0, (char *)input++, sizeof(xor_0)); xor_0 ^= t_output[0]; - bcopy((char *)input++,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_1, (char *)input++, sizeof(xor_1)); xor_1 ^= t_output[1]; } else @@ -151,10 +151,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output and save it for cbc */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif @@ -181,8 +179,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* decrypt */ #ifdef MUSTALIGN if ((afs_int32) ivec & 3) { - bcopy((char *)ivec++,(char *)&xor_0,sizeof(xor_0)); - bcopy((char *)ivec,(char *)&xor_1,sizeof(xor_1)); + memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); + memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else #endif @@ -195,8 +193,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* get input */ #ifdef MUSTALIGN if ((afs_int32) input & 3) { - bcopy((char *)input++,(char *)&t_input[0],sizeof(t_input[0])); - bcopy((char *)input++,(char *)&t_input[1],sizeof(t_input[1])); + memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); + memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else #endif @@ -226,10 +224,8 @@ des_pcbc_encrypt(in,out,length,key,iv,encrypt) /* copy temp output */ #ifdef MUSTALIGN if ((afs_int32) output & 3) { - bcopy((char *)&t_output[0],(char *)output++, - sizeof(t_output[0])); - bcopy((char *)&t_output[1],(char *)output++, - sizeof(t_output[1])); + memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); + memcpy((char *)output++, (char *)&t_output[1], sizeof(t_output[1])); } else #endif diff --git a/src/des/read_pssword.c b/src/des/read_pssword.c index 0782e9c23..6a8115785 100644 --- a/src/des/read_pssword.c +++ b/src/des/read_pssword.c @@ -14,18 +14,19 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/read_pssword.c,v 1.1.1.5 2001/07/14 22:21:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/read_pssword.c,v 1.1.1.6 2001/09/11 14:32:33 hartmans Exp $"); #include #include #include "conf.h" #include -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif #ifdef BSDUNIX @@ -107,7 +108,7 @@ des_read_password(k,prompt,verify) #ifdef BSDUNIX lose: #endif - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); return ok; } @@ -215,7 +216,7 @@ des_read_pw_string(s,maxa,prompt,verify) #else #ifdef BSDUNIX /* XXX assume jmp_buf is typedef'ed to an array */ - bcopy((char *)old_env, (char *)env, sizeof(env)); + memcpy((char *)env, (char *)old_env, sizeof(env)); if (setjmp(env)) goto lose; /* save terminal state*/ @@ -223,7 +224,7 @@ des_read_pw_string(s,maxa,prompt,verify) return -1; push_signals(); /* Turn off echo */ - bcopy (&tty_state, &echo_off_tty_state, sizeof (tty_state)); + memcpy(&echo_off_tty_state, &tty_state, sizeof (tty_state)); echo_off_tty_state.sg_flags &= ~ECHO; if (ioctl(0,TIOCSETP,(char *)&echo_off_tty_state) == -1) return -1; @@ -276,7 +277,7 @@ des_read_pw_string(s,maxa,prompt,verify) } continue; } - if ((ptr = index(s, '\n'))) + if ((ptr = strchr(s, '\n'))) *ptr = '\0'; #endif if (verify) { @@ -291,7 +292,7 @@ des_read_pw_string(s,maxa,prompt,verify) clearerr(stdin); continue; } - if ((ptr = index(key_string, '\n'))) + if ((ptr = strchr(key_string, '\n'))) *ptr = '\0'; #endif if (strcmp(s,key_string)) { @@ -307,7 +308,7 @@ des_read_pw_string(s,maxa,prompt,verify) lose: #endif if (!ok) - bzero(s, maxa); + memset(s, 0, maxa); printf("\n"); #if defined(AFS_HPUX_ENV) || defined(AFS_FBSD_ENV) /* @@ -338,7 +339,7 @@ lose: if (ioctl(0,TIOCSETP,(char *)&tty_state)) ok = 0; pop_signals(); - bcopy((char *)env, (char *)old_env, sizeof(env)); + memcpy((char *)old_env, (char *)env, sizeof(env)); #else #if defined (AFS_AIX_ENV) /*|| defined (AFS_HPUX_ENV)*/ || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) ttyb.c_lflag = flags; @@ -361,7 +362,7 @@ lose: #endif #endif if (verify) - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); s[maxa-1] = 0; /* force termination */ return !ok; /* return nonzero if not okay */ } diff --git a/src/des/strng_to_key.c b/src/des/strng_to_key.c index aac0991b4..8a6637ebb 100644 --- a/src/des/strng_to_key.c +++ b/src/des/strng_to_key.c @@ -25,15 +25,16 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/strng_to_key.c,v 1.1.1.5 2001/07/14 22:21:36 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/strng_to_key.c,v 1.1.1.6 2001/09/11 14:32:33 hartmans Exp $"); #include #include "des_internal.h" -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif extern int des_debug; @@ -67,7 +68,7 @@ des_string_to_key(str,key) length = strlen(str); /* init key array for bits */ - bzero(k_char,sizeof(k_char)); + memset(k_char, 0, sizeof(k_char)); #ifdef DEBUG if (des_debug) @@ -116,7 +117,7 @@ des_string_to_key(str,key) (void) des_key_sched(key,key_sked); (void) des_cbc_cksum((des_cblock *)in_str,key,length,key_sked,key); /* erase key_sked */ - bzero((char *)key_sked,sizeof(key_sked)); + memset((char *)key_sked, 0, sizeof(key_sked)); /* now fix up key parity again */ des_fixup_key_parity(key); diff --git a/src/des/weak_key.c b/src/des/weak_key.c index 42fbd1a87..64d0d2604 100644 --- a/src/des/weak_key.c +++ b/src/des/weak_key.c @@ -15,15 +15,16 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/des/weak_key.c,v 1.1.1.5 2001/07/14 22:21:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/des/weak_key.c,v 1.1.1.6 2001/09/11 14:32:33 hartmans Exp $"); #include #include "des_internal.h" -#if defined(HAVE_STRINGS_H) +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H #include #endif -#if defined(HAVE_STRING_H) -#include #endif /* @@ -69,7 +70,7 @@ des_is_weak_key(key) const des_cblock *weak_p = weak; for (i = 0; i < (sizeof(weak)/sizeof(des_cblock)); i++) { - if (!bcmp((char *)weak_p++,(char *)key,sizeof(des_cblock))) + if (!memcmp((char *)weak_p++,(char *)key,sizeof(des_cblock))) return 1; } diff --git a/src/dir/buffer.c b/src/dir/buffer.c index 60ae10f49..218ee7568 100644 --- a/src/dir/buffer.c +++ b/src/dir/buffer.c @@ -10,8 +10,9 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/dir/buffer.c,v 1.1.1.4 2001/07/14 22:21:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/dir/buffer.c,v 1.1.1.5 2001/09/11 14:32:35 hartmans Exp $"); +#include #include #include "dir.h" diff --git a/src/dir/salvage.c b/src/dir/salvage.c index ab525b58a..f7022389e 100644 --- a/src/dir/salvage.c +++ b/src/dir/salvage.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/dir/salvage.c,v 1.1.1.4 2001/07/14 22:21:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/dir/salvage.c,v 1.1.1.5 2001/09/11 14:32:36 hartmans Exp $"); #include #include @@ -398,8 +398,8 @@ int DirSalvage (fromFile, toFile, vn, vu, pvn, pvu) struct DirEntry *ep; int entry; - bzero(dot, sizeof(dot)); - bzero(dotdot, sizeof(dotdot)); + memset(dot, 0, sizeof(dot)); + memset(dotdot, 0, sizeof(dotdot)); dot[1] = vn; dot[2] = vu; dotdot[1] = pvn; diff --git a/src/dir/test/dtest.c b/src/dir/test/dtest.c index 579437819..34fc4463c 100644 --- a/src/dir/test/dtest.c +++ b/src/dir/test/dtest.c @@ -11,7 +11,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/dir/test/dtest.c,v 1.1.1.4 2001/07/14 22:21:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/dir/test/dtest.c,v 1.1.1.5 2001/09/11 14:32:36 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -157,7 +157,7 @@ int count; { dirhandle dir; CreateDir(dname, &dir); - bzero(fid, sizeof(fid)); + memset(fid, 0, sizeof(fid)); MakeDir(&dir, fid, fid); for(i=0;i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/export/cfgexport.c,v 1.1.1.4 2001/07/14 22:21:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/export/cfgexport.c,v 1.1.1.5 2001/09/11 14:32:37 hartmans Exp $"); #include #include @@ -328,7 +328,7 @@ char *syms; kstr_size = 0; nksyms = 0; - bzero(xsq = &xcoff_sym, sizeof (*xsq)); + memset(xsq = &xcoff_sym, 0, sizeof (*xsq)); for (i = 1; i < nxsyms; ++i, xsq = xsp++) { if (xsp->n_zeroes != xsq->n_zeroes diff --git a/src/export/symtab.c b/src/export/symtab.c index fa9f65ba0..85197e2b7 100644 --- a/src/export/symtab.c +++ b/src/export/symtab.c @@ -13,7 +13,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/export/symtab.c,v 1.1.1.4 2001/07/14 22:21:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/export/symtab.c,v 1.1.1.5 2001/09/11 14:32:38 hartmans Exp $"); #include "sys/types.h" #include "sym.h" @@ -41,7 +41,7 @@ char *name; { */ if (sym = symsrch(name)) return sym; - bcopy(name, buf+1, sizeof (buf) - 2); + memcpy(buf+1, name, sizeof (buf) - 2); buf[0] = '.'; if (sym = symsrch(buf)) diff --git a/src/fsprobe/fsprobe.c b/src/fsprobe/fsprobe.c index 65b067e31..4c61c537c 100644 --- a/src/fsprobe/fsprobe.c +++ b/src/fsprobe/fsprobe.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe.c,v 1.1.1.4 2001/07/14 22:21:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe.c,v 1.1.1.5 2001/09/11 14:32:40 hartmans Exp $"); #include /*Interface for this module*/ #include /*Lightweight process package*/ @@ -95,7 +95,7 @@ static int fsprobe_CleanupInit() struct interfaceAddr *interfaceAddr; /*Bogus param*/ fsprobe_ConnInfo = (struct fsprobe_ConnectionInfo *)0; - bzero(fsprobe_Results, sizeof(struct fsprobe_ProbeResults)); + memset(&fsprobe_Results, 0, sizeof(struct fsprobe_ProbeResults)); rxcall = (struct rx_call *)0; Fids_Array = (AFSCBFids *)0; @@ -253,8 +253,8 @@ static void fsprobe_LWP() curr_stats = fsprobe_Results.stats; curr_probeOK = fsprobe_Results.probeOK; fsprobe_Results.probeNum++; - bzero(fsprobe_Results.stats, fsprobe_statsBytes); - bzero(fsprobe_Results.probeOK, fsprobe_probeOKBytes); + memset(fsprobe_Results.stats, 0, fsprobe_statsBytes); + memset(fsprobe_Results.probeOK, 0, fsprobe_probeOKBytes); for (conn_idx = 0; conn_idx < fsprobe_numServers; conn_idx++) { /* @@ -553,8 +553,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, fsprobe_Results.probeNum = 0; fsprobe_Results.probeTime = 0; - bzero(fsprobe_Results.stats, - (a_numServers * sizeof(struct ProbeViceStatistics))); + memset(fsprobe_Results.stats, 0, (a_numServers * sizeof(struct ProbeViceStatistics))); /* * Initialize the Rx subsystem, just in case nobody's done it. @@ -624,9 +623,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); if (hostNameFound == (char *)0) { @@ -687,7 +684,7 @@ int fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, } else { int i, cnt; - bzero(&curr_conn->partList, sizeof(struct partList)); + memset(&curr_conn->partList, 0, sizeof(struct partList)); curr_conn->partCnt = 0; i = XListPartitions(curr_conn->rxVolconn, &curr_conn->partList, &cnt); if (!i) { diff --git a/src/fsprobe/fsprobe_test.c b/src/fsprobe/fsprobe_test.c index 38635493a..3933aacf9 100644 --- a/src/fsprobe/fsprobe_test.c +++ b/src/fsprobe/fsprobe_test.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe_test.c,v 1.1.1.4 2001/07/14 22:21:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe_test.c,v 1.1.1.5 2001/09/11 14:32:40 hartmans Exp $"); #include /*Interface for fsprobe module*/ @@ -158,7 +158,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername1\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[0].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[0].sin_addr.s_addr), he->h_addr, 4); FSSktArray[1].sin_family = htons(AF_INET); /*Internet address family*/ FSSktArray[1].sin_port = htons(7000); /*FileServer port*/ @@ -167,7 +167,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername2\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[1].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[1].sin_addr.s_addr), he->h_addr, 4); FSSktArray[2].sin_family = htons(AF_INET); /*Internet address family*/ FSSktArray[2].sin_port = htons(7000); /*FileServer port*/ @@ -176,7 +176,7 @@ main(argc, argv) fprintf(stderr, "[%s] Can't get host info for servername3\n", rn); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[2].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[2].sin_addr.s_addr), he->h_addr, 4); printf("Sockets for the 3 AFS FileServers to be probed:\n"); printf("\t Host servername1: IP addr 0x%lx, port %d\n", diff --git a/src/ftpd43+/ftpcmd.y b/src/ftpd43+/ftpcmd.y index 472676bbb..d74f60562 100644 --- a/src/ftpd43+/ftpcmd.y +++ b/src/ftpd43+/ftpcmd.y @@ -980,7 +980,7 @@ yylex() if (strncasecmp(cbuf, "PASS", 4) != NULL) setproctitle("%s: %s", proctitle, cbuf); #endif /* SETPROCTITLE */ - if ((cp = index(cbuf, '\r'))) { + if ((cp = strchr(cbuf, '\r'))) { *cp++ = '\n'; *cp = '\0'; } diff --git a/src/ftpd43+/ftpd.c b/src/ftpd43+/ftpd.c index d91a96ff6..5ac9ca13a 100644 --- a/src/ftpd43+/ftpd.c +++ b/src/ftpd43+/ftpd.c @@ -347,7 +347,7 @@ nextopt: syslog(LOG_ERR, MSGSTR(SOCKOPT, "setsockopt: %m")); /* set-up signal handler routines for SRC TRACE ON/OFF support */ - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sigaction(SIGUSR1, &sa, (struct sigaction *)0); diff --git a/src/ftpd43+/logwtmp.c b/src/ftpd43+/logwtmp.c index e09ea0fab..ecc46469c 100644 --- a/src/ftpd43+/logwtmp.c +++ b/src/ftpd43+/logwtmp.c @@ -49,7 +49,7 @@ logwtmp(line, name, host) return; } - bzero((char *)&ut, sizeof(ut)); + memset((char *)&ut, 0, sizeof(ut)); if (!fstat(fd, &buf)) { (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line)); (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name)); diff --git a/src/ftpd43+/popen.c b/src/ftpd43+/popen.c index 4cf0cb678..2d25c75f0 100644 --- a/src/ftpd43+/popen.c +++ b/src/ftpd43+/popen.c @@ -57,7 +57,7 @@ ftpd_popen(program, type) if (!(pids = (uid_t *)malloc((u_int)(fds * sizeof(uid_t))))) return(NULL); - bzero(pids, fds * sizeof(uid_t)); + memset(pids, 0, fds * sizeof(uid_t)); } if (pipe(pdes) < 0) return(NULL); @@ -137,7 +137,7 @@ ftpd_pclose(iop) if (pids[fdes = fileno(iop)] == 0) return(-1); (void)fclose(iop); - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); someSignals[0] = (1<<(SIGINT-1)) + (1<<(SIGQUIT-1)) + (1<<(SIGHUP-1)); sigBlock = *((sigset_t *) someSignals); sigprocmask(SIG_BLOCK, &sigBlock, &oset); diff --git a/src/gtx/frame.c b/src/gtx/frame.c index e030f07e0..ec2205297 100644 --- a/src/gtx/frame.c +++ b/src/gtx/frame.c @@ -11,7 +11,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/frame.c,v 1.1.1.4 2001/07/14 22:21:59 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/frame.c,v 1.1.1.5 2001/09/11 14:32:44 hartmans Exp $"); #ifdef AFS_HPUX_ENV #include @@ -200,7 +200,7 @@ struct gtx_frame *aframe; { tmenu = (struct gtxframe_menu *) malloc(sizeof(*tmenu)); if (tmenu == (struct gtxframe_menu *)0) return(-1); - bzero(tmenu, sizeof(*tmenu)); + memset(tmenu, 0, sizeof(*tmenu)); tmenu->next = aframe->menus; aframe->menus = tmenu; tmenu->name = gtx_CopyString(alabel); @@ -342,7 +342,7 @@ struct gtx_frame *aframe; { WOP_GETDIMENSIONS(aframe->window, &sizeparms); if (aframe->promptLine) { - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.x = 0; strparms.y = sizeparms.maxy-1; strparms.highlight = 1; @@ -354,7 +354,7 @@ struct gtx_frame *aframe; { } else if (aframe->messageLine) { /* Otherwise we're visible, print the message at the bottom */ - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.highlight = 1; strparms.x = 0; strparms.y = sizeparms.maxy-1; @@ -418,7 +418,7 @@ struct gtx_frame *gtxframe_Create() { * Now that all the pieces exist, fill them in and stick them in * the right places. */ - bzero(tframe, sizeof(struct gtx_frame)); + memset(tframe, 0, sizeof(struct gtx_frame)); tframe->keymap = newkeymap; tframe->keystate = newkeystate; keymap_InitState(tframe->keystate, tframe->keymap); @@ -460,7 +460,7 @@ register struct gtx_frame *aframe; { strcat(menubuffer, " "); } if (menubuffer[0] != 0) { - bzero(&strparms, sizeof(strparms)); + memset(&strparms, 0, sizeof(strparms)); strparms.x = 0; strparms.y = 0; strparms.s = menubuffer; diff --git a/src/gtx/keymap.c b/src/gtx/keymap.c index d2aac1fa0..29ef139d6 100644 --- a/src/gtx/keymap.c +++ b/src/gtx/keymap.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/keymap.c,v 1.1.1.4 2001/07/14 22:22:03 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/keymap.c,v 1.1.1.5 2001/09/11 14:32:46 hartmans Exp $"); #include "gtxkeymap.h" @@ -19,7 +19,7 @@ struct keymap_map *keymap_Create() { tmap = (struct keymap_map *) malloc(sizeof(struct keymap_map)); if (tmap != (struct keymap_map *)0) - bzero(tmap, sizeof(*tmap)); + memset(tmap, 0, sizeof(*tmap)); return(tmap); } @@ -125,7 +125,7 @@ register struct keymap_map *amap; { keymap_InitState(astate, amap) register struct keymap_state *astate; struct keymap_map *amap; { - bzero(astate, sizeof(*astate)); + memset(astate, 0, sizeof(*astate)); astate->initMap = amap; astate->currentMap = amap; return 0; diff --git a/src/gtx/textcb.c b/src/gtx/textcb.c index c9f28ccc4..8ada5dbc2 100644 --- a/src/gtx/textcb.c +++ b/src/gtx/textcb.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/textcb.c,v 1.1.1.4 2001/07/14 22:22:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/gtx/textcb.c,v 1.1.1.5 2001/09/11 14:32:47 hartmans Exp $"); #include "gtxtextcb.h" /*Module interface*/ #include /*Standard I/O stuff*/ @@ -169,7 +169,7 @@ struct gator_textcb_hdr *gator_textcb_Create(a_maxEntriesStored, a_maxCharsPerEn */ if (gator_textcb_debug) fprintf(stderr, "[%s] Zeroing %d bytes in text buffer at 0x%x\n", rn, numBuffBytes, newBuff); - bzero(newBuff, numBuffBytes); + memset(newBuff, 0, numBuffBytes); if (gator_textcb_debug) fprintf(stderr, "[%s] Initializing blank line buffer at 0x%x\n", rn, blankLine); @@ -190,7 +190,7 @@ struct gator_textcb_hdr *gator_textcb_Create(a_maxEntriesStored, a_maxCharsPerEn curr_ent->numInversions = 0; curr_ent->charsUsed = 0; curr_ent->textp = curr_buff; - bcopy(blankLine, curr_ent->textp, a_maxCharsPerEntry+1); + memcpy(curr_ent->textp, blankLine, a_maxCharsPerEntry+1); for (curr_inv = 0; curr_inv < GATOR_TEXTCB_MAXINVERSIONS; curr_inv++) curr_ent->inversion[curr_inv] = 0; @@ -266,7 +266,7 @@ static struct gator_textcb_entry *bumpEntry(a_cbhdr) * Copy over a blank line into the one we're initializing. We * copy over the trailing null, too. */ - bcopy(a_cbhdr->blankLine, curr_ent->textp, a_cbhdr->maxCharsPerEntry+1); + memcpy(curr_ent->textp, a_cbhdr->blankLine, a_cbhdr->maxCharsPerEntry+1); for (inv=0; inv < GATOR_TEXTCB_MAXINVERSIONS; inv++) curr_ent->inversion[inv] = 0; diff --git a/src/inetd/inetd.c b/src/inetd/inetd.c index 3c9b30682..ecbd15f66 100644 --- a/src/inetd/inetd.c +++ b/src/inetd/inetd.c @@ -55,7 +55,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/inetd.c,v 1.1.1.4 2001/07/14 22:22:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/inetd.c,v 1.1.1.5 2001/09/11 14:32:48 hartmans Exp $"); #include #include @@ -194,7 +194,7 @@ main(argc, argv, envp) #endif /* defined(AFS_HPUX_ENV) */ memset((char *)allZeroes, '\0', sizeof(allZeroes)); - bzero((char *)allZeroes, sizeof(allZeroes)); + memset((char *)allZeroes, 0, sizeof(allZeroes)); sigNone = *((sigset_t *) allZeroes); allZeroes[0] = (1<<(SIGCHLD-1)) + (1<<(SIGHUP-1)) + (1<<(SIGALRM-1)); @@ -475,7 +475,7 @@ main(argc, argv, envp) inet_ntoa(his_addr.sin_addr.s_addr), ntohs(his_addr.sin_port)); execl(sep->se_server, - rindex(sep->se_server, '/')+1, + strrchr(sep->se_server, '/')+1, sep->se_socktype == SOCK_DGRAM ? (char *)0 : addrbuf, (char *)0); } else diff --git a/src/inetd/setenv.c b/src/inetd/setenv.c index 578aa1cf9..eb8b8b136 100644 --- a/src/inetd/setenv.c +++ b/src/inetd/setenv.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/setenv.c,v 1.1.1.3 2001/07/14 22:22:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/setenv.c,v 1.1.1.4 2001/09/11 14:32:49 hartmans Exp $"); #include #include @@ -66,7 +66,7 @@ setenv(name, value, rewrite) (cnt + 2))); if (!P) return(-1); - bcopy(environ, P, cnt * sizeof(char *)); + memcpy(P, environ, cnt * sizeof(char *)); environ = P; } environ[cnt + 1] = NULL; diff --git a/src/inetd/ta-rauth.c b/src/inetd/ta-rauth.c index 7a42a294f..d2b8da9a9 100644 --- a/src/inetd/ta-rauth.c +++ b/src/inetd/ta-rauth.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/ta-rauth.c,v 1.1.1.4 2001/07/14 22:22:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/inetd/ta-rauth.c,v 1.1.1.5 2001/09/11 14:32:51 hartmans Exp $"); #include #include @@ -177,7 +177,7 @@ outtoken(s,token,svc,localName) /* (4) sessionKey */ bp = buf + strlen(buf); - bcopy(&token->sessionKey,bp,8); + memcpy(bp, &token->sessionKey, 8); bp += 8; /* (5) - (6) */ @@ -185,7 +185,7 @@ outtoken(s,token,svc,localName) /* (7) ticket */ bp += strlen(bp); - bcopy(token->ticket, bp, token->ticketLen); + memcpy(bp, token->ticket, token->ticketLen); bp += token->ticketLen; if((count = write(s, buf, (int)(bp - buf))) == -1) { diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index f339a2758..b64a3b9d7 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/admin_tools.c,v 1.1.1.7 2001/07/14 22:22:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/admin_tools.c,v 1.1.1.8 2001/09/11 14:32:52 hartmans Exp $"); #include #include @@ -637,7 +637,7 @@ int SetFields ( hrs = 0; s = as->parms[7].items->data; - if (index(s, ':')) + if (strchr(s, ':')) sscanf(s, "%d:%d", &hrs, &mins); else sscanf(s, "%d", &mins); @@ -1328,7 +1328,7 @@ static int MyBeforeProc( if (code) { /* if not then get key and try again */ if (as->parms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[MAXKTCNAMELEN+50]; if (as->parms[12].items) sprintf (msg, "Administrator's (%s) Password: ", name); @@ -1391,7 +1391,7 @@ static int MyBeforeProc( "getting Authentication token for %s", PrintedName (name, instance, cell)); } - bzero (&key, sizeof(key)); + memset(&key, 0, sizeof(key)); } } diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index 9daa373d1..9ed8803b8 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -16,7 +16,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/authclient.c,v 1.1.1.6 2001/07/14 22:22:09 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/authclient.c,v 1.1.1.7 2001/09/11 14:32:52 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -365,7 +365,7 @@ static afs_int32 CheckTicketAnswer( cksum = ntohl(answer->cksum); if (challenge != ntohl(answer->challenge)) return KABADPROTOCOL; - bcopy (&answer->sessionKey, &token->sessionKey, sizeof(token->sessionKey)); + memcpy(&token->sessionKey, &answer->sessionKey, sizeof(token->sessionKey)); token->startTime = ntohl(answer->startTime); token->endTime = ntohl(answer->endTime); token->kvno = (short) ntohl(answer->kvno); @@ -401,9 +401,9 @@ static afs_int32 CheckTicketAnswer( ) return KABADPROTOCOL; - bcopy (strings, token->ticket, token->ticketLen); + memcpy(token->ticket, strings, token->ticketLen); strings += token->ticketLen; - if (bcmp (strings, label, KA_LABELSIZE) != 0) return KABADPROTOCOL; + if (memcmp (strings, label, KA_LABELSIZE) != 0) return KABADPROTOCOL; if (pwexpires) { afs_int32 temp; @@ -412,7 +412,7 @@ static afs_int32 CheckTicketAnswer( if (oanswer->SeqLen > temp) { strings = oanswer->SeqBody + temp; - bcopy (strings, &temp, sizeof(afs_int32)); + memcpy(&temp, strings, sizeof(afs_int32)); tempc = ntohl(temp) >> 24; /* don't forget this if you add any more fields! strings += sizeof(afs_int32); @@ -525,7 +525,7 @@ afs_int32 ka_Authenticate ( request_time = time(0); request.time = htonl(request_time); - bcopy (req_label, request.label, sizeof(request.label)); + memcpy(request.label, req_label, sizeof(request.label)); arequest.SeqLen = sizeof(request); arequest.SeqBody = (char *)&request; des_pcbc_encrypt (arequest.SeqBody, arequest.SeqBody, arequest.SeqLen, @@ -599,9 +599,8 @@ afs_int32 ka_Authenticate ( token->endTime = end; token->kvno = ntohl(answer_old.kvno); token->ticketLen = answer_old.ticket_len; - bcopy (answer_old.ticket, token->ticket, sizeof(token->ticket)); - bcopy (&answer_old.sessionkey, &token->sessionKey, - sizeof(struct ktc_encryptionKey)); + memcpy(token->ticket, answer_old.ticket, sizeof(token->ticket)); + memcpy(&token->sessionKey, &answer_old.sessionkey, sizeof(struct ktc_encryptionKey)); } break; default: @@ -705,8 +704,7 @@ afs_int32 ka_GetToken ( token->endTime = ntohl(answer_old.endTime); token->ticketLen = ntohl(answer_old.ticketLen); token->kvno = ntohl(answer_old.kvno); - bcopy (&answer_old.sessionKey, &token->sessionKey, - sizeof(token->sessionKey)); + memcpy(&token->sessionKey, &answer_old.sessionKey, sizeof(token->sessionKey)); if (tkt_CheckTimes (token->startTime, token->endTime, time(0)) < 0) { UNLOCK_GLOBAL_MUTEX @@ -756,7 +754,7 @@ afs_int32 ka_GetToken ( UNLOCK_GLOBAL_MUTEX return KABADPROTOCOL; } - bcopy (strings, token->ticket, token->ticketLen); + memcpy(token->ticket, strings, token->ticketLen); break; default: diff --git a/src/kauth/client.c b/src/kauth/client.c index 8e5f61055..7a9ed426c 100644 --- a/src/kauth/client.c +++ b/src/kauth/client.c @@ -14,7 +14,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/client.c,v 1.1.1.5 2001/07/14 22:22:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/client.c,v 1.1.1.6 2001/09/11 14:32:53 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -58,7 +58,7 @@ static void Andrew_StringToKey ( int i; int passlen; - bzero (key, sizeof(struct ktc_encryptionKey)); + memset(key, 0, sizeof(struct ktc_encryptionKey)); strncpy (password, cell, 8); passlen = strlen (str); @@ -106,13 +106,13 @@ static void StringToKey ( if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password); - bcopy ("kerberos", ivec, 8); - bcopy ("kerberos", temp_key, 8); + memcpy(ivec, "kerberos", 8); + memcpy(temp_key, "kerberos", 8); des_fixup_key_parity (temp_key); des_key_sched (temp_key, schedule); des_cbc_cksum (password, ivec, passlen, schedule, ivec); - bcopy (ivec, temp_key, 8); + memcpy(temp_key, ivec, 8); des_fixup_key_parity (temp_key); des_key_sched (temp_key, schedule); des_cbc_cksum (password, key, passlen, schedule, ivec); @@ -158,7 +158,7 @@ afs_int32 ka_ReadPassword ( afs_int32 code; LOCK_GLOBAL_MUTEX - bzero (key, sizeof(struct ktc_encryptionKey)); + memset(key, 0, sizeof(struct ktc_encryptionKey)); code = read_pw_string (password, sizeof(password), prompt, verify); if (code) { UNLOCK_GLOBAL_MUTEX diff --git a/src/kauth/kadatabase.c b/src/kauth/kadatabase.c index 60da2df22..5ac1ccca8 100644 --- a/src/kauth/kadatabase.c +++ b/src/kauth/kadatabase.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kadatabase.c,v 1.1.1.4 2001/07/14 22:22:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kadatabase.c,v 1.1.1.5 2001/09/11 14:32:54 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -166,7 +166,7 @@ afs_int32 CheckInit (at, db_init) printf ("Error discovered in header, rebuilding.\n"); /* try to write a good header */ - bzero(&cheader,sizeof(cheader)); + memset(&cheader, 0, sizeof(cheader)); cheader.version = htonl(KADBVERSION); cheader.checkVersion = htonl(KADBVERSION); cheader.headerSize = htonl(sizeof(cheader)); @@ -208,7 +208,7 @@ afs_int32 AllocBlock (at, tentry) code = inc_header_word (at, stats.allocs); if (code) return 0; - bzero (tentry, sizeof(kaentry)); /* zero new entry */ + memset(tentry, 0, sizeof(kaentry)); /* zero new entry */ return temp; } @@ -224,7 +224,7 @@ afs_int32 FreeBlock (at, index) /* check index just to be on the safe side */ if (!index_OK (index)) return KABADINDEX; - bzero (&tentry, sizeof(kaentry)); + memset(&tentry, 0, sizeof(kaentry)); tentry.next = cheader.freePtr; tentry.flags = htonl(KAFFREE); code = set_header_word (at, freePtr, htonl(index)); @@ -444,7 +444,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) ((now - ntohl(okeys.keys[i].superseded) > maxKeyLifetime)) ) { okeys.keys[i].superseded = 0; okeys.keys[i].version = htonl(-1); - bzero(&okeys.keys[i].key, sizeof(struct ktc_encryptionKey)); + memset(&okeys.keys[i].key, 0, sizeof(struct ktc_encryptionKey)); modified = 1; es_Report ("Dropped oldkey %d seconds old with kvno %d\n", @@ -456,7 +456,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) if (!addednewkey && (okeys.keys[i].superseded == 0)) { okeys.keys[i].version = htonl(newkeyver); okeys.keys[i].superseded = htonl(NEVERDATE); - bcopy (key, &okeys.keys[i].key, sizeof(struct ktc_encryptionKey)); + memcpy(&okeys.keys[i].key, key, sizeof(struct ktc_encryptionKey)); modified = 1; addednewkey = okeysaddr; } @@ -498,7 +498,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) okeys.entry = htonl(tentryaddr); okeys.keys[0].version = htonl(newkeyver); okeys.keys[0].superseded = htonl(NEVERDATE); - bcopy (key, &okeys.keys[0].key, sizeof(struct ktc_encryptionKey)); + memcpy(&okeys.keys[0].key, key, sizeof(struct ktc_encryptionKey)); newtotalkeyentries++; /* Thread onto the header's chain of oldkeys */ @@ -525,7 +525,7 @@ afs_int32 ka_NewKey (tt, tentryaddr, tentry, key) tentry->misc.asServer.oldKeys = htonl(addednewkey); tentry->misc.asServer.nOldKeys = htonl(newtotalkeyentries); tentry->key_version = htonl(newkeyver); - bcopy (key, &tentry->key, sizeof (tentry->key)); + memcpy(&tentry->key, key, sizeof (tentry->key)); /* invalidate key caches everywhere */ code = inc_header_word (tt, specialKeysVersion); @@ -594,8 +594,8 @@ void ka_debugKeyCache (info) struct ka_debugInfo *info; { int i; - bcopy (&cheader_lock, &info->cheader_lock, sizeof (info->cheader_lock)); - bcopy (&keycache_lock, &info->keycache_lock, sizeof (info->keycache_lock)); + memcpy(&info->cheader_lock, &cheader_lock, sizeof (info->cheader_lock)); + memcpy(&info->keycache_lock, &keycache_lock, sizeof (info->keycache_lock)); info->kcVersion = keyCacheVersion; info->kcSize = maxCachedKeys; @@ -649,7 +649,7 @@ ka_Encache (name, inst, kvno, key, superseded) strncpy (keyCache[i].name, name, sizeof (keyCache[i].name)); strncpy (keyCache[i].inst, inst, sizeof (keyCache[i].inst)); keyCacheVersion = ntohl(cheader.specialKeysVersion); - bcopy (key, &keyCache[i].key, sizeof(*key)); + memcpy(&keyCache[i].key, key, sizeof(*key)); keyCache[i].superseded = superseded; keyCache[i].used = time(0); @@ -697,7 +697,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) if ((keyCache[i].kvno == kvno) && (strcmp(keyCache[i].name, name) == 0) && (strcmp(keyCache[i].inst, inst) == 0)) { - bcopy (&keyCache[i].key, key, sizeof(*key)); + memcpy(key, &keyCache[i].key, sizeof(*key)); keyCache[i].used = time(0); ReleaseReadLock (&keycache_lock); return 0; @@ -717,7 +717,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) /* first check the current key */ if (tentry.key_version == htonl(kvno)) { - bcopy (&tentry.key, key, sizeof(*key)); + memcpy(key, &tentry.key, sizeof(*key)); ka_Encache (name, inst, kvno, key, NEVERDATE); return 0; } @@ -728,7 +728,7 @@ afs_int32 ka_LookupKvno (tt, name, inst, kvno, key) for (i=0; i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaprocs.c,v 1.1.1.6 2001/07/14 22:22:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaprocs.c,v 1.1.1.7 2001/09/11 14:32:56 hartmans Exp $"); #include #include @@ -115,8 +115,8 @@ static afs_int32 get_time (timeP, tt, admin) if (nextAutoCPWTime == 0) { /* initialize things */ nextAutoCPWTime = time.tv_sec + autoCPWInterval; - bcopy (&time, &random_value[0], 8); - bcopy (&time, &random_value[2], 8); + memcpy(&random_value[0], &time, 8); + memcpy(&random_value[2], &time, 8); } if ((++totalUpdates >= autoCPWUpdates) && @@ -137,7 +137,7 @@ static afs_int32 get_time (timeP, tt, admin) if (code) return code; if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { - bcopy (&random_value[0], &key, sizeof(key)); + memcpy(&key, &random_value[0], sizeof(key)); des_fixup_key_parity (&key); code = set_password (tt, KA_ADMIN_NAME, KA_ADMIN_INST, &key, 0, 0); @@ -157,7 +157,7 @@ static afs_int32 get_time (timeP, tt, admin) if (code) return code; if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { - bcopy (&random_value[2], &key, sizeof(key)); + memcpy(&key, &random_value[2], sizeof(key)); des_fixup_key_parity (&key); code = set_password (tt, KA_TGS_NAME, lrealm, &key, 0, 0); if (code == 0) { @@ -518,7 +518,7 @@ static int create_user (tt, name, instance, key, caller, flags) if (code = ka_NewKey (tt, to, &tentry, key)) return code; } else { - bcopy(key, &tentry.key, sizeof(tentry.key)); + memcpy(&tentry.key, key, sizeof(tentry.key)); tentry.key_version = htonl(0); } tentry.user_expiration = htonl(NEVERDATE); @@ -669,9 +669,9 @@ afs_int32 ChangePassWord (call, aname, ainstance, arequest, oanswer) oanswer->SeqLen = answer_len; answer = oanswer->SeqBody; request.time = htonl (request_time+1); - bcopy ((char *)&request.time, answer, sizeof(Date)); + memcpy(answer, (char *)&request.time, sizeof(Date)); answer += sizeof(Date); - bcopy (KA_CPW_ANS_LABEL, answer, KA_LABELSIZE); + memcpy(answer, KA_CPW_ANS_LABEL, KA_LABELSIZE); des_pcbc_encrypt (oanswer->SeqBody, oanswer->SeqBody, answer_len, user_schedule, &tentry.key, ENCRYPT); @@ -720,7 +720,7 @@ impose_reuse_limits ( password, tentry ) if ((now - ntohl(tentry->change_password_time)) < MinHours*60*60) return KATOOSOON; - if (!bcmp(password, &(tentry->key), sizeof(EncryptionKey))) + if (!memcmp(password, &(tentry->key), sizeof(EncryptionKey))) return KAREUSED; code = ka_KeyCheckSum ((char *)password, &newsum); @@ -776,7 +776,7 @@ set_password (tt, name, instance, password, kvno, caller) if (code = ka_NewKey (tt, to, &tentry, password)) return(code); } else { - bcopy (password, &tentry.key, sizeof(tentry.key)); + memcpy(&tentry.key, password, sizeof(tentry.key)); if (!kvno) { kvno = ntohl(tentry.key_version); if ((kvno < 1) || (kvno >= MAXKAKVNO)) @@ -934,7 +934,7 @@ PrepareTicketAnswer answer = (struct ka_ticketAnswer *)oanswer->SeqBody; answer->challenge = htonl(challenge); - bcopy (sessionKey, &answer->sessionKey, sizeof(struct ktc_encryptionKey)); + memcpy(&answer->sessionKey, sessionKey, sizeof(struct ktc_encryptionKey)); answer->startTime = htonl(start); answer->endTime = htonl(end); answer->kvno = server->key_version; @@ -956,10 +956,10 @@ PrepareTicketAnswer putstr (server->userID.name); putstr (server->userID.instance); if (rem < ticketLen+KA_LABELSIZE) return code; - bcopy (ticket, ans, ticketLen); + memcpy(ans, ticket, ticketLen); ans += ticketLen; - if (label) bcopy (label, ans, KA_LABELSIZE); - else bzero (ans, KA_LABELSIZE); + if (label) memcpy(ans, label, KA_LABELSIZE); + else memset(ans, 0, KA_LABELSIZE); ans += KA_LABELSIZE; oanswer->SeqLen = (ans - oanswer->SeqBody); } @@ -1085,7 +1085,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, else { /* return our time if possible */ oanswer->SeqLen = sizeof(afs_int32); request.time = htonl(now); - bcopy (&request.time, oanswer->SeqBody, sizeof(afs_int32)); + memcpy(oanswer->SeqBody, &request.time, sizeof(afs_int32)); } #endif code = KACLOCKSKEW; @@ -1098,7 +1098,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, if (to == 0) {code = KANOENT; goto abort; } tgskvno = ntohl(server.key_version); - bcopy (&server.key, &tgskey, sizeof(tgskey)); + memcpy(&tgskey, &server.key, sizeof(tgskey)); code = des_random_key (&sessionKey); if (code) { @@ -1127,20 +1127,19 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, oanswer->SeqLen = answer_len; answer = oanswer->SeqBody; answer_time = htonl(request.time+1); - bcopy ((char *)&answer_time, answer, sizeof(Date)); + memcpy(answer, (char *)&answer_time, sizeof(Date)); answer += sizeof(Date); - bcopy ((char *)&sessionKey, answer, sizeof(struct ktc_encryptionKey)); + memcpy(answer, (char *)&sessionKey, sizeof(struct ktc_encryptionKey)); answer += sizeof(struct ktc_encryptionKey); temp = htonl(tgskvno); - bcopy ((char *)&temp, answer, sizeof(afs_int32)); + memcpy(answer, (char *)&temp, sizeof(afs_int32)); answer += sizeof(afs_int32); temp = htonl(ticketLen); - bcopy ((char *)&temp, answer, sizeof(afs_int32)); + memcpy(answer, (char *)&temp, sizeof(afs_int32)); answer += sizeof(afs_int32); - bcopy (ticket, answer, ticketLen); + memcpy(answer, ticket, ticketLen); answer += ticketLen; - bcopy ((tgt ? KA_GETTGT_ANS_LABEL : KA_GETADM_ANS_LABEL), answer, - KA_LABELSIZE); + memcpy(answer, (tgt ? KA_GETTGT_ANS_LABEL : KA_GETADM_ANS_LABEL), KA_LABELSIZE); break; case 1: case 2: @@ -1154,7 +1153,7 @@ static afs_int32 Authenticate (version, call, aname, ainstance, start, end, temp = pwexpires << 24; /* move it into the high byte */ pwexpires = htonl(temp); - bcopy (&pwexpires, (char * )oanswer->SeqBody + oanswer->SeqLen, sizeof(afs_int32)); + memcpy((char * )oanswer->SeqBody + oanswer->SeqLen, &pwexpires, sizeof(afs_int32)); oanswer->SeqLen += sizeof(afs_int32); oanswer->SeqLen = round_up_to_ebs(oanswer->SeqLen); if (oanswer->SeqLen > oanswer->MaxSeqLen) { @@ -1347,7 +1346,7 @@ afs_int32 kamSetFields (call, aname, ainstance, aflags, if (newvals[REUSEFLAGS]) { if (newvals[REUSEFLAGS] & KA_REUSEPW) - bzero(tentry.pwsums, KA_NPWSUMS); + memset(tentry.pwsums, 0, KA_NPWSUMS); else if ((newvals[REUSEFLAGS] & KA_NOREUSEPW) && !tentry.pwsums[0]) tentry.pwsums[0] = 0xff; } @@ -1527,7 +1526,7 @@ afs_int32 kamGetEntry (call, aname, ainstance, aversion, aentry) get_time (0,0,0); /* generate random update */ - bzero (aentry, sizeof(*aentry)); + memset(aentry, 0, sizeof(*aentry)); aentry->minor_version = KAMINORVERSION; aentry->flags = ntohl(tentry.flags); aentry->user_expiration = ntohl(tentry.user_expiration); @@ -1550,8 +1549,8 @@ afs_int32 kamGetEntry (call, aname, ainstance, aversion, aentry) rxkad_GetServerInfo(call->conn, &enc_level, 0, 0, 0, 0, 0); if ((noAuthenticationRequired) || (callerIsAdmin && enc_level == rxkad_crypt)) - bcopy (&tentry.key, &aentry->key, sizeof(struct ktc_encryptionKey)); - else bzero (&aentry->key, sizeof(aentry->key)); + memcpy(&aentry->key, &tentry.key, sizeof(struct ktc_encryptionKey)); + else memset(&aentry->key, 0, sizeof(aentry->key)); code = ka_KeyCheckSum ((char *)&tentry.key, &aentry->keyCheckSum); if (!tentry.pwsums[0] && npwSums > 1 && !tentry.pwsums[1]) { aentry->reserved3 = 0x12340000; @@ -1764,8 +1763,7 @@ static afs_int32 GetTicket (version, call, kvno, authDomain, aticket, sizeof(struct ka_getTicketAnswer) - 5*MAXKTCNAMELEN) goto abort; answer = (struct ka_getTicketAnswer *)oanswer->SeqBody; - bcopy (&sessionKey, &answer->sessionKey, - sizeof(struct ktc_encryptionKey)); + memcpy(&answer->sessionKey, &sessionKey, sizeof(struct ktc_encryptionKey)); answer->startTime = htonl(times.start); answer->endTime = htonl(end); answer->kvno = server.key_version; @@ -1788,7 +1786,7 @@ static afs_int32 GetTicket (version, call, kvno, authDomain, aticket, putstr (sname); putstr (sinstance); if (rem < ticketLen) goto abort; - bcopy (ticket, ans, ticketLen); + memcpy(ans, ticket, ticketLen); oanswer->SeqLen = (ans - oanswer->SeqBody) + ticketLen; } oanswer->SeqLen = round_up_to_ebs(oanswer->SeqLen); @@ -1891,7 +1889,7 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) } *admin_accounts = ntohl(cheader.admin_accounts); - /* bcopy ((char *)&cheader.stats, (char *)statics, sizeof(kasstats)); */ + /* memcpy((char *)statics, (char *)&cheader.stats, sizeof(kasstats)); */ /* these are stored in network byte order and must be copied */ statics->allocs = ntohl(cheader.stats.allocs); statics->frees = ntohl(cheader.stats.frees); @@ -1900,7 +1898,7 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) check that the statistics command copies all the fields #endif - bcopy ((char *)&dynamic_statistics, (char *)dynamics, sizeof(kadstats)); + memcpy((char *)dynamics, (char *)&dynamic_statistics, sizeof(kadstats)); statics->minor_version = KAMINORVERSION; dynamics->minor_version = KAMINORVERSION; @@ -1921,8 +1919,8 @@ afs_int32 kamGetStats (call, version, admin_accounts, statics, dynamics) * ignore this for aix till v3.1... */ getrusage(RUSAGE_SELF, &ru); #if (KAMAJORVERSION>5) - bcopy (&ru.ru_utime, &dynamics->utime, sizeof(struct katimeval)); - bcopy (&ru.ru_stime, &dynamics->stime, sizeof(struct katimeval)); + memcpy(&dynamics->utime, &ru.ru_utime, sizeof(struct katimeval)); + memcpy(&dynamics->stime, &ru.ru_stime, sizeof(struct katimeval)); dynamics->dataSize = ru.ru_idrss; dynamics->stackSize = ru.ru_isrss; dynamics->pageFailts = ru.ru_majflt; @@ -1984,7 +1982,7 @@ afs_int32 kamGetPassword (call, name, password) return code; } - bcopy (&tentry.key, password, sizeof (*password)); + memcpy(password, &tentry.key, sizeof (*password)); code = ubik_EndTrans (tt); #endif return code; @@ -2038,7 +2036,7 @@ afs_int32 kamDebug (call, version, checkDB, info) if (sizeof(struct ka_cpwRequest) % 8) return KAINTERNALERROR; if (version != KAMAJORVERSION) return KAOLDINTERFACE; - bzero (info, sizeof(*info)); + memset(info, 0, sizeof(*info)); info->minorVersion = KAMINORVERSION; info->host = dynamic_statistics.host; diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index d02c8395d..06c35809b 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaserver.c,v 1.1.1.6 2001/07/14 22:22:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaserver.c,v 1.1.1.7 2001/09/11 14:32:56 hartmans Exp $"); #include #include @@ -82,7 +82,7 @@ afs_int32 es_Report(char *fmt, ...) static void initialize_dstats () { - bzero (&dynamic_statistics, sizeof(dynamic_statistics)); + memset(&dynamic_statistics, 0, sizeof(dynamic_statistics)); dynamic_statistics.start_time = time(0); dynamic_statistics.host = myHost; } @@ -102,7 +102,7 @@ static int convert_cell_to_ubik (cellinfo, myHost, serverList) ViceLog(0, ("kaserver: couldn't get address of this host.\n")); exit(1); } - bcopy(th->h_addr,myHost,sizeof(afs_int32)); + memcpy(myHost, th->h_addr, sizeof(afs_int32)); for (i=0; inumServers; i++) if (cellinfo->hostAddr[i].sin_addr.s_addr != *myHost) { diff --git a/src/kauth/kautils.c b/src/kauth/kautils.c index 9125f4efd..199f389e7 100644 --- a/src/kauth/kautils.c +++ b/src/kauth/kautils.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kautils.c,v 1.1.1.5 2001/07/14 22:22:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kautils.c,v 1.1.1.6 2001/09/11 14:32:57 hartmans Exp $"); #include #include @@ -142,11 +142,11 @@ afs_int32 ka_KeyCheckSum ( afs_int32 code; *cksumP = 0; - bzero (block, 8); + memset(block, 0, 8); code = des_key_sched (key, s); if (code) return KABADKEY; des_ecb_encrypt (block, block, s, ENCRYPT); - bcopy (block, &cksum, sizeof(afs_int32)); + memcpy(&cksum, block, sizeof(afs_int32)); *cksumP = ntohl(cksum); return 0; } diff --git a/src/kauth/kdb.c b/src/kauth/kdb.c index 6ad83192e..bcb41b66b 100644 --- a/src/kauth/kdb.c +++ b/src/kauth/kdb.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kdb.c,v 1.1.1.4 2001/07/14 22:22:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kdb.c,v 1.1.1.5 2001/09/11 14:32:58 hartmans Exp $"); #include #include @@ -66,7 +66,7 @@ static cmdproc( fprintf(stderr, "%s: data came out corrupt\n", ti->data); continue; } - bcopy(data.dptr, &rdata, sizeof(kalog_elt)); + memcpy(&rdata, data.dptr, sizeof(kalog_elt)); printf("%s: last operation from host %x at %s", ti->data, rdata.host, ctime(&rdata.last_use)); } diff --git a/src/kauth/kkids.c b/src/kauth/kkids.c index 96958d249..db158f779 100644 --- a/src/kauth/kkids.c +++ b/src/kauth/kkids.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kkids.c,v 1.1.1.4 2001/07/14 22:22:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kkids.c,v 1.1.1.5 2001/09/11 14:32:58 hartmans Exp $"); #include #include @@ -95,7 +95,7 @@ static int simplify_name( * name (we know there is one) and splice in the symlink contents. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -147,7 +147,7 @@ static int find_me( simplify_name(orig_name, truename); } else { - bp = (char *) rindex(arg, '/'); + bp = (char *) strrchr(arg, '/'); if (bp) { orig_name[0] = '.'; orig_name[1] = '/'; @@ -182,7 +182,7 @@ static int find_me( /* * Find rightmost slash, if any. */ - bp = (char *) rindex(truename, '/'); + bp = (char *) strrchr(truename, '/'); if (bp) { /* * Found it. Designate everything before it as the parent directory, diff --git a/src/kauth/klog.c b/src/kauth/klog.c index 8e0e8dea9..d225d105e 100644 --- a/src/kauth/klog.c +++ b/src/kauth/klog.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/klog.c,v 1.1.1.4 2001/07/14 22:22:14 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/klog.c,v 1.1.1.5 2001/09/11 14:32:58 hartmans Exp $"); #include #include @@ -135,7 +135,7 @@ static char *getpipepass(void) static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -178,7 +178,7 @@ int CommandProc ( char *reason; /* string describing errors */ /* blow away command line arguments */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -345,7 +344,7 @@ bad_lifetime: code = ka_UserAuthenticateGeneral (KA_USERAUTH_VERSION + (dosetpag ? KA_USERAUTH_DOSETPAG2:0), pw->pw_name, instance, realm, passwd, lifetime, &password_expires, 0, &reason); - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); if (code) { if (!Silent) { fprintf (stderr, diff --git a/src/kauth/klogin.c b/src/kauth/klogin.c index 4702589b8..2b76696fe 100644 --- a/src/kauth/klogin.c +++ b/src/kauth/klogin.c @@ -21,7 +21,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/klogin.c,v 1.1.1.5 2001/07/14 22:22:14 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/klogin.c,v 1.1.1.6 2001/09/11 14:32:58 hartmans Exp $"); #if !defined(AFS_SUN_ENV) && !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) &&!defined(AFS_FBSD_ENV) #include @@ -80,7 +80,7 @@ int timeout = 60; char term[64]; struct passwd *pwd; -char *strcat(), *rindex(), *index(), *malloc(), *realloc(); +char *strcat(), *malloc(), *realloc(); static void timedout(void); static void showmotd(void); static void doremoteterm(char *term, struct sgttyb *tp); @@ -152,7 +152,7 @@ int main( quota(Q_SETUID, 0, 0, 0); /* create a dummy user */ - bzero (&nouser, sizeof(nouser)); + memset(&nouser, 0, sizeof(nouser)); nouser.pw_name = ""; nouser.pw_passwd = "*"; nouser.pw_dir = nouser.pw_shell = ""; @@ -218,7 +218,7 @@ int main( ttyn = ttyname(0); if (ttyn == (char *)0 || *ttyn == '\0') ttyn = "/dev/tty??"; - tty = rindex(ttyn, '/'); + tty = strrchr(ttyn, '/'); if (tty == NULL) tty = ttyn; else @@ -426,7 +426,7 @@ int main( setenv("USER=", pwd->pw_name, 1); setenv("PATH=", ":/usr/ucb:/bin:/usr/bin", 0); - if ((namep = rindex(pwd->pw_shell, '/')) == NULL) + if ((namep = strrchr(pwd->pw_shell, '/')) == NULL) namep = pwd->pw_shell; else namep++; @@ -577,13 +577,13 @@ static void doremoteterm( char *term, struct sgttyb *tp) { - register char *cp = index(term, '/'), **cpp; + register char *cp = strchr(term, '/'), **cpp; char *speed; if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++) diff --git a/src/kauth/knfs.c b/src/kauth/knfs.c index 3a3f66070..69887e277 100644 --- a/src/kauth/knfs.c +++ b/src/kauth/knfs.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/knfs.c,v 1.1.1.4 2001/07/14 22:22:15 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/knfs.c,v 1.1.1.5 2001/09/11 14:33:00 hartmans Exp $"); #include #include @@ -26,6 +26,13 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/knfs.c,v 1.1.1.4 2001/07/14 22:22 #include #include #include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #include #include #include @@ -73,7 +80,7 @@ char *sysname; pheader[5] = 1; /* NFS protocol exporter # */ /* copy stuff in */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); tp = space + sizeof(pheader); /* finally setup the pioctl call's parameters */ @@ -81,7 +88,7 @@ char *sysname; blob.in = space; blob.out_size = 0; blob.out = (char *) 0; - bcopy(&setp, tp, sizeof(afs_int32)); + memcpy(tp, &setp, sizeof(afs_int32)); tp += sizeof(afs_int32); strcpy(tp, sysname); blob.in_size += sizeof(afs_int32) + strlen(sysname) + 1; @@ -141,9 +148,9 @@ static GetTokens(ahost, auid) if (strcmp(clientName.name, "afs") != 0) continue; /* wrong ticket service */ /* copy stuff in */ - bcopy(pheader, tbuffer, sizeof(pheader)); + memcpy(tbuffer, pheader, sizeof(pheader)); tp = tbuffer + sizeof(pheader); - bcopy(&index, tp, sizeof(afs_int32)); + memcpy(tp, &index, sizeof(afs_int32)); tp += sizeof(afs_int32); iob.in = tbuffer; iob.in_size = sizeof(afs_int32) + sizeof(pheader); @@ -154,15 +161,15 @@ static GetTokens(ahost, auid) else if (code == 0) { /* check to see if this is the right cell/realm */ tp = tbuffer; - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of secret token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of secret token */ tktLen = temp; /* remember size of ticket */ tp += sizeof(afs_int32); stp = tp; /* remember where ticket is, for later */ tp += temp; /* skip ticket for now */ - bcopy(tp, &temp, sizeof(afs_int32)); /* get size of clear token */ + memcpy(&temp, tp, sizeof(afs_int32)); /* get size of clear token */ if (temp != sizeof(struct ClearToken)) return KTC_ERROR; tp += sizeof(afs_int32); /* skip length */ - bcopy(tp, &ct, temp); /* copy token for later use */ + memcpy(&ct, tp, temp); /* copy token for later use */ tp += temp; /* skip clear token itself */ tp += sizeof(afs_int32); /* skip primary flag */ /* tp now points to the cell name */ @@ -171,12 +178,12 @@ static GetTokens(ahost, auid) gotit = 1; maxLen = sizeof(token) - sizeof(struct ktc_token) + MAXKTCTICKETLEN; if (maxLen < tktLen) return KTC_TOOBIG; - bcopy(stp, token.ticket, tktLen); + memcpy(token.ticket, stp, tktLen); token.startTime = ct.BeginTimestamp; token.endTime = ct.EndTimestamp; if (ct.AuthHandle == -1) ct.AuthHandle = 999; token.kvno = ct.AuthHandle; - bcopy(ct.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)); + memcpy(&token.sessionKey, ct.HandShakeKey, sizeof(struct ktc_encryptionKey)); token.ticketLen = tktLen; if ((token.kvno == 999) || /* old style bcrypt ticket */ (ct.BeginTimestamp && /* new w/ prserver lookup */ @@ -242,7 +249,7 @@ afs_int32 auid; { pheader[5] = 1; /* NFS protocol exporter # */ /* copy stuff in */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); /* finally setup the pioctl call's parameters */ blob.in_size = sizeof(pheader); @@ -293,30 +300,30 @@ afs_int32 auid; { pheader[5] = 1; /* NFS protocol exporter # */ /* copy in the header */ - bcopy(pheader, space, sizeof(pheader)); + memcpy(space, pheader, sizeof(pheader)); tp = space + sizeof(pheader); /* copy in the size of the encrypted part */ - bcopy(&theTicket.ticketLen, tp, sizeof(afs_int32)); + memcpy(tp, &theTicket.ticketLen, sizeof(afs_int32)); tp += sizeof(afs_int32); /* copy in the ticket itself */ - bcopy(theTicket.ticket, tp, theTicket.ticketLen); + memcpy(tp, theTicket.ticket, theTicket.ticketLen); tp += theTicket.ticketLen; /* copy in "clear token"'s size */ temp = sizeof(struct ClearToken); - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* create the clear token and copy *it* in */ ct.AuthHandle = theTicket.kvno; /* where we hide the key version # */ - bcopy(&theTicket.sessionKey, ct.HandShakeKey, sizeof(ct.HandShakeKey)); + memcpy(ct.HandShakeKey, &theTicket.sessionKey, sizeof(ct.HandShakeKey)); ct.ViceId = auid; ct.BeginTimestamp = theTicket.startTime; ct.EndTimestamp = theTicket.endTime; - bcopy(&ct, tp, sizeof(ct)); + memcpy(tp, &ct, sizeof(ct)); tp += sizeof(ct); /* copy in obsolete primary flag */ temp = 0; - bcopy(&temp, tp, sizeof(afs_int32)); + memcpy(tp, &temp, sizeof(afs_int32)); tp += sizeof(afs_int32); /* copy in cell name, null terminated */ strcpy(tp, server.cell); @@ -350,7 +357,7 @@ afs_int32 arock; { printf("knfs: unknown host '%s'.\n", tp); return -1; } - bcopy(the->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, the->h_addr, sizeof(afs_int32)); uid = -1; if (as->parms[1].items) { code = util_GetInt32(tp = as->parms[1].items->data, &uid); diff --git a/src/kauth/kpasswd.c b/src/kauth/kpasswd.c index 64f38e4f3..1fe1e3c39 100644 --- a/src/kauth/kpasswd.c +++ b/src/kauth/kpasswd.c @@ -11,7 +11,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kpasswd.c,v 1.1.1.5 2001/07/14 22:22:15 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kpasswd.c,v 1.1.1.6 2001/09/11 14:33:00 hartmans Exp $"); #include #include @@ -140,7 +140,7 @@ static void getpipepass(gpbuf, len) { /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, len); + memset(gpbuf, 0, len); for(i=0;iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aNEWPASSWORD].items) { @@ -344,8 +343,7 @@ CommandProc (as, arock) foundNewPassword = 1; strncpy (npasswd, as->parms[aNEWPASSWORD].items->data, sizeof(npasswd)); - bzero (as->parms[aNEWPASSWORD].items->data, - strlen(as->parms[aNEWPASSWORD].items->data)); + memset(as->parms[aNEWPASSWORD].items->data, 0, strlen(as->parms[aNEWPASSWORD].items->data)); } if (!foundExplicitCell) strcpy (realm, lcell); @@ -365,9 +363,9 @@ CommandProc (as, arock) code = read_pass (passwd, sizeof(passwd), "Old password: ", 0); if (code || (strlen (passwd) == 0)) { if (code) code = KAREADPW; - bzero (&mitkey, sizeof(mitkey)); - bzero (&key, sizeof(key)); - bzero (passwd, sizeof(passwd)); + memset(&mitkey, 0, sizeof(mitkey)); + memset(&key, 0, sizeof(key)); + memset(passwd, 0, sizeof(passwd)); if (code) com_err (rn, code, "reading password"); exit (1); } @@ -404,7 +402,7 @@ CommandProc (as, arock) printf ("Mismatch - "); goto no_change; } - bzero (verify, sizeof(verify)); + memset(verify, 0, sizeof(verify)); } } if (code = password_bad (npasswd)) { /* assmt here! */ @@ -423,7 +421,7 @@ CommandProc (as, arock) #endif ka_StringToKey (npasswd, realm, &newkey); des_string_to_key(npasswd, &newmitkey); - bzero (npasswd, sizeof(npasswd)); + memset(npasswd, 0, sizeof(npasswd)); if (lexplicit) ka_ExplicitCell (realm, serverList); @@ -448,8 +446,8 @@ CommandProc (as, arock) strncpy (pass8, passwd, 8); pass8[8] = 0; ka_StringToKey (pass8, realm, &key); - bzero (pass8, sizeof(pass8)); - bzero (passwd, sizeof(passwd)); + memset(pass8, 0, sizeof(pass8)); + memset(passwd, 0, sizeof(passwd)); code = ka_GetAdminToken (pw->pw_name, instance, realm, &key, ADMIN_LIFETIME, &token, /*!new*/0); #ifdef notdef @@ -471,8 +469,8 @@ CommandProc (as, arock) dess2k=0; } - bzero (&mitkey, sizeof(mitkey)); - bzero (&key, sizeof(key)); + memset(&mitkey, 0, sizeof(mitkey)); + memset(&key, 0, sizeof(key)); if (code == KAUBIKCALL) com_err (rn, code, "(Authentication Server unavailable, try later)"); else if (code) { if (code == KABADREQUEST) @@ -488,8 +486,8 @@ CommandProc (as, arock) code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newmitkey); else code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newkey); - bzero (&newkey, sizeof(newkey)); - bzero (&newmitkey, sizeof(newmitkey)); + memset(&newkey, 0, sizeof(newkey)); + memset(&newmitkey, 0, sizeof(newmitkey)); if (code) { char * reason; reason = (char *) error_message(code); @@ -498,8 +496,8 @@ CommandProc (as, arock) else printf("Password changed.\n\n"); } } - bzero (&newkey, sizeof(newkey)); - bzero (&newmitkey, sizeof(newmitkey)); + memset(&newkey, 0, sizeof(newkey)); + memset(&newmitkey, 0, sizeof(newmitkey)); /* Might need to close down the ubik_Client connection */ if (conn) { @@ -513,8 +511,8 @@ CommandProc (as, arock) no_change: /* yuck, yuck, yuck */ if (code) com_err (rn, code, "getting new password"); no_change_no_msg: - bzero (&key, sizeof(key)); - bzero (npasswd, sizeof(npasswd)); + memset(&key, 0, sizeof(key)); + memset(npasswd, 0, sizeof(npasswd)); printf("Password for '%s' in cell '%s' unchanged.\n\n", pw->pw_name, cell); terminate_child(); exit (code ? code : 1); diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index 92553871b..009e8be33 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/krb_udp.c,v 1.1.1.8 2001/07/14 22:22:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/krb_udp.c,v 1.1.1.9 2001/09/11 14:33:00 hartmans Exp $"); #include #include @@ -85,12 +85,12 @@ char udptgsServerPrincipal[256]; #define putstr(name) if ((slen = strlen(name)) >= MAXKTCNAMELEN) return -1;\ else strcpy (answer, name), answer += slen+1 #define putint(num) num = htonl(num), \ - bcopy (&num, answer, sizeof(afs_int32)), \ + memcpy(answer, &num, sizeof(afs_int32)), \ answer += sizeof(afs_int32) #define getstr(name) if ((slen = strlen(packet)) >= sizeof(name)) return -1;\ strcpy (name, packet), packet += slen+1 -#define getint(num) bcopy (packet, &num, sizeof(afs_int32)), \ +#define getint(num) memcpy(&num, packet, sizeof(afs_int32)), \ num = ktohl (byteOrder, num), \ packet += sizeof(afs_int32) @@ -139,7 +139,7 @@ static afs_int32 create_cipher (cipher, cipherLen, sessionKey, sname, sinst, if (ticketLen > 255) return KAANSWERTOOLONG; if (kvno > 255) return KAANSWERTOOLONG; - bcopy (sessionKey, answer, sizeof(*sessionKey)); + memcpy(answer, sessionKey, sizeof(*sessionKey)); answer += sizeof(*sessionKey); putstr (sname); putstr (sinst); @@ -147,7 +147,7 @@ static afs_int32 create_cipher (cipher, cipherLen, sessionKey, sname, sinst, *answer++ = life; *answer++ = (unsigned char) kvno; *answer++ = (unsigned char) ticketLen; - bcopy (ticket, answer, ticketLen); + memcpy(answer, ticket, ticketLen); answer += ticketLen; putint (start); @@ -201,10 +201,10 @@ static afs_int32 create_reply (ans, name, inst, startTime, endTime, kvno, *answer++ = (unsigned char) kvno; { short w = (short) cipherLen; w = htons(w); - bcopy (&w, answer, sizeof(short)); + memcpy(answer, &w, sizeof(short)); answer += sizeof(short); } - bcopy (cipher, answer, cipherLen); + memcpy(answer, cipher, cipherLen); return 0; } @@ -322,7 +322,7 @@ afs_int32 UDP_Authenticate (ksoc, client, name, inst, startTime, endTime, sname, startTime + ntohl(tentry.max_ticket_lifetime)); if ((code = ka_LookupKey (tt, sname, sinst, &tgskvno, &tgskey)) || (code = tkt_MakeTicket (ticket, &ticketLen, &tgskey, - name, inst, "", + name, inst, lrealm, startTime, endTime, &sessionKey, htonl(client->sin_addr.s_addr), sname, sinst))) goto abort; @@ -358,6 +358,7 @@ afs_int32 UDP_Authenticate (ksoc, client, name, inst, startTime, endTime, sname, code = -1; goto fail; } + KALOG(name, inst, sname, sinst, NULL, client->sin_addr.s_addr, LOG_AUTHENTICATE); osi_audit ( UDPAuthenticateEvent, 0, AUD_STR, name, AUD_STR, inst, AUD_END); return 0; @@ -633,7 +634,7 @@ process_udp_auth (ksoc, pkt) "null realm name not allowed"); return; } - bcopy (packet, &startTime, sizeof(startTime)); + memcpy(&startTime, packet, sizeof(startTime)); packet += sizeof(startTime); startTime = ktohl (pkt->byteOrder, startTime); pkt->time = startTime; @@ -690,13 +691,13 @@ process_udp_appl (ksoc, pkt) err_packet (ksoc, pkt, KERB_ERR_TEXT_LENGTH, "ticket too long"); return; } - bcopy (packet, ticket, ticketLen); + memcpy(ticket, packet, ticketLen); packet += ticketLen; if (authLen > sizeof(auth)) { err_packet (ksoc, pkt, KERB_ERR_TEXT_LENGTH, "authenticator too long"); return; } - bcopy (packet, auth, authLen); + memcpy(auth, packet, authLen); pkt->rest = packet + authLen; code = UDP_GetTicket (ksoc, pkt, kvno, realm, ticket, ticketLen, auth, authLen); if (code) { @@ -825,7 +826,7 @@ afs_int32 init_krb_udp () if (inited) return -1; inited = 1; - bzero (&taddr, sizeof(taddr)); + memset(&taddr, 0, sizeof(taddr)); krb4name = "kerberos4"; sp = getservbyname(krb4name, "udp"); taddr.sin_family = AF_INET; /* added for NCR port */ diff --git a/src/kauth/manyklog.c b/src/kauth/manyklog.c index f153078c4..655754370 100644 --- a/src/kauth/manyklog.c +++ b/src/kauth/manyklog.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/manyklog.c,v 1.1.1.4 2001/07/14 22:22:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/manyklog.c,v 1.1.1.5 2001/09/11 14:33:01 hartmans Exp $"); #include #include @@ -131,7 +131,7 @@ static char *getpipepass() { static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -174,7 +174,7 @@ CommandProc (as, arock) char *reason; /* string describing errors */ /* blow away command line arguments */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { diff --git a/src/kauth/read_passwd.c b/src/kauth/read_passwd.c index 067d75c88..f8fd1af64 100644 --- a/src/kauth/read_passwd.c +++ b/src/kauth/read_passwd.c @@ -13,7 +13,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/read_passwd.c,v 1.1.1.3 2001/07/14 22:22:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/read_passwd.c,v 1.1.1.4 2001/09/11 14:33:01 hartmans Exp $"); #include #include @@ -74,7 +74,7 @@ des_read_password(k,prompt,verify) string_to_key(key_string, k); lose: - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); return ok; } @@ -137,7 +137,7 @@ read_pw_string(s,max,prompt,verify) } #ifdef BSDUNIX - bcopy(env, old_env, sizeof(env)); + memcpy(old_env, env, sizeof(env)); if (setjmp(env)) goto lose; @@ -204,14 +204,14 @@ read_pw_string(s,max,prompt,verify) lose: if (!ok) - bzero(s, max); + memset(s, 0, max); #ifdef BSDUNIX /* turn echo back on */ tty_state.sg_flags |= ECHO; if (ioctl(0,TIOCSETP,&tty_state)) ok = 0; pop_signals(); - bcopy(old_env, env, sizeof(env)); + memcpy(env, old_env, sizeof(env)); #else #if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) ttyb.c_lflag = flags; @@ -225,7 +225,7 @@ lose: #endif #endif if (verify) - bzero(key_string, sizeof (key_string)); + memset(key_string, 0, sizeof (key_string)); s[max-1] = 0; /* force termination */ return !ok; /* return nonzero if not okay */ } diff --git a/src/kauth/rebuild.c b/src/kauth/rebuild.c index c4fec651a..64cf2dff3 100644 --- a/src/kauth/rebuild.c +++ b/src/kauth/rebuild.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/rebuild.c,v 1.1.1.6 2001/07/14 22:22:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/rebuild.c,v 1.1.1.7 2001/09/11 14:33:02 hartmans Exp $"); #include #include @@ -414,7 +414,7 @@ WorkerBee (as, arock) nentries = (info.st_size-(UBIK_HEADERSIZE + header.headerSize)) / sizeof(struct kaentry); entrys = (int *)malloc(nentries * sizeof(int)); - bzero(entrys, nentries * sizeof(int)); + memset(entrys, 0, nentries * sizeof(int)); for (i=0, index=sizeof(header); i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/multiklog.c,v 1.1.1.4 2001/07/14 22:22:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/multiklog.c,v 1.1.1.5 2001/09/11 14:33:03 hartmans Exp $"); #include #include @@ -108,7 +108,7 @@ static char *getpipepass() { static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -153,7 +153,7 @@ CommandProc (as, arock) char *reason; /* string describing errors */ /* blow away command line arguments */ - for (i=1; iparms[aPASSWORD].items->data, sizeof(passwd)); - bzero (as->parms[aPASSWORD].items->data, - strlen(as->parms[aPASSWORD].items->data)); + memset(as->parms[aPASSWORD].items->data, 0, strlen(as->parms[aPASSWORD].items->data)); } if (as->parms[aLIFETIME].items) { @@ -318,7 +317,7 @@ bad_lifetime: } code = storecode; - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); if (code) { if (!Silent) { fprintf (stderr, diff --git a/src/kauth/test/test_badtix.c b/src/kauth/test/test_badtix.c index 7fa0901a6..056a74b98 100644 --- a/src/kauth/test/test_badtix.c +++ b/src/kauth/test/test_badtix.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_badtix.c,v 1.1.1.4 2001/07/14 22:22:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_badtix.c,v 1.1.1.5 2001/09/11 14:33:03 hartmans Exp $"); #include #include @@ -327,7 +327,7 @@ int main (argc, argv) password[truncate[i]] = 0; ka_StringToKey (password, "andy.edu", &key); ka_ReadBytes (answer[i], &correct_key, sizeof(key)); - if (bcmp (&key, &correct_key, sizeof(key)) != 0) { + if (memcmp (&key, &correct_key, sizeof(key)) != 0) { printf ("String to key error converting '%s'; should be '%s' instead got '", password, answer[i]); ka_PrintBytes (&key, sizeof(key)); @@ -335,7 +335,7 @@ int main (argc, argv) exit (1); } } - bzero (password, sizeof(password)); + memset(password, 0, sizeof(password)); j=0; /* current password length */ for (i=(sizeof(truncate)/sizeof(int))-1; i>=0; i--) { while (j #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_getticket.c,v 1.1.1.4 2001/07/14 22:22:20 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_getticket.c,v 1.1.1.5 2001/09/11 14:33:04 hartmans Exp $"); #include #include @@ -266,7 +266,7 @@ static long Main (as, arock) if (as->parms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[sizeof(name)+15]; if (as->parms[12].items) strcpy (msg, "Admin Password: "); diff --git a/src/kauth/test/test_interim_ktc.c b/src/kauth/test/test_interim_ktc.c index 1aeff22fb..7905cd101 100644 --- a/src/kauth/test/test_interim_ktc.c +++ b/src/kauth/test/test_interim_ktc.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_interim_ktc.c,v 1.1.1.4 2001/07/14 22:22:20 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_interim_ktc.c,v 1.1.1.5 2001/09/11 14:33:05 hartmans Exp $"); #include #include @@ -234,9 +234,9 @@ static int CheckAuth2 (server) /*Copy in the sizes and bodies of the secret and clear tokens*/ inbuff.sTokenSize = sizeof(EncryptedSecretToken); - bcopy(&sToken, (char *)&inbuff.stoken, sizeof(EncryptedSecretToken)); + memcpy((char *)&inbuff.stoken, &sToken, sizeof(EncryptedSecretToken)); inbuff.cTokenSize = sizeof(ClearToken); - bcopy(&cToken, (char*)&inbuff.ctoken, sizeof(ClearToken)); + memcpy((char*)&inbuff.ctoken, &cToken, sizeof(ClearToken)); /* Copy in the Primary ID flag and the cell name */ #if DB_CELLS @@ -271,8 +271,8 @@ static int CheckAuth2 (server) (token.startTime != 0) || (token.endTime != cToken.EndTimestamp) || (token.ticketLen != sizeof(sToken)) || - (bcmp (&cToken.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)) != 0) || - (bcmp (&sToken, token.ticket, sizeof(sToken)) != 0)) { + (memcmp (&cToken.HandShakeKey, &token.sessionKey, sizeof(struct ktc_encryptionKey)) != 0) || + (memcmp (&sToken, token.ticket, sizeof(sToken)) != 0)) { fprintf (stdout, "Auth2 token was bad\n"); PrintAuthentication (stdout, server, &token, &client); return 1; @@ -302,7 +302,7 @@ static void ListCellsCmd () blob.in_size = sizeof(long); blob.in = space; blob.out = space; - bcopy(&i, space, sizeof(long)); + memcpy(space, &i, sizeof(long)); code = pioctl(0, VIOCGETCELL, &blob, 1); if (code < 0) { if (errno == EDOM) break; /* done with the list */ @@ -315,7 +315,7 @@ static void ListCellsCmd () if (verbose > 1) { printf("Cell %s on hosts", cellname); for (j=0; j < 8; j++) { - bcopy(space + j*sizeof(long), &clear, sizeof(long)); + memcpy(&clear, space + j*sizeof(long), sizeof(long)); if (clear == 0) break; #if SLOW tcp = hostutil_GetNameByINet(clear); @@ -820,7 +820,7 @@ main (argc, argv) /* First check for various pathological cases */ strcpy (server.cell, "foo.bar.baz"); - bcopy (&token, &ntoken, sizeof(ntoken)); + memcpy(&ntoken, &token, sizeof(ntoken)); code = ktc_SetToken (&server, &ntoken, &client, 0); if (code != KTC_NOCELL) { com_err (whoami, code, "should have gotten bad pioctl error calling SetToken with bogus cell name"); @@ -849,7 +849,7 @@ main (argc, argv) com_err (whoami, code, "calling SetToken with bogus client cell"); goto failed; } - bcopy (&token, &ntoken, sizeof(ntoken)); + memcpy(&ntoken, &token, sizeof(ntoken)); if (token.kvno == 999) ntoken.kvno = 99; /* Now check out SetToken parsing of specially formed names */ diff --git a/src/kauth/test/test_rxkad_free.c b/src/kauth/test/test_rxkad_free.c index 68856501d..95516417f 100644 --- a/src/kauth/test/test_rxkad_free.c +++ b/src/kauth/test/test_rxkad_free.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_rxkad_free.c,v 1.1.1.4 2001/07/14 22:22:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/test/test_rxkad_free.c,v 1.1.1.5 2001/09/11 14:33:05 hartmans Exp $"); #include #include @@ -140,7 +140,7 @@ static long Main (as, arock) if (as->parms[13].items) { /* if password specified */ strncpy (passwd, as->parms[13].items->data, sizeof(passwd)); - bzero (as->parms[13].items->data, strlen (as->parms[13].items->data)); + memset(as->parms[13].items->data, 0, strlen (as->parms[13].items->data)); } else { char msg[sizeof(name)+15]; if (as->parms[12].items) strcpy (msg, "Admin Password: "); @@ -171,11 +171,11 @@ static long Main (as, arock) if (!doAuth) { ka_StringToKey (passwd, cell, &key); - bzero (passwd, sizeof(passwd)); + memset(passwd, 0, sizeof(passwd)); } if (hostUsage) { - bzero (serversUse, sizeof(serversUse)); - bzero (serversHost, sizeof(serversHost)); + memset(serversUse, 0, sizeof(serversUse)); + memset(serversHost, 0, sizeof(serversHost)); } startTime = time(0); diff --git a/src/kauth/user.c b/src/kauth/user.c index 75f6bb107..8cca463ea 100644 --- a/src/kauth/user.c +++ b/src/kauth/user.c @@ -17,7 +17,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/user.c,v 1.1.1.6 2001/07/14 22:22:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/user.c,v 1.1.1.7 2001/09/11 14:33:02 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -71,7 +71,7 @@ afs_int32 GetTickets ( struct ktc_token token; code = ka_GetAuthToken (name, instance, realm, key, lifetime, pwexpires); - bzero (key, sizeof(*key)); + memset(key, 0, sizeof(*key)); if (code) return code; code = ka_GetAFSTicket (name, instance, realm, lifetime, flags); return code; @@ -238,7 +238,7 @@ afs_int32 ka_UserAuthenticateGeneral ( strncpy (pass8, password, 8); pass8[8] = 0; ka_StringToKey (pass8, realm, &key); - bzero (pass8, sizeof(pass8)); + memset(pass8, 0, sizeof(pass8)); code = GetTickets (name, instance, realm, &key, lifetime, password_expires, dosetpag); if (code == 0) { diff --git a/src/kauth/user_nt.c b/src/kauth/user_nt.c index 29abf1cd3..1efc0e72d 100644 --- a/src/kauth/user_nt.c +++ b/src/kauth/user_nt.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/user_nt.c,v 1.1.1.5 2001/07/14 22:22:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/user_nt.c,v 1.1.1.6 2001/09/11 14:33:02 hartmans Exp $"); #include @@ -49,6 +49,8 @@ static char *ka_MapKerberosError(int code) return "server and client clocks are badly skewed"; case SKDC_RETRY: return "Authentication Server was unavailable"; + case RD_AP_TIME: + return "server and client clocks are badly skewed"; default: sprintf(bogusReason, "unknown authentication error %d", code); diff --git a/src/libacl/aclprocs.c b/src/libacl/aclprocs.c index 9673d68f1..2377a4c13 100644 --- a/src/libacl/aclprocs.c +++ b/src/libacl/aclprocs.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.5 2001/07/14 22:22:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.6 2001/09/11 14:33:06 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -24,6 +24,9 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.5 2001/07/14 #else #include #endif +#ifdef HAVE_STRING_H +#include +#endif #include #include #include @@ -38,10 +41,6 @@ pthread_mutex_t acl_list_mutex; static int AddToList(); static int GetFromList(); -#ifdef AFS_ALPHA_ENV -extern char *index(); -#endif - struct freeListEntry { struct freeListEntry *next; int size; @@ -177,7 +176,7 @@ char **elist; acl_NewExternalACL(acl->total, elist); nextc = *elist; lids.idlist_val = (afs_int32 *)malloc(ACL_MAXENTRIES *sizeof(afs_int32)); - bzero(lids.idlist_val, ACL_MAXENTRIES * sizeof(afs_int32)); + memset(lids.idlist_val, 0, ACL_MAXENTRIES * sizeof(afs_int32)); lids.idlist_len = acl->total; lnames.namelist_len = 0; lnames.namelist_val = (prname *)0; @@ -252,14 +251,14 @@ struct acl_accessList **acl; if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[i], &k) != 2) return(-1); (*acl)->entries[i].rights = k; - nextc = (char *) (index(nextc, '\n')); + nextc = strchr(nextc, '\n'); nextc ++; /* 1 + index can cast ptr to integer */ } j=i; for (i = (*acl)->total - 1; i >= (*acl)->total - (*acl)->negative; i--,j++) { if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[j], &((*acl)->entries[j].rights)) != 2) return(-1); - nextc = (char *) (index(nextc, '\n')); + nextc = strchr(nextc, '\n'); nextc ++; } lids.idlist_len = 0; diff --git a/src/libadmin/bos/afs_bosAdmin.c b/src/libadmin/bos/afs_bosAdmin.c index 2db117077..dd33f4151 100644 --- a/src/libadmin/bos/afs_bosAdmin.c +++ b/src/libadmin/bos/afs_bosAdmin.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/bos/afs_bosAdmin.c,v 1.1.1.6 2001/07/14 22:22:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/bos/afs_bosAdmin.c,v 1.1.1.7 2001/09/11 14:33:08 hartmans Exp $"); #include #include @@ -3112,7 +3112,7 @@ int ADMINAPI bos_ExecutableRestartTimeSet( restartTime.sec = time.sec; restartTime.day = time.day; - tst = BOZO_SetRestartTime(b_handle->server, restartType, restartTime); + tst = BOZO_SetRestartTime(b_handle->server, restartType, &restartTime); if (tst == 0) { rc = 1; diff --git a/src/libadmin/client/afs_clientAdmin.c b/src/libadmin/client/afs_clientAdmin.c index 5a2ebada0..eb88a5929 100644 --- a/src/libadmin/client/afs_clientAdmin.c +++ b/src/libadmin/client/afs_clientAdmin.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/client/afs_clientAdmin.c,v 1.1.1.6 2001/07/14 22:22:31 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/client/afs_clientAdmin.c,v 1.1.1.7 2001/09/11 14:33:12 hartmans Exp $"); #include #include "afs_clientAdmin.h" @@ -1260,7 +1260,7 @@ static int Parent( int rc = 0; strcpy(parentDirectory, directory); - tp = rindex(parentDirectory, '/'); + tp = strrchr(parentDirectory, '/'); if (tp) { *tp = 0; rc = 1; diff --git a/src/libadmin/test/bos.c b/src/libadmin/test/bos.c index 33cba4a3e..720690b88 100644 --- a/src/libadmin/test/bos.c +++ b/src/libadmin/test/bos.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/test/bos.c,v 1.1.1.4 2001/07/14 22:22:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/test/bos.c,v 1.1.1.5 2001/09/11 14:33:18 hartmans Exp $"); #include "bos.h" @@ -203,7 +203,7 @@ int ktime_ParsePeriodic( register afs_int32 code; struct ptemp *tp; - bzero(ak, sizeof(*ak)); + memset(ak, 0, sizeof(*ak)); code = LocalParseLine(adate, &tt); if (code) return -1; for(;tt;tt=tt->next) { diff --git a/src/libadmin/vos/afs_vosAdmin.c b/src/libadmin/vos/afs_vosAdmin.c index 0dcebcf26..6b9c9c16d 100644 --- a/src/libadmin/vos/afs_vosAdmin.c +++ b/src/libadmin/vos/afs_vosAdmin.c @@ -10,15 +10,15 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/afs_vosAdmin.c,v 1.1.1.5 2001/07/14 22:22:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/afs_vosAdmin.c,v 1.1.1.6 2001/09/11 14:33:21 hartmans Exp $"); #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include diff --git a/src/libadmin/vos/lockprocs.c b/src/libadmin/vos/lockprocs.c index 4bc5e3c4d..907922f29 100644 --- a/src/libadmin/vos/lockprocs.c +++ b/src/libadmin/vos/lockprocs.c @@ -10,14 +10,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/lockprocs.c,v 1.1.1.5 2001/07/14 22:22:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/lockprocs.c,v 1.1.1.6 2001/09/11 14:33:22 hartmans Exp $"); #include "lockprocs.h" -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif diff --git a/src/libadmin/vos/vosutils.c b/src/libadmin/vos/vosutils.c index 12c92d013..a47c3bddc 100644 --- a/src/libadmin/vos/vosutils.c +++ b/src/libadmin/vos/vosutils.c @@ -10,17 +10,17 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/vosutils.c,v 1.1.1.5 2001/07/14 22:22:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/vosutils.c,v 1.1.1.6 2001/09/11 14:33:23 hartmans Exp $"); #include "vosutils.h" #include "vsprocs.h" #include "lockprocs.h" #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif @@ -45,7 +45,7 @@ static int OldVLDB_to_NewVLDB( int rc = 0; afs_status_t tst = 0; - bzero(dest, sizeof(struct nvldbentry)); + memset(dest, 0, sizeof(struct nvldbentry)); strncpy(dest->name, source->name, sizeof(dest->name)); for (i = 0; i < source->nServers; i++) { dest->serverNumber[i] = source->serverNumber[i]; @@ -81,7 +81,7 @@ static int NewVLDB_to_OldVLDB( afs_status_t tst = 0; int rc = 0; - bzero(dest, sizeof(struct vldbentry)); + memset(dest, 0, sizeof(struct vldbentry)); strncpy(dest->name, source->name, sizeof(dest->name)); if (source->nServers <= OMAXNSERVERS) { for (i = 0; i < source->nServers; i++) { @@ -358,11 +358,11 @@ int VLDB_IsSameAddrs( goto fail_VLDB_IsSameAddrs; } - bzero(&attrs, sizeof(attrs)); + memset(&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_IPADDR; attrs.ipaddr = serv1; - bzero(&addrs, sizeof(addrs)); - bzero(&uuid, sizeof(uuid)); + memset(&addrs, 0, sizeof(addrs)); + memset(&uuid, 0, sizeof(uuid)); tst = ubik_Call(VL_GetAddrsU, cellHandle->vos, 0, &attrs, &uuid, &unique, &nentries, &addrs); if (tst) { diff --git a/src/libadmin/vos/vsprocs.c b/src/libadmin/vos/vsprocs.c index 74abe9686..6bc1b404f 100644 --- a/src/libadmin/vos/vsprocs.c +++ b/src/libadmin/vos/vsprocs.c @@ -21,7 +21,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/vsprocs.c,v 1.1.1.5 2001/07/14 22:22:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/vsprocs.c,v 1.1.1.6 2001/09/11 14:33:23 hartmans Exp $"); #include "vsprocs.h" #include "vosutils.h" @@ -29,11 +29,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/libadmin/vos/vsprocs.c,v 1.1.1.5 2001/0 #include "../adminutil/afs_AdminInternal.h" #include #include "afs_vosAdmin.h" -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H @@ -1468,8 +1468,8 @@ int UV_ReleaseVolume( int releasecount = 0; struct volser_status volstatus; - bzero((char *)remembertime, sizeof(remembertime)); - bzero((char *)&results, sizeof(results)); + memset((char *)remembertime, 0, sizeof(remembertime)); + memset((char *)&results, 0, sizeof(results)); tst = ubik_Call(VL_SetLock, cellHandle->vos, 0, afromvol, RWVOL, VLOP_RELEASE); if ((tst) && (tst != VL_RERELEASE)) { @@ -1675,7 +1675,7 @@ int UV_ReleaseVolume( strcpy(vname, entry.name); strcat(vname, ".readonly"); - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); strncpy(cookie.name, vname, VOLSER_OLDMAXVOLNAME); cookie.type = ROVOL; cookie.parent = entry.volumeId[RWVOL]; @@ -1691,10 +1691,10 @@ int UV_ReleaseVolume( goto fail_UV_ReleaseVolume; } - bzero (replicas, (sizeof(struct replica)*nservers+1)); - bzero (times, (sizeof(struct release)*nservers+1)); - bzero (toconns, (sizeof(struct rx_connection *)*nservers+1)); - bzero (results.manyResults_val, (sizeof(afs_int32)*nservers+1)); + memset(replicas, 0, (sizeof(struct replica)*nservers+1)); + memset(times, 0, (sizeof(struct release)*nservers+1)); + memset(toconns, 0, (sizeof(struct rx_connection *)*nservers+1)); + memset(results.manyResults_val, 0, (sizeof(afs_int32)*nservers+1)); /* Create a transaction on the cloned volume */ tst = AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid); @@ -2249,7 +2249,7 @@ int UV_RestoreVolume( int index, same; - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); islocked = 0; success = 0; error = 0; @@ -2922,7 +2922,7 @@ static afs_int32 ProcessEntries( } else if(tst && (tst == VL_NOENT)) { /*entry doesnot exist */ /*set up a vldb entry for elem */ - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); strncpy(entry.name,elem.name,VOLSER_OLDMAXVOLNAME); if(elem.isValid[RWVOL]) { /*rw exists */ entry.flags |= RW_EXISTS; @@ -3512,7 +3512,7 @@ int UV_SyncServer( for(si = 0;si != -1; si=nsi) { /*initialize to hint the stub to alloc space */ - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); if (!VLDB_ListAttributes(cellHandle, &attributes, &nentries, &arrayEntries, &tst)) { goto fail_UV_SyncServer; diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in index 48d3fff43..0d7c3ab4e 100644 --- a/src/libafs/MakefileProto.AIX.in +++ b/src/libafs/MakefileProto.AIX.in @@ -7,9 +7,25 @@ # MakefileProto for AIX systems # - -DESTDIR=DEST/ -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: AFS_OS_OBJS = \ @@ -23,7 +39,8 @@ AFS_OS_OBJS = \ osi_timeout.o \ osi_vm.o \ xdr.o \ - xdr_array.o + xdr_array.o \ + xdr_int64.o AFSNOIAUTHOBJS = \ afs_call.o \ @@ -48,7 +65,7 @@ OPT2 = -O IMPORTS = -bI:/lib/kernex.exp -bI:/lib/syscalls.exp -bI:/lib/sockets.exp \ -bI:/lib/netinet.exp \ - -bI:${DESTDIR}lib/afs/extras.exp -bI:${DESTDIR}lib/afs/export.exp + -bI:${TOP_LIBDIR}/extras.exp -bI:${TOP_LIBDIR}/export.exp KDEFS = -U_IBMR2 -D_POWER -D_AIX -DNLS -D_NLS -DMSG -D__STR31__ -Daiws \ -D_POWER_RS -D_POWER_PC -D_POWER_RS1 -D_POWER_RS2 -D_POWER_RSC \ -D_POWER_601 -D_POWER_603 -D_POWER_604 -D_THREADS -M -D_KERNEL \ @@ -56,7 +73,7 @@ KDEFS = -U_IBMR2 -D_POWER -D_AIX -DNLS -D_NLS -DMSG -D__STR31__ -Daiws \ -DGETMOUNT -H8 -DAFS -DAFS_COMMON -D_VOPS -D_SUN -DKERNEL LDSTUFF= -b"binder:/usr/lib/bind glink:/usr/lib/glink.o" -bnoentry -b h:4 \ -D0 -T512 -LDFLAGS = -m -eafs_config -bexport:${DESTDIR}/lib/afs/afs.exp ${IMPORTS} \ +LDFLAGS = -m -eafs_config -bexport:${TOP_LIBDIR}/afs.exp ${IMPORTS} \ -lsys -lcsys CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(KDEFS) $(KOPTS) ${DBUG} @@ -66,15 +83,18 @@ KOBJ = MODLOAD # This tells Makefile.common to use it's single directory build target. COMPDIRS = single_compdir +INSTDIRS = single_instdir +DESTDIRS = single_destdir include Makefile.common setup: -mkdir $(KOBJ) - -rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common + -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config ln -s ../Makefile $(KOBJ)/Makefile ln -s ../Makefile.common $(KOBJ)/Makefile.common - -rm -f h net netinet rpc ufs nfs machine sys + ln -s ../config $(KOBJ)/config + -$(RM) -f h net netinet rpc ufs nfs machine sys ln -s /usr/include/sys h ln -s /usr/include/net net ln -s /usr/include/netinet netinet @@ -84,21 +104,20 @@ setup: ln -s /usr/include/jfs ufs - - - # Standard AFS->NFS translator support is removed in AFS 3.5 in favor of # the iauth authentication mechanism. The model was changed by IBM in the # middle of an OS release. So iauth is only supported on AIX 4.1.5 and # later 4.1.x (if they are ever made) and AIX 4.2.1 (and later AIX 4.2.x if # they are ever made. AIX 4.3 also uses the iauth translator. -CLIENTDIR = $(DESTDIR)root.client/usr/vice/etc/dkload LIBAFSIAUTH = afs.ext.iauth LIBAFS = afs.ext -DEST_LIBAFSIAUTH = $(CLIENTDIR)/$(LIBAFSIAUTH) -DEST_LIBAFS = $(CLIENTDIR)/$(LIBAFS) +DEST_LIBAFSIAUTH = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFSIAUTH) +DEST_LIBAFS = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFS) + +INST_LIBAFSIAUTH = ${DESTDIR}${afskerneldir}/$(LIBAFSIAUTH) +INST_LIBAFS = ${DESTDIR}${afskerneldir}/$(LIBAFS) $(DEST_LIBAFS): $(LIBAFS) $(INSTALL) -f $? $@ @@ -110,63 +129,74 @@ $(DEST_LIBAFSIAUTH): $(LIBAFSIAUTH) -${STRIP} $@ $(INSTALL) -f $?.map $@.map +$(INST_LIBAFS): $(LIBAFS) + $(INSTALL) -f $? $@ + -${STRIP} $@ + $(INSTALL) -f $?.map $@.map + +$(INST_LIBAFSIAUTH): $(LIBAFSIAUTH) + $(INSTALL) -f $? $@ + -${STRIP} $@ + $(INSTALL) -f $?.map $@.map $(LIBAFSIAUTH): $(AFSAOBJS) $(AFSIAUTHOBJS) - ${LD} ${LDSTUFF} -bloadmap:afs.ext.iauth.loadmap \ + ${LD} ${LDSTUFF} -bloadmap:afs.ext.iauth.loadmap \ -bmap:afs.ext.iauth.map -o afs.ext.iauth \ ${AFSAOBJS} ${AFSIAUTHOBJS} ${LIBS} ${LDFLAGS} $(LIBAFS): $(AFSAOBJS) $(AFSNOIAUTHOBJS) - ${LD} ${LDSTUFF} -bloadmap:afs.ext.loadmap \ + ${LD} ${LDSTUFF} -bloadmap:afs.ext.loadmap \ -bmap:afs.ext.map -o afs.ext \ ${AFSAOBJS} $(AFSNOIAUTHOBJS) ${LIBS} ${LDFLAGS} -libafs: $(DEST_LIBAFS) $(DEST_LIBAFSIAUTH) +libafs: $(LIBAFS) $(LIBAFSIAUTH) +install_libafs: $(INST_LIBAFS) $(INST_LIBAFSIAUTH) +dest_libafs: $(DEST_LIBAFS) $(DEST_LIBAFSIAUTH) # Object build rules: # Common objects xdr.o: $(RX)/xdr.c - $(CRULE1); + $(CRULE1) xdr_int64.o: $(RX)/xdr_int64.c - $(CRULE1); + $(CRULE1) xdr_array.o: $(RX)/xdr_array.c - $(CRULE1); + $(CRULE1) osi_assem.o: ${AFS}/osi_assem.s ${AS} -o osi_assem.o ${AFS}/osi_assem.s osi_config.o: $(AFS)/osi_config.c - $(CRULE1); + $(CRULE1) osi_groups.o: $(AFS)/osi_groups.c - $(CRULE1); + $(CRULE1) osi_file.o: $(AFS)/osi_file.c - $(CRULE1); + $(CRULE1) osi_inode.o: $(AFS)/osi_inode.c - $(CRULE1); + $(CRULE1) osi_misc.o: $(AFS)/osi_misc.c - $(CRULE1); + $(CRULE1) osi_sleep.o: $(AFS)/osi_sleep.c - $(CRULE1); + $(CRULE1) osi_timeout.o: $(AFS)/osi_timeout.c - $(CRULE1); + $(CRULE1) osi_vfsops.o: $(AFS)/osi_vfsops.c - $(CRULE1); + $(CRULE1) osi_vm.o: $(AFS)/osi_vm.c - $(CRULE1); + $(CRULE1) osi_vnodeops.o: $(AFS)/osi_vnodeops.c - $(CRULE1); + $(CRULE1) # Build rules for iauth objects. afs_call_iauth.o: $(AFS)/afs_call.c - $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_call_iauth.o; + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_call_iauth.o afs_nfsclnt_iauth.o: $(AFS)/afs_nfsclnt.c - $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_nfsclnt_iauth.o; + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_nfsclnt_iauth.o afs_pioctl_iauth.o: $(AFS)/afs_pioctl.c - $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_pioctl_iauth.o; + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_pioctl_iauth.o osi_vfsops_iauth.o: $(AFS)/osi_vfsops.c - $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vfsops_iauth.o; + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vfsops_iauth.o osi_vnodeops_iauth.o: $(AFS)/osi_vnodeops.c - $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vnodeops_iauth.o; + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vnodeops_iauth.o diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in index 39ff8f8d6..91315c3b1 100644 --- a/src/libafs/MakefileProto.DARWIN.in +++ b/src/libafs/MakefileProto.DARWIN.in @@ -1,11 +1,27 @@ #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */ -# $Header: /tmp/cvstemp/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.1 2001/07/05 01:03:17 hartmans Exp $ +# $Header: /tmp/cvstemp/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.1.1.2 2001/09/11 14:33:26 hartmans Exp $ # # MakefileProto for Digital Unix systems # - -DESTDIR=DEST/ -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: @@ -19,7 +35,8 @@ AFS_OS_OBJS = \ osi_vnodeops.o \ osi_module.o \ xdr.o \ - xdr_array.o + xdr_array.o \ + xdr_int64.o #AFS_OS_NFSOBJS = osi_vfsops_nfs.o @@ -44,15 +61,18 @@ KOBJ = MODLOAD # This tells Makefile.common to use it's single directory build target. COMPDIRS = single_compdir +INSTDIRS = single_instdir +DESTDIRS = single_destdir include Makefile.common setup: -mkdir $(KOBJ) - -rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common + -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config ln -s ../Makefile $(KOBJ)/Makefile ln -s ../Makefile.common $(KOBJ)/Makefile.common - -rm -f h net netinet rpc ufs nfs machine sys vm mach kern + ln -s ../config $(KOBJ)/config + -$(RM) -f h net netinet rpc ufs nfs machine sys vm mach kern -ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/net net -ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/machine machine -ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/netinet netinet @@ -67,12 +87,22 @@ setup: LIBAFS = libafs.o LIBAFSNONFS = libafs.nonfs.o -DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs-nfs -DEST_LIBAFSNONFS = ${DESTDIR}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs +INST_LIBAFS = ${DESTDIR}${afskerneldir}/afs-nfs +INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/afs +DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs-nfs +DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs + +libafs: $(LIBAFSNONFS) ; +install_libafs: $(INST_LIBAFSNONFS) ; +dest_libafs: $(DEST_LIBAFSNONFS) ; -libafs: $(DEST_LIBAFSNONFS) ; +$(INST_LIBAFS): $(LIBAFS) + $(INSTALL) -f $? $@ + +$(INST_LIBAFSNONFS): $(LIBAFSNONFS) + $(INSTALL) -f $? $@ $(DEST_LIBAFS): $(LIBAFS) $(INSTALL) -f $? $@ @@ -109,7 +139,8 @@ osi_vnodeops.o: $(AFS)/osi_vnodeops.c osi_module.o: $(AFS)/osi_module.c $(CRULE1) xdr.o: $(RX)/xdr.c - $(CRULE1); + $(CRULE1) xdr_array.o: $(RX)/xdr_array.c - $(CRULE1); - + $(CRULE1) +xdr_int64.o: $(RX)/xdr_int64.c + $(CRULE1) diff --git a/src/libafs/MakefileProto.DUX.in b/src/libafs/MakefileProto.DUX.in index c1abece41..cf848daa0 100644 --- a/src/libafs/MakefileProto.DUX.in +++ b/src/libafs/MakefileProto.DUX.in @@ -7,9 +7,25 @@ # MakefileProto for Digital Unix systems # - -DESTDIR=DEST/ -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: @@ -48,15 +64,18 @@ KOBJ = STATIC # This tells Makefile.common to use it's single directory build target. COMPDIRS = single_compdir +INSTDIRS = single_instdir +DESTDIRS = single_destdir include Makefile.common setup: -mkdir $(KOBJ) - -rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common + -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config ln -s ../Makefile $(KOBJ)/Makefile ln -s ../Makefile.common $(KOBJ)/Makefile.common - -rm -f h net netinet rpc ufs nfs machine sys vm + ln -s ../config $(KOBJ)/config + -$(RM) -f h net netinet rpc ufs nfs machine sys vm -ln -s /usr/sys/include/net net -ln -s /usr/sys/include/machine machine -ln -s /usr/sys/include/netinet netinet @@ -72,21 +91,39 @@ setup: # Below this line are targets when in the COMMON directory: LIBAFS = libafs.o LIBAFSNONFS = libafs.nonfs.o +AFSMOD = afs.mod + +INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS} +INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS} +INST_AFSMOD = ${DESTDIR}${afskerneldir}/${AFSMOD} -DEST_LIBAFS = ${DESTDIR}/root.client/bin/${LIBAFS} -DEST_LIBAFSNONFS = ${DESTDIR}/root.client/bin/${LIBAFSNONFS} +DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS} +DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS} +DEST_AFSMOD = ${DEST}/root.client/bin/${AFSMOD} -# libafs: $(DEST_LIBAFS) $(DEST_LIBAFSNONFS) +.PHONY: libafs install_libafs +libafs: ${LIBAFSNONFS} ${AFSMOD} +install_libafs: ${INST_LIBAFSNONFS} ${INST_AFSMOD} +dest_libafs: ${DEST_LIBAFSNONFS} ${DEST_AFSMOD} -.PHONY: libafs -libafs: $(DEST_LIBAFSNONFS) +${INST_LIBAFS}: ${LIBAFS} + $(INSTALL) -f $? $@ + +${INST_LIBAFSNONFS}: ${LIBAFSNONFS} + $(INSTALL) -f $? $@ + +${INST_AFSMOD}: ${AFSMOD} + $(INSTALL) -f $? $@ + +${DEST_LIBAFS}: ${LIBAFS} + $(INSTALL) -f $? $@ -$(DEST_LIBAFS): $(LIBAFS) +${DEST_LIBAFSNONFS}: ${LIBAFSNONFS} $(INSTALL) -f $? $@ -$(DEST_LIBAFSNONFS): $(LIBAFSNONFS) +${DEST_AFSMOD}: ${AFSMOD} $(INSTALL) -f $? $@ ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS) @@ -95,6 +132,8 @@ ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS) ${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS) $(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} +${AFSMOD}: ${LIBAFSNONFS} + $(LD) -dc -r -o ${AFSMOD} ${LIBAFSNONFS} # Object build rules: osi_groups.o: $(AFS)/osi_groups.c diff --git a/src/libafs/MakefileProto.FBSD.in b/src/libafs/MakefileProto.FBSD.in index 13fcbf769..67e3c3908 100644 --- a/src/libafs/MakefileProto.FBSD.in +++ b/src/libafs/MakefileProto.FBSD.in @@ -1,10 +1,26 @@ #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */ # -# MakefileProto for Digital Unix systems +# MakefileProto for FreeBSD systems # - -DESTDIR=DEST/ -# include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +# include config/Makefile.${SYS_NAME} # OS specific object files: AFS_OS_OBJS = \ @@ -14,7 +30,8 @@ AFS_OS_OBJS = \ osi_misc.o \ osi_sleep.o \ osi_vm.o \ - osi_vnodeops.o + osi_vnodeops.o \ + xdr_int64.o AFS_OS_NFSOBJS = \ osi_vfsops_nfs.o @@ -42,15 +59,18 @@ KOBJ = STATIC # This tells Makefile.common to use it's single directory build target. COMPDIRS = single_compdir +INSTDIRS = single_instdir +DESTDIRS = single_destdir include Makefile.common setup: -mkdir $(KOBJ) - -rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common + -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config ln -s ../Makefile $(KOBJ)/Makefile ln -s ../Makefile.common $(KOBJ)/Makefile.common - -rm -f h net netinet rpc ufs nfs machine sys vm + ln -s ../config $(KOBJ)/config + -$(RM) -f h net netinet rpc ufs nfs machine sys vm -ln -s /usr/src/sys/net net -ln -s /usr/src/sys/i386/include machine -ln -s /usr/src/sys/netinet netinet @@ -67,15 +87,34 @@ setup: LIBAFS = libafs.o LIBAFSNONFS = libafs.nonfs.o -DEST_LIBAFS = ${DESTDIR}/root.client/bin/${LIBAFS} -DEST_LIBAFSNONFS = ${DESTDIR}/root.client/bin/${LIBAFSNONFS} +INST_LIBAFS ${DESTDIR}${afskerneldir}/${LIBAFS} +INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS} + +DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS} +DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS} -# libafs: $(DEST_LIBAFS) $(DEST_LIBAFSNONFS) -# libafs: $(DEST_LIBAFSNONFS) +# libafs: $(LIBAFS) $(LIBAFSNONFS) +# libafs: $(LIBAFSNONFS) +# install_libafs: $(INST_LIBAFS) $(INST_LIBAFSNONFS) +# install_libafs: $(INST_LIBAFSNONFS) +# dest_libafs: $(DEST_LIBAFS) $(DEST_LIBAFSNONFS) +# dest_libafs: $(DEST_LIBAFSNONFS) libafs: echo WARNING: No kernel module for ${SYS_NAME} +install_libafs: + echo WARNING: No kernel module for ${SYS_NAME} + +dest_libafs: + echo WARNING: No kernel module for ${SYS_NAME} + + +$(INST_LIBAFS): $(LIBAFS) + $(INSTALL) -f $? $@ + +$(INST_LIBAFSNONFS): $(LIBAFSNONFS) + $(INSTALL) -f $? $@ $(DEST_LIBAFS): $(LIBAFS) $(INSTALL) -f $? $@ @@ -109,3 +148,5 @@ osi_vm.o: $(AFS)/osi_vm.c $(CRULE1) osi_vnodeops.o: $(AFS)/osi_vnodeops.c $(CRULE1) +xdr_int64.o: $(RX)/xdr_int64.c + $(CRULE1) diff --git a/src/libafs/MakefileProto.HPUX.in b/src/libafs/MakefileProto.HPUX.in index 89656fec7..ab50ceb3c 100644 --- a/src/libafs/MakefileProto.HPUX.in +++ b/src/libafs/MakefileProto.HPUX.in @@ -7,9 +7,25 @@ # MakefileProto for HP systems # - -DESTDIR=DEST/ -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: AFS_OS_OBJS = \ @@ -20,7 +36,8 @@ AFS_OS_OBJS = \ osi_misc.o \ osi_sleep.o \ osi_vnodeops.o \ - osi_vm.o + osi_vm.o \ + xdr_int64.o AFS_OS_NFSOBJS = \ osi_vfsops_nfs.o @@ -69,13 +86,15 @@ KOBJ=STATIC #COMPDIRS = single_compdir # This is the hpux multiple directory target. COMPDIRS = hpux_compdirs +INSTDIRS = hpux_instdirs +DESTDIRS = hpux_destdirs include Makefile.common BITS = 64 32 setup: - -rm -f h net dux machine netinet nfs rpc s200 ufs sys + -$(RM) -f h net dux machine netinet nfs rpc s200 ufs sys ln -s /usr/include/sys h ln -s /etc/conf/net net ln -s /etc/conf/dux dux @@ -91,15 +110,16 @@ setup: dir=$$t.$$b; \ echo Making directory: $$dir; \ mkdir -p $$dir; \ - rm -f $$dir/Makefile $$dir/Makefile.common; \ + $(RM) -f $$dir/Makefile $$dir/Makefile.common $$dir/config; \ ln -s ../Makefile $$dir/Makefile; \ ln -s ../Makefile.common $$dir/Makefile.common; \ + ln -s ../config $$dir/config; \ done; \ done echo Setup complete. # Compile the clients. -${COMPDIRS}: +${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: if false; then \ for b in $(BITS); do \ for t in $(KOBJ); do \ @@ -110,24 +130,37 @@ ${COMPDIRS}: 64) bopts="$(KDEFS_64)"; bsuff="64";; \ esac; \ cd $$dir; \ - $(MAKE) BITSUFFIX=$$bsuff CPU_KDEFS="$$bopts" DESTDIR=${DESTDIR} libafs || exit $$?; \ + $(MAKE) BITSUFFIX=$$bsuff CPU_KDEFS="$$bopts" $@_libafs || exit $$?; \ cd ..; \ done; \ done; \ fi +hpux_compdirs_libafs: libafs +hpux_instdirs_libafs: install_libafs +hpux_destdirs_libafs: dest_libafs + # Below this line are targets when in the static directory: LIBAFS = libafs$(BITSUFFIX).a LIBAFSNONFS = libafs$(BITSUFFIX).nonfs.a +INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS} +INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS} -DEST_LIBAFS = ${DESTDIR}root.client/bin/${LIBAFS} -DEST_LIBAFSNONFS = ${DESTDIR}root.client/bin/${LIBAFSNONFS} +DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS} +DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS} -# libafs: ${DEST_LIBAFS} ${DEST_LIBAFSNONFS} -libafs: ${DEST_LIBAFSNONFS} +libafs: ${LIBAFSNONFS} +install_libafs: ${INST_LIBAFSNONFS} +dest_libafs: ${DEST_LIBAFSNONFS} + +$(INST_LIBAFS): $(LIBAFS) + ${INSTALL} -f $? $@ + +$(INST_LIBAFSNONFS): $(LIBAFSNONFS) + ${INSTALL} -f $? $@ $(DEST_LIBAFS): $(LIBAFS) ${INSTALL} -f $? $@ @@ -163,6 +196,8 @@ osi_vm.o: $(AFS)/osi_vm.c $(CRULE1) osi_vnodeops.o: $(AFS)/osi_vnodeops.c $(CRULE1) +xdr_int64.o: $(RX)/xdr_int64.c + $(CRULE1) # This is a list of header files compiled with the -g option. It allows # examination of AFS structures in a dump. diff --git a/src/libafs/MakefileProto.IRIX.in b/src/libafs/MakefileProto.IRIX.in index 286f69fd8..76f9afa9b 100644 --- a/src/libafs/MakefileProto.IRIX.in +++ b/src/libafs/MakefileProto.IRIX.in @@ -7,9 +7,25 @@ # MakefileProto for IRIX systems # - -DESTDIR=DEST/ -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: AFS_OS_OBJS = \ @@ -21,7 +37,8 @@ AFS_OS_OBJS = \ osi_misc.o \ osi_sleep.o \ osi_vm.o \ - osi_vnodeops.o + osi_vnodeops.o \ + xdr_int64.o AFS_OS_NFSOBJS = \ osi_vfsops_nfs.o @@ -45,7 +62,7 @@ MPS=MP KDEFS=-D_K64U64 -D_KERNEL -DSTATIC=static -D_PAGESZ=16384 -D_MIPS3_ADDRSPACE \ -DTFP -non_shared -elf -xansi -64 -mips4 -TENV:kernel \ -TENV:misalignment=1 -OPT:space \ - -D${CPUBOARD} -D${MPSP} -D${CPUARCH} -DAFS_SGIMP_ENV ${NODYNOPT} \ + -D${CPUBOARD} -D${MPSP} -D${CPUARCH} -DAFS_SGIMP_ENV ${NODYNOPT} \ -jalr -woff 1209,1196,1496 # Turning off warnings regarding constant conditionals and not prototyped. @@ -195,6 +212,8 @@ CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) -G 0 $(KDEFS) $( #COMPDIRS = single_compdir # This is the irix multiple directory target. COMPDIRS = irix_compdirs +INSTDIRS = irix_instdirs +DESTDIRS = irix_destdirs include Makefile.common @@ -213,12 +232,11 @@ KOBJ = STATIC MODLOAD setup: - -rm -f h net netinet rpc ufs nfs machine sys + -$(RM) -f h net netinet rpc ufs nfs machine sys -ln -s /usr/include/sys h -ln -s /usr/include/net /usr/include/netinet . -ln -s /usr/include/rpc /usr/include/sys . -ln -s /usr/include/sys/fs . - -mkdir ${DESTDIR}root.client/bin BUILDPROCS="${PROCESSORS}" ; \ BUILDMPS="${MPS}" ; \ @@ -232,9 +250,10 @@ setup: dir=$$t.$$n.$$p ; \ echo Making directory: $$dir; \ mkdir -p $$dir; \ - rm -f $$dir/Makefile.common $$dir/Makefile; \ + $(RM) -f $$dir/Makefile.common $$dir/Makefile $$dir/config; \ ln -s ../Makefile.common $$dir/Makefile.common; \ ln -s ../Makefile $$dir/Makefile; \ + ln -s ../config $$dir/config; \ done; \ done; \ done @@ -248,9 +267,10 @@ setup: dir=$$t.$$p ; \ echo Making directory: $$dir; \ mkdir -p $$dir; \ - rm -f $$dir/Makefile.common $$dir/Makefile; \ + $(RM) -f $$dir/Makefile.common $$dir/Makefile $$dir/config; \ ln -s ../Makefile.common $$dir/Makefile.common; \ ln -s ../Makefile $$dir/Makefile; \ + ln -s ../config $$dir/config; \ done; \ done @@ -259,7 +279,7 @@ setup: # Compile static and modload versions of the clients. -${COMPDIRS}: +${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: BUILDPROCS="${PROCESSORS}" ; \ if [ "${CPUARCH}" != "" ] ; then \ BUILDPROCS=${CPUARCH}; \ @@ -303,13 +323,13 @@ ${COMPDIRS}: export CPU_KDEFS ;\ export LDFLAGS; \ cd $$dir ; \ - $(MAKE) CPUARCH=$$p MPSP=$$n DESTDIR=../${DESTDIR} $$t.libafs || exit $$?;\ + $(MAKE) CPUARCH=$$p MPSP=$$n $@_$$t.libafs || exit $$?;\ cd ../ ; \ done; \ done; \ done -${COMPDIRS}: +${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: BUILDPROCS="${PROCESSORS}" ; \ if [ "${IPNO}" != "" ] ; then \ BUILDPROCS="${IPNO}"; \ @@ -340,95 +360,144 @@ ${COMPDIRS}: export CPU_KDEFS ;\ export LDFLAGS ;\ cd $$dir ; \ - $(MAKE) IPNO=$$p DESTDIR=${DESTDIR} $$t.libafs || exit $$?; \ + $(MAKE) IPNO=$$p $@_$$t.libafs || exit $$?; \ cd ../ ; \ done; \ done +irix_compdirs_STATIC.libafs: STATIC.libafs +irix_compdirs_MODLOAD.libafs: MODLOAD.libafs +irix_instdirs_STATIC.libafs: install_STATIC.libafs +irix_instdirs_MODLOAD.libafs: install_MODLOAD.libafs +irix_destdirs_STATIC.libafs: dest_STATIC.libafs +irix_destdirs_MODLOAD.libafs: dest_MODLOAD.libafs + + + +${INSTDIRS}: install_COPYFILES install_LINKFILES +${DESTDIRS}: dest_COPYFILES dest_LINKFILES + + LIBAFSNONFSA = libafs.nonfs.a -COPYFILES = copyfiles -LINKFILES = linkfiles -STATICCLIENTDIR = ${DESTDIR}root.client/bin -MODLOADCLIENTDIR = ${DESTDIR}root.client/usr/vice/etc/sgiload +STATIC.libafs: ${LIBAFSNONFSA} -# Make the NFS and no-NFS clients for this directory. -# STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES} -STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES} +install_STATIC.libafs: ${LIBAFSNONFSA} ${CP} ${LIBAFSNONFSA} \ - ${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.a + ${DESTDIR}${afskerneldir}/libafs.${MPSP}.${CPUARCH}.nonfs.a ${CP} ${LIBAFSNONFSA} \ - ${STATICCLIENTDIR}/libafs.${IPNO}.nonfs.a + ${DESTDIR}${afskerneldir}/libafs.${IPNO}.nonfs.a + + +dest_STATIC.libafs: ${LIBAFSNONFSA} + + ${CP} ${LIBAFSNONFSA} \ + ${DEST}/root.client/bin/libafs.${MPSP}.${CPUARCH}.nonfs.a + + ${CP} ${LIBAFSNONFSA} \ + ${DEST}/root.client/bin/libafs.${IPNO}.nonfs.a ${LIBAFSNONFSA}: $(AFSAOBJS) $(AFSNONFSOBJS) $(AR) cru $@ $? -LIBAFSNONFSO = libaf.nonfs.o + +LIBAFSNONFSO = libafs.nonfs.o # MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES} -MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES} +MODLOAD.libafs: ${LIBAFSNONFSO} + +install_MODLOAD.libafs: ${LIBAFSNONFSO} ${CP} ${LIBAFSNONFSO} \ - ${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.o + ${DESTDIR}${afskerneldir}/libafs.${MPSP}.${CPUARCH}.nonfs.o ${CP} ${LIBAFSNONFSO} \ - ${MODLOADCLIENTDIR}/libafs.${IPNO}.nonfs.o + ${DESTDIR}${afskerneldir}/libafs.${IPNO}.nonfs.o + + +dest_MODLOAD.libafs: ${LIBAFSNONFSO} + + ${CP} ${LIBAFSNONFSO} \ + ${DEST}/root.client/usr/vice/etc/sgiload/libafs.${MPSP}.${CPUARCH}.nonfs.o + + ${CP} ${LIBAFSNONFSO} \ + ${DEST}/root.client/usr/vice/etc/sgiload/libafs.${IPNO}.nonfs.o ${LIBAFSNONFSO}: $(AFSAOBJS) $(AFSNONFSOBJS) $(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSNONFSO} \ $(AFSAOBJS) $(AFSNONFSOBJS) -${COPYFILES}: - ${CP} ../sgi_system ${STATICCLIENTDIR}/afs.sm - chmod 644 ${STATICCLIENTDIR}/afs.sm - ${CP} ../sgi_master ${STATICCLIENTDIR}/afs - chmod 644 ${STATICCLIENTDIR}/afs + +install_COPYFILES: + ${CP} sgi_system ${DESTDIR}${afskerneldir}/afs.sm + chmod 644 ${DESTDIR}${afskerneldir}/afs.sm + ${CP} sgi_master ${DESTDIR}${afskerneldir}/afs + chmod 644 ${DESTDIR}${afskerneldir}/afs + +dest_COPYFILES: + ${INSTALL} -f sgi_system ${DEST}/root.client/bin/afs.sm + chmod 644 ${DEST}/root.client/bin/afs.sm + ${INSTALL} -f sgi_master ${DEST}/root.client/bin/afs + chmod 644 ${DEST}/root.client/bin/afs # Create symlinks to clients we don't need to build. # If this changes, also change the kdump symlinks. -${LINKFILES}: +install_LINKFILES: - ln -fs libafs.IP20.a ${DESTDIR}root.client/bin/libafs.IP22.a - ln -fs libafs.IP20.a ${DESTDIR}root.client/bin/libafs.IP32.a - ln -fs libafs.IP20.nonfs.a ${DESTDIR}root.client/bin/libafs.IP22.nonfs.a - ln -fs libafs.IP20.nonfs.a ${DESTDIR}root.client/bin/libafs.IP32.nonfs.a - ln -fs libafs.IP20.o ${DESTDIR}root.client/usr/vice/etc/sgiload/libafs.IP22.o - ln -fs libafs.IP20.o ${DESTDIR}root.client/usr/vice/etc/sgiload/libafs.IP32.o - ln -fs libafs.IP20.nonfs.o ${DESTDIR}root.client/usr/vice/etc/sgiload/libafs.IP22.nonfs.o - ln -fs libafs.IP20.nonfs.o ${DESTDIR}root.client/usr/vice/etc/sgiload/libafs.IP32.nonfs.o + ln -fs libafs.IP20.a ${DESTDIR}${afskerneldir}/libafs.IP22.a + ln -fs libafs.IP20.a ${DESTDIR}${afskerneldir}/libafs.IP32.a + ln -fs libafs.IP20.nonfs.a ${DESTDIR}${afskerneldir}/libafs.IP22.nonfs.a + ln -fs libafs.IP20.nonfs.a ${DESTDIR}${afskerneldir}/libafs.IP32.nonfs.a + ln -fs libafs.IP20.o ${DESTDIR}${afskerneldir}/libafs.IP22.o + ln -fs libafs.IP20.o ${DESTDIR}${afskerneldir}/libafs.IP32.o + ln -fs libafs.IP20.nonfs.o ${DESTDIR}${afskerneldir}/libafs.IP22.nonfs.o + ln -fs libafs.IP20.nonfs.o ${DESTDIR}${afskerneldir}/libafs.IP32.nonfs.o + - +# Create symlinks to clients we don't need to build. +# If this changes, also change the kdump symlinks. +dest_LINKFILES: + + ln -fs libafs.IP20.a ${DEST}/root.client/bin/libafs.IP22.a + ln -fs libafs.IP20.a ${DEST}/root.client/bin/libafs.IP32.a + ln -fs libafs.IP20.nonfs.a ${DEST}/root.client/bin/libafs.IP22.nonfs.a + ln -fs libafs.IP20.nonfs.a ${DEST}/root.client/bin/libafs.IP32.nonfs.a + ln -fs libafs.IP20.o ${DEST}/root.client/usr/vice/etc/sgiload/libafs.IP22.o + ln -fs libafs.IP20.o ${DEST}/root.client/usr/vice/etc/sgiload/libafs.IP32.o + ln -fs libafs.IP20.nonfs.o ${DEST}/root.client/usr/vice/etc/sgiload/libafs.IP22.nonfs.o + ln -fs libafs.IP20.nonfs.o ${DEST}/root.client/usr/vice/etc/sgiload/libafs.IP32.nonfs.o + # Object build rules: # Common objects afs_base64.o: $(AFS)/afs_base64.c - $(CRULE1); + $(CRULE1) osi_groups.o: $(AFS)/osi_groups.c - $(CRULE1); + $(CRULE1) osi_idbg.o: $(AFS)/osi_idbg.c - $(CRULE1); + $(CRULE1) osi_inode.o: $(AFS)/osi_inode.c - $(CRULE1); + $(CRULE1) osi_file.o: $(AFS)/osi_file.c - $(CRULE1); + $(CRULE1) osi_misc.o: $(AFS)/osi_misc.c - $(CRULE1); + $(CRULE1) osi_sleep.o: $(AFS)/osi_sleep.c - $(CRULE1); + $(CRULE1) osi_vfsops_nfs.o: $(AFS)/osi_vfsops.c - $(CRULE1) -o osi_vfsops_nfs.o; + $(CRULE1) -o osi_vfsops_nfs.o osi_vfsops.o: $(AFS)/osi_vfsops.c - $(CRULE1) -DAFS_NONFSTRANS; + $(CRULE1) -DAFS_NONFSTRANS osi_vm.o: $(AFS)/osi_vm.c - $(CRULE1); + $(CRULE1) osi_vnodeops.o: $(AFS)/osi_vnodeops.c - $(CRULE1); - - + $(CRULE1) +xdr_int64.o: $(RX)/xdr_int64.c + $(CRULE1) diff --git a/src/libafs/MakefileProto.SOLARIS.in b/src/libafs/MakefileProto.SOLARIS.in index 505692d09..33864289d 100644 --- a/src/libafs/MakefileProto.SOLARIS.in +++ b/src/libafs/MakefileProto.SOLARIS.in @@ -7,7 +7,25 @@ # MakefileProto for Solaris systems # -include ../config/Makefile.${SYS_NAME} +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +TOP_SRCDIR=@TOP_SRCDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +afskerneldir=@afskerneldir@ +SYS_NAME=@AFS_SYSNAME@ + +include config/Makefile.${SYS_NAME} # OS specific object files: AFS_OS_OBJS = \ @@ -16,7 +34,8 @@ AFS_OS_OBJS = \ osi_file.o \ osi_sleep.o \ osi_vm.o \ - osi_vnodeops.o + osi_vnodeops.o \ + xdr_int64.o AFS_OS_NFSOBJS = \ osi_vfsops_nfs.o @@ -50,16 +69,20 @@ KOBJ = MODLOAD32 MODLOAD64 # This tells Makefile.common to use it's single directory build target. COMPDIRS = single_compdir +INSTDIRS = single_instdir +DESTDIRS = single_destdir COMPDIRS = solaris_compdirs +INSTDIRS = solaris_instdirs +DESTDIRS = solaris_destdirs include Makefile.common setup: - -rm -f h net netinet rpc ufs nfs machine sys inet + -$(RM) -f h net netinet rpc ufs nfs machine sys inet -ln -s /usr/include/sys h -ln -s /usr/include/net net -ln -s /usr/include/netinet netinet @@ -71,9 +94,10 @@ setup: for t in ${KOBJ} ; do \ echo Making directory: $$t; \ mkdir -p $$t; \ - rm -f $$t/Makefile.common $$t/Makefile ; \ + $(RM) -f $$t/Makefile.common $$t/Makefile $$t/config ; \ ln -s ../Makefile.common $$t/Makefile.common ; \ ln -s ../Makefile $$t/Makefile ;\ + ln -s ../config $$t/config ;\ done @@ -81,7 +105,7 @@ setup: ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively -${COMPDIRS}: +${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: for t in ${KOBJ} ; do \ echo Building directory: $$t ; \ case $$t in \ @@ -95,10 +119,14 @@ ${COMPDIRS}: export ARCH_DEFS ; \ export BITS ; \ cd $$t ; \ - $(MAKE) DESTDIR=${DESTDIR} libafs ; \ + $(MAKE) $@_libafs ; \ cd ../ ;\ done +solaris_compdirs_libafs: libafs +solaris_instdirs_libafs: install_libafs +solaris_destdirs_libafs: dest_libafs + # Below this line are targets when in the COMMON directory: @@ -106,15 +134,25 @@ LIBAFS = libafs.o LIBAFSNONFS = libafs.nonfs.o -DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS} -DEST_LIBAFSNONFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFSNONFS} +INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS} +INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS} + +DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS} +DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFSNONFS} # Without this line, gmake tries to build libafs.o .PHONY: libafs -# libafs: $(DEST_LIBAFS) $(DEST_LIBAFSNONFS) -libafs: $(DEST_LIBAFSNONFS) +libafs: $(LIBAFSNONFS) +install_libafs: $(INST_LIBAFSNONFS) +dest_libafs: $(DEST_LIBAFSNONFS) + + +$(INST_LIBAFS): $(LIBAFS) + ${INSTALL} -f $? $@ +$(INST_LIBAFSNONFS): $(LIBAFSNONFS) + ${INSTALL} -f $? $@ $(DEST_LIBAFS): $(LIBAFS) ${INSTALL} -f $? $@ @@ -132,27 +170,33 @@ ${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS) $(LD) -r -o $@ $(AFSAOBJS) ${AFSNONFSOBJS} -MODLOADDIR = ${DESTDIR}root.client/usr/vice/etc/modload libafs: ${LIBAFSNONFS} - ${INSTALL} -f ${LIBAFSNONFS} ${MODLOADDIR}/libafs${BITS}.nonfs.o + +install_libafs: ${LIBAFSNONFS} + ${INSTALL} -f ${LIBAFSNONFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.nonfs.o + +dest_libafs: ${LIBAFSNONFS} + ${INSTALL} -f ${LIBAFSNONFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.nonfs.o # Solaris specific objects osi_groups.o: $(AFS)/osi_groups.c - $(CRULE1); + $(CRULE1) osi_inode.o: $(AFS)/osi_inode.c - $(CRULE1); + $(CRULE1) osi_file.o: $(AFS)/osi_file.c - $(CRULE1); + $(CRULE1) osi_sleep.o: $(AFS)/osi_sleep.c - $(CRULE1); + $(CRULE1) osi_vfsops_nfs.o: $(AFS)/osi_vfsops.c - $(CRULE1) -o osi_vfsops_nfs.o; + $(CRULE1) -o osi_vfsops_nfs.o osi_vfsops.o: $(AFS)/osi_vfsops.c - $(CRULE1) -DAFS_NONFSTRANS; + $(CRULE1) -DAFS_NONFSTRANS osi_vm.o: $(AFS)/osi_vm.c - $(CRULE1); + $(CRULE1) osi_vnodeops.o: $(AFS)/osi_vnodeops.c - $(CRULE1); + $(CRULE1) +xdr_int64.o: $(RX)/xdr_int64.c + $(CRULE1) diff --git a/src/libuafs/Makefile.common b/src/libuafs/Makefile.common index 8dc837c20..bb8fe04cc 100644 --- a/src/libuafs/Makefile.common +++ b/src/libuafs/Makefile.common @@ -21,28 +21,30 @@ NS_INCL =SRC/../afsweb/netscape_includes # Build rules - CC and CFLAGS are defined in system specific MakefileProtos. -install: ukinstall +all: ${TOP_LIBDIR}/$(LIBUAFS) linktest -webinstall: AFSWEB/$(LIBAFSWEB) AFSWEB/$(LIBAFSWEBKRB) - ${INSTALL} AFSWEB/$(LIBAFSWEB) ${DESTDIR}root.afsweb/usr/lib - ${INSTALL} AFSWEB/$(LIBAFSWEBKRB) ${DESTDIR}root.afsweb/usr/lib +webinstall: all \ + ${TOP_LIBDIR}/$(LIBAFSWEB) \ + ${TOP_LIBDIR}/$(LIBAFSWEBKRB) -ukinsthdrs: - ${INSTALL} afs/param.h ${DESTDIR}root.perf/include/afs - ${INSTALL} afs/stds.h ${DESTDIR}root.perf/include/afs - ${INSTALL} afs/afs_sysnames.h ${DESTDIR}root.perf/include/afs - ${INSTALL} afs/afs_stats.h ${DESTDIR}root.perf/include/afs - ${INSTALL} afs/sysincludes.h ${DESTDIR}root.perf/include/afs - ${INSTALL} afs/afs_usrops.h ${DESTDIR}root.perf/include/afs +linktest: UAFS/$(LIBUAFS) des/libdes.a + $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${TOP_SRCDIR}/config -I${TOP_INCDIR} -I${TOP_INCDIR}/rx -I. UAFS/$(LIBUAFS) des/libdes.a $(TEST_LIBS) $(XLIBS) -ukinstlibs: - ${INSTALL} des/libdes.a ${DESTDIR}root.perf/lib - ${INSTALL} UAFS/$(LIBUAFS) ${DESTDIR}root.perf/lib +ukinstall: install -ukinstall: ukinsthdrs UAFS/$(LIBUAFS) linktest ukinstlibs +install: \ + ${DESTDIR}${libdir}/$(LIBUAFS) + +dest: \ + ${DEST}/root.perf/include/afs/param.h \ + ${DEST}/root.perf/include/afs/stds.h \ + ${DEST}/root.perf/include/afs/afs_sysnames.h \ + ${DEST}/root.perf/include/afs/afs_stats.h \ + ${DEST}/root.perf/include/afs/sysincludes.h \ + ${DEST}/root.perf/include/afs/afs_usrops.h \ + ${DEST}/root.perf/lib/libdes.a \ + ${DEST}/root.perf/lib/$(LIBUAFS) -linktest: UAFS/$(LIBUAFS) des/libdes.a - $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${TOP_SRCDIR}/config -I${DESTDIR}include -I${DESTDIR}include/rx -I${DESTDIR}root.perf/include UAFS/$(LIBUAFS) des/libdes.a $(TEST_LIBS) $(XLIBS) CRULE1= $(CC) $(OPTF) -DKERNEL $(CFLAGS) -c $? CRULE2= $(CC) $(OPTF) $(WEBOPTS) -DKERNEL $(CFLAGS) -c $? @@ -889,6 +891,56 @@ $(WEBOBJ)/Krxstat.xdr.o: $(AFSINT)/Krxstat.xdr.c $(CRULE2); clean: - -rm -rf UAFS* AFSWEB* nsapi des afs afsint config rx - -rm -f h net netinet rpc ufs machine inet nfs sys des linktest + -$(RM) -rf UAFS* AFSWEB* nsapi des afs afsint config rx + -$(RM) -f h net netinet rpc ufs machine inet nfs sys des linktest + + +${TOP_LIBDIR}/$(LIBAFSWEB): AFSWEB/$(LIBAFSWEB) + ${INSTALL} $? $@ + +${TOP_LIBDIR}/$(LIBAFSWEBKRB): AFSWEB/$(LIBAFSWEBKRB) + ${INSTALL} $? $@ + +${TOP_LIBDIR}/$(LIBUAFS): UAFS/$(LIBUAFS) + ${INSTALL} $? $@ + + +${DESTDIR}${libdir}/$(LIBAFSWEB): AFSWEB/$(LIBAFSWEB) + ${INSTALL} $? $@ + +${DESTDIR}${libdir}/$(LIBAFSWEBKRB): AFSWEB/$(LIBAFSWEBKRB) + ${INSTALL} $? $@ + +${DESTDIR}${libdir}/$(LIBUAFS): UAFS/$(LIBUAFS) + ${INSTALL} $? $@ + + +${DEST}/root.afsweb/usr/lib/$(LIBAFSWEB): AFSWEB/$(LIBAFSWEB) + ${INSTALL} $? $@ + +${DEST}/root.afsweb/usr/lib/$(LIBAFSWEBKRB): AFSWEB/$(LIBAFSWEBKRB) + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/param.h: afs/param.h + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/stds.h: afs/stds.h + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/afs_sysnames.h: afs/afs_sysnames.h + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/afs_stats.h: afs/afs_stats.h + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/sysincludes.h: afs/sysincludes.h + ${INSTALL} $? $@ + +${DEST}/root.perf/include/afs/afs_usrops.h: afs/afs_usrops.h + ${INSTALL} $? $@ + +${DEST}/root.perf/lib/libdes.a: des/libdes.a + ${INSTALL} $? $@ +${DEST}/root.perf/lib/$(LIBUAFS): UAFS/$(LIBUAFS) + ${INSTALL} $? $@ diff --git a/src/log/kseal.c b/src/log/kseal.c index 4c1131f8d..4ed56233c 100644 --- a/src/log/kseal.c +++ b/src/log/kseal.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/log/kseal.c,v 1.1.1.4 2001/07/14 22:22:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/log/kseal.c,v 1.1.1.5 2001/09/11 14:33:31 hartmans Exp $"); #include #include @@ -74,8 +74,8 @@ char **argv; { string_to_key(argv[2], skey); now = time(0); - bcopy(&now, session, 4); /* but this is only a test pgm */ - bcopy(&now, session+4, 4); + memcpy(session, &now, 4); /* but this is only a test pgm */ + memcpy(session+4, &now, 4); code = tkt_MakeTicket(token.ticket, &token.ticketLen, skey, argv[1], "", cellName, now-300, now+25*3600, session, /* host */ 0, "afs", ""); if (code) { @@ -89,7 +89,7 @@ char **argv; { strcpy(sname.cell, cellName); token.startTime = 0; token.endTime = 0x7fffffff; - bcopy(session, &token.sessionKey, 8); + memcpy(&token.sessionKey, session, 8); token.kvno = 0; code = ktc_SetToken (&sname, &token, (char *) 0, 0); if (code) { diff --git a/src/log/test/testlog.c b/src/log/test/testlog.c index 76ba22974..3172285c3 100644 --- a/src/log/test/testlog.c +++ b/src/log/test/testlog.c @@ -23,7 +23,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/log/test/testlog.c,v 1.1.1.4 2001/07/14 22:22:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/log/test/testlog.c,v 1.1.1.5 2001/09/11 14:33:32 hartmans Exp $"); #include #include @@ -193,7 +193,7 @@ main (argc, argv) */ foundPassword = TRUE; strcpy(passwd, argv[currArg]); - bzero(argv[currArg], strlen(passwd)); + memset(argv[currArg], 0, strlen(passwd)); currArg++; #if DB_ARGPARSE fprintf(stderr, "Found password: '%s' (%d chars), erased from arg list (now '%s').\n", diff --git a/src/login/login.c b/src/login/login.c index 8494b5f0d..348ee358e 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -39,7 +39,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/login/login.c,v 1.1.1.4 2001/07/14 22:22:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/login/login.c,v 1.1.1.5 2001/09/11 14:33:33 hartmans Exp $"); #include #include @@ -747,7 +747,7 @@ doafs: (void)signal(SIGTSTP, SIG_IGN); tbuf[0] = '-'; - (void)strcpy(tbuf + 1, (p = rindex(shell, '/')) ? p + 1 : shell); + (void)strcpy(tbuf + 1, (p = strrchr(shell, '/')) ? p + 1 : shell); sia_ses_release(&entity); execlp(shell, tbuf, 0); (void)printf("login: no shell: %s.\n", strerror(errno)); @@ -2040,7 +2040,7 @@ static char *getlinep(const char *string, int size, FILE *stream) { if(!fgets(string, size, stream) || ferror(stream) || errno == EINTR) return NULL; else - if(cp=index(string, '\n')) + if(cp=strchr(string, '\n')) *cp = '\0'; else while((c=getc(stdin)) != '\n' && c != EOF && errno != EINTR) diff --git a/src/login/setenv.c b/src/login/setenv.c index f599c9b7f..54e65d6e0 100644 --- a/src/login/setenv.c +++ b/src/login/setenv.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/login/setenv.c,v 1.1.1.3 2001/07/14 22:22:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/login/setenv.c,v 1.1.1.4 2001/09/11 14:33:33 hartmans Exp $"); #include #include @@ -68,7 +68,7 @@ setenv(name, value, rewrite) (cnt + 2))); if (!P) return(-1); - bcopy(environ, P, cnt * sizeof(char *)); + memcpy(P, environ, cnt * sizeof(char *)); environ = P; } environ[cnt + 1] = NULL; diff --git a/src/login/util_logout.c b/src/login/util_logout.c index e762e2a62..3763af4a1 100644 --- a/src/login/util_logout.c +++ b/src/login/util_logout.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/login/util_logout.c,v 1.1.1.3 2001/07/14 22:22:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/login/util_logout.c,v 1.1.1.4 2001/09/11 14:33:33 hartmans Exp $"); #include #include @@ -54,9 +54,9 @@ logout(line) if (!ut.ut_name[0] || strncmp(ut.ut_line, line, sizeof(ut.ut_line))) continue; - bzero(ut.ut_name, sizeof(ut.ut_name)); + memset(ut.ut_name, 0, sizeof(ut.ut_name)); #if !defined(AIX) && !defined(AFS_SUN5_ENV) - bzero(ut.ut_host, sizeof(ut.ut_host)); + memset(ut.ut_host, 0, sizeof(ut.ut_host)); #endif /* AIX */ (void)time(&ut.ut_time); (void)fseek(fp, (long)-sizeof(struct utmp), L_INCR); diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index a48915f0c..b3cfb20eb 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -24,7 +24,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/iomgr.c,v 1.1.1.5 2001/07/14 22:22:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/iomgr.c,v 1.1.1.6 2001/09/11 14:33:35 hartmans Exp $"); #include #include @@ -244,7 +244,7 @@ static struct IoRequest *NewRequest() #else #define FDS_P_POS (sizeof(int)*8) #define INTS_PER_FDS(x) (((x)+(FDS_P_POS-1)) / FDS_P_POS) -#define FD_N_ZERO(nfds, x) bzero((char*)(x), (INTS_PER_FDS(nfds))*sizeof(int)) +#define FD_N_ZERO(nfds, x) memset((char*)(x), 0, (INTS_PER_FDS(nfds))*sizeof(int)) #endif #if defined(AFS_LINUX22_ENV) && (__GLIBC_MINOR__ > 0) diff --git a/src/lwp/test/selsubs.c b/src/lwp/test/selsubs.c index d95240e3c..b29f03884 100644 --- a/src/lwp/test/selsubs.c +++ b/src/lwp/test/selsubs.c @@ -28,7 +28,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selsubs.c,v 1.1.1.4 2001/07/14 22:22:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selsubs.c,v 1.1.1.5 2001/09/11 14:33:42 hartmans Exp $"); #include "../lwp.h" @@ -39,7 +39,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selsubs.c,v 1.1.1.4 2001/07/14 fd_set *IOMGR_AllocFDSet(void) { fd_set *tmp = (fd_set*)malloc(sizeof(fd_set)); - bzero((char*)tmp, sizeof(fd_set)); + memset((char*)tmp, 0, sizeof(fd_set)); return tmp; } diff --git a/src/lwp/test/testlwp.c b/src/lwp/test/testlwp.c index 1bea2a9f6..f2c32396d 100644 --- a/src/lwp/test/testlwp.c +++ b/src/lwp/test/testlwp.c @@ -20,7 +20,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/testlwp.c,v 1.1.1.4 2001/07/14 22:23:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/testlwp.c,v 1.1.1.5 2001/09/11 14:33:43 hartmans Exp $"); #define LWP_KERNEL #include "lwp.h" @@ -376,7 +376,7 @@ int LWP_MwaitProcess(wcount, evlist, ecount) /* wait on m of n events */ if (ecount == 1) lwp_cpptr->eventlist[0] = evlist[0]; else - bcopy(evlist, lwp_cpptr->eventlist, ecount*sizeof(char *)); + memcpy(lwp_cpptr->eventlist, evlist, ecount*sizeof(char *)); if (wcount > 0) { lwp_cpptr -> status = WAITING; move(lwp_cpptr, &runnable[lwp_cpptr->priority], &blocked); diff --git a/src/lwp/threadname.c b/src/lwp/threadname.c index 0d23d9581..4dd07ddc3 100644 --- a/src/lwp/threadname.c +++ b/src/lwp/threadname.c @@ -22,13 +22,13 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/threadname.c,v 1.1.1.4 2001/07/14 22:22:57 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/threadname.c,v 1.1.1.5 2001/09/11 14:33:40 hartmans Exp $"); -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #if defined(AFS_PTHREAD_ENV) diff --git a/src/lwp/waitkey.c b/src/lwp/waitkey.c index 54203e7a3..42b38199d 100644 --- a/src/lwp/waitkey.c +++ b/src/lwp/waitkey.c @@ -22,7 +22,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/waitkey.c,v 1.1.1.7 2001/07/20 10:07:28 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/waitkey.c,v 1.1.1.8 2001/09/11 14:33:41 hartmans Exp $"); #include #include diff --git a/src/mpp/mpp.c b/src/mpp/mpp.c index 34fd10ba1..3aae6b125 100644 --- a/src/mpp/mpp.c +++ b/src/mpp/mpp.c @@ -2,9 +2,9 @@ * (C) Copyright 10/17/86 by Carnegie Mellon University */ #include +#include extern char *malloc(); -extern char *rindex(); #define maxinputdepth 16 #define maxlinesize 1024 @@ -215,7 +215,7 @@ static directive(what) if (*what++ != specialchar) return nestp->status; - if (cp = rindex(what,'\n')) + if (cp = strrchr(what, '\n')) *cp = 0; for (n = 0; n < 2; n++) { @@ -382,7 +382,7 @@ main( argc, argv ) char *cp, *cp2; cp = &argv[0][sizeof("-D")-1]; - if (cp2 = rindex(cp,'=')) + if (cp2 = strrchr(cp, '=')) *cp2++ = 0; if (cp2 == 0) cp2 = ""; diff --git a/src/ntp/mkntpconf.c b/src/ntp/mkntpconf.c index 58cdc2c8f..0f04ee1ee 100644 --- a/src/ntp/mkntpconf.c +++ b/src/ntp/mkntpconf.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/mkntpconf.c,v 1.1.1.4 2001/07/14 22:23:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/mkntpconf.c,v 1.1.1.5 2001/09/11 14:33:52 hartmans Exp $"); #include #include @@ -97,7 +97,7 @@ main(ac, av) name = (ac > 0) ? (ac--, *av++) : (ac = 0, "mkntpconf"); (void) strcpy(tempfn, name); - if ((p = rindex(tempfn, '/')) == 0) + if ((p = strrchr(tempfn, '/')) == 0) p = tempfn; else p += 1; @@ -137,7 +137,7 @@ main(ac, av) peerline(guava, f); peerline(cluster1, f); } else { - if ((p = index(hostname, '.')) != 0 + if ((p = strchr(hostname, '.')) != 0 && strcmp(p+1, "srv.cs.cmu.edu") == 0) { peerline(papaya, f); peerline(guava, f); @@ -146,12 +146,12 @@ main(ac, av) serv.s_addr = 0; if ((g = fopen("/etc/attributes", "r")) != NULL) { while (fgets(line, sizeof(line), g) != NULL) { - if ((p = index(line, ':')) != 0) + if ((p = strchr(line, ':')) != 0) *p = 0; if (strcmp(line, papaya.s_name) == 0 || strcmp(line, guava.s_name) == 0) continue; - if ((p = index(line, '.')) == 0 + if ((p = strchr(line, '.')) == 0 || strcmp(p+1, "srv.cs.cmu.edu") != 0) continue; peerline(serv, f); diff --git a/src/ntp/ntp.c b/src/ntp/ntp.c index b1e4a3a9b..3d94678ed 100644 --- a/src/ntp/ntp.c +++ b/src/ntp/ntp.c @@ -32,7 +32,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntp.c,v 1.1.1.4 2001/07/14 22:23:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntp.c,v 1.1.1.5 2001/09/11 14:33:52 hartmans Exp $"); #include #ifdef AFS_AIX32_ENV @@ -160,10 +160,10 @@ main(argc, argv) argv[host]); continue; } - bcopy(hp->h_addr, (char *) &dst.sin_addr,hp->h_length); + memcpy((char *) &dst.sin_addr, hp->h_addr, hp->h_length); } - bzero((char *)pkt, sizeof(ntp_data)); + memset((char *)pkt, 0, sizeof(ntp_data)); pkt->status = NTPVERSION_1 | NO_WARNING | MODE_CLIENT; pkt->stratum = UNSPECIFIED; diff --git a/src/ntp/ntp.h b/src/ntp/ntp.h index 72fbf110e..423c848ce 100644 --- a/src/ntp/ntp.h +++ b/src/ntp/ntp.h @@ -13,7 +13,7 @@ #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) #endif #ifndef NBBY diff --git a/src/ntp/ntp_adjust.c b/src/ntp/ntp_adjust.c index d448287b4..77773da81 100644 --- a/src/ntp/ntp_adjust.c +++ b/src/ntp/ntp_adjust.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntp_adjust.c,v 1.1.1.4 2001/07/14 22:23:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntp_adjust.c,v 1.1.1.5 2001/09/11 14:33:53 hartmans Exp $"); #include #include @@ -287,7 +287,7 @@ ZeroAIXcum() if (debug > 6) printf ("Zeroing aix_adjtime accumulation: %d %d\n", cum.tv_sec, cum.tv_usec); - bzero (&cum, sizeof(cum)); + memset(&cum, 0, sizeof(cum)); } int adjtime(newdelta, olddelta) diff --git a/src/ntp/ntpd.c b/src/ntp/ntpd.c index 54c165759..82f80a9e2 100644 --- a/src/ntp/ntpd.c +++ b/src/ntp/ntpd.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntpd.c,v 1.1.1.4 2001/07/14 22:23:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntpd.c,v 1.1.1.5 2001/09/11 14:33:53 hartmans Exp $"); #if defined(AFS_SGI_ENV) #define NOSWAP 1 @@ -284,12 +284,12 @@ main(argc, argv) #endif /* DEBUG */ setlogmask(LOG_UPTO(LOG_INFO)); - syslog(LOG_NOTICE, "%s version $Revision: 1.1.1.4 $", prog_name); + syslog(LOG_NOTICE, "%s version $Revision: 1.1.1.5 $", prog_name); syslog(LOG_NOTICE, "patchlevel %d", PATCHLEVEL); #ifdef DEBUG if (debug) - printf("%s version $Revision: 1.1.1.4 $ patchlevel %d\n", + printf("%s version $Revision: 1.1.1.5 $ patchlevel %d\n", prog_name, PATCHLEVEL); #endif #if defined(AFS_AIX_ENV) @@ -753,7 +753,7 @@ init_ntp(config) double j; extern double drift_comp; - bzero((char *) &sin, sizeof(sin)); + memset((char *) &sin, 0, sizeof(sin)); fp = fopen(config, "r"); if (fp == NULL) { fprintf(stderr,"Problem opening NTP initialization file %s\n", @@ -1296,8 +1296,7 @@ GetHostName(name, sin) if (hp = gethostbyname(name)) { if (hp->h_addrtype != AF_INET) return (0); - bcopy((char *) hp->h_addr, (char *) &sin->sin_addr, - hp->h_length); + memcpy((char *) &sin->sin_addr, (char *) hp->h_addr, hp->h_length); sin->sin_family = hp->h_addrtype; return (1); } diff --git a/src/ntp/ntpdc.c b/src/ntp/ntpdc.c index e307a6b1c..691c7ba17 100644 --- a/src/ntp/ntpdc.c +++ b/src/ntp/ntpdc.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntpdc.c,v 1.1.1.4 2001/07/14 22:23:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/ntpdc.c,v 1.1.1.5 2001/09/11 14:33:54 hartmans Exp $"); #include #include @@ -76,7 +76,7 @@ main(argc, argv) sigaction(SIGSEGV, &nsa, NULL); #endif (void) gethostname(LocalHostName, sizeof LocalHostName); - if (p = index(LocalHostName, '.')) { + if (p = strchr(LocalHostName, '.')) { *p++ = '\0'; LocalDomain = p; } @@ -213,7 +213,7 @@ query(host) static struct servent *sp = NULL; afs_int32 HostAddr; - bzero((char *) &watcher, sizeof(watcher)); + memset((char *) &watcher, 0, sizeof(watcher)); watcher.sin_family = AF_INET; HostAddr = inet_addr(host); watcher.sin_addr.s_addr = (afs_uint32) HostAddr; @@ -223,7 +223,7 @@ query(host) fprintf(stderr,"%s: unknown\n", host); return 0; } - bcopy(hp->h_addr, (char *) &watcher.sin_addr, hp->h_length); + memcpy((char *) &watcher.sin_addr, hp->h_addr, hp->h_length); } sp = getservbyname("ntp", "udp"); if (sp == 0) { @@ -363,7 +363,7 @@ cvthname(f) if (hp == 0) return (inet_ntoa(f->sin_addr)); - if ((p = index(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0) + if ((p = strchr(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0) *p = '\0'; return (hp->h_name); } diff --git a/src/ntp/read_psti.c b/src/ntp/read_psti.c index ab0ca6b66..82c3b47d0 100644 --- a/src/ntp/read_psti.c +++ b/src/ntp/read_psti.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/read_psti.c,v 1.1.1.4 2001/07/14 22:23:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/read_psti.c,v 1.1.1.5 2001/09/11 14:33:55 hartmans Exp $"); #if defined(REFCLOCK) && defined(PSTI) #define ERR_RATE 60 /* Repeat errors once an hour */ @@ -126,12 +126,12 @@ char *timesource; tty.c_iflag = ICRNL; tty.c_oflag = 0; tty.c_lflag = 0; - bzero((char *)tty.c_cc, sizeof tty.c_cc); + memset((char *)tty.c_cc, 0, sizeof tty.c_cc); tty.c_cc[VMIN] = MIN_READ; tty.c_cc[VTIME] = 0; if (ioctl(cfd, TCSETA, &tty) < 0) { #else /* TCSETA Use older Berkeley style IOCTL's */ - bzero((char *)&tty, sizeof tty); + memset((char *)&tty, 0, sizeof tty); tty.sg_ispeed = tty.sg_ospeed = B9600; tty.sg_flags = ANYP|CRMOD; tty.sg_erase = tty.sg_kill = '\0'; diff --git a/src/ntp/runntp.c b/src/ntp/runntp.c index ce4aa4d73..6020ffd8d 100644 --- a/src/ntp/runntp.c +++ b/src/ntp/runntp.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/runntp.c,v 1.1.1.4 2001/07/14 22:23:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/runntp.c,v 1.1.1.5 2001/09/11 14:33:55 hartmans Exp $"); #include #include @@ -212,7 +212,7 @@ main (argc, argv) /* handle bozo kills right */ { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_handler = terminate; code = sigaction (SIGTERM, &sa, NULL); if (code) { diff --git a/src/ntp/test.c b/src/ntp/test.c index 0ca778227..663739fb0 100644 --- a/src/ntp/test.c +++ b/src/ntp/test.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/test.c,v 1.1.1.3 2001/07/11 03:10:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ntp/test.c,v 1.1.1.4 2001/09/11 14:33:56 hartmans Exp $"); #include #include @@ -198,8 +198,8 @@ test5(v) struct sysdata sys; double delay; - bzero (&peer, sizeof(peer)); - bzero (&sys, sizeof(sys)); + memset(&peer, 0, sizeof(peer)); + memset(&sys, 0, sizeof(sys)); pkt.precision = -6; peer.precision = pkt.precision; sys.precision = pkt.precision; diff --git a/src/package/check.c b/src/package/check.c index bc774cccb..068f7f096 100644 --- a/src/package/check.c +++ b/src/package/check.c @@ -26,7 +26,6 @@ char *emalloc(); char *strcpy(); -char *rindex(); CTREEPTR LocateChildNode(); static char path2[MAXPATHLEN+1]; /* $$get rid of this */ @@ -71,7 +70,7 @@ static CheckMount(path) * Copy out the candidate mountpoint's pathname into dir, throwing * off any leaf component from the original path. */ - ep = rindex(path, '/'); + ep = strrchr(path, '/'); for (sp = path, dp = dir; sp < ep; *dp++ = *sp++); if (dp == dir) *dp++ = '/'; @@ -80,7 +79,7 @@ static CheckMount(path) /* * Copy out the parent's pathname into parent. */ - ep = rindex(dir, '/'); + ep = strrchr(dir, '/'); for (sp = dir, dp = parent; sp < ep; *dp++ = *sp++); if (dp == parent) *dp++ = '/'; diff --git a/src/package/conftree.c b/src/package/conftree.c index c0056c723..9e8258366 100644 --- a/src/package/conftree.c +++ b/src/package/conftree.c @@ -93,7 +93,7 @@ static CTREEPTR AllocConfigNode() register CTREEPTR np; np = (CTREEPTR) emalloc(sizeof(CTREE)); - bzero((char *)np, sizeof(CTREE)); + memset((char *)np, 0, sizeof(CTREE)); return(np); } /*AllocConfigNode*/ diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index ee906d21b..929115c58 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -5,36 +5,49 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +DEST=@DEST@ +TOP_INCDIR=@TOP_INCDIR@ +TOP_LIBDIR=@TOP_LIBDIR@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +libexecdir=@libexecdir@ +libdir=@libdir@ +includedir=@includedir@ +mandir=@mandir@ +afssrvbindir=@afssrvbindir@ +afssrvsbindir=@afssrvsbindir@ +afssrvlibexecdir=@afssrvlibexecdir@ +COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et +RXGEN=${TOP_SRCDIR}/rxgen/rxgen +TOP_SRCDIR=@TOP_SRCDIR@ +SYS_NAME=@AFS_SYSNAME@ SHELL=/bin/sh KERNELDIR = ../libafs/ -COMPONENT=afs include ../config/Makefile.${SYS_NAME} -LIBDIR = ${DESTDIR}lib/ - LIBSA = ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a -AFSLIBS = ${DESTDIR}lib/librxkad.a \ - ${LIBDIR}afs/libsys.a ${DESTDIR}lib/libdes.a \ - ${LIBDIR}librx.a ${LIBDIR}liblwp.a ${LIBDIR}afs/libaudit.a \ - ${LIBDIR}afs/libcmd.a ${LIBDIR}afs/libcom_err.a ${LIBDIR}afs/util.a + LIBSA = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.a +AFSLIBS = ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a \ + ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libaudit.a \ + ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/util.a LDFLAGS = ${SHARE_LDFLAGS} - LIBS = ${LIBDIR}afs/libkauth.a ${LIBSA} ${LIBDIR}afs/libauth.a \ + LIBS = ${TOP_LIBDIR}/libkauth.a ${LIBSA} ${TOP_LIBDIR}/libauth.a \ ${AFSLIBS} ${PAMLIBS} @LIB_AFSDB@ - KLIBS = ${LIBDIR}afs/libkauth.krb.a ${LIBSA} ${LIBDIR}afs/libauth.krb.a \ + KLIBS = ${TOP_LIBDIR}/libkauth.krb.a ${LIBSA} ${TOP_LIBDIR}/libauth.krb.a \ ${AFSLIBS} ${PAMLIBS} @LIB_AFSDB@ SHOBJS = afs_auth.o afs_account.o afs_session.o afs_password.o \ afs_pam_msg.o afs_message.o afs_util.o AFS_component_version_number.o OBJS = $(SHOBJS) test_pam.o -INCLUDES = -I${TOP_SRCDIR}/config -I${DESTDIR}include \ +INCLUDES=-I${TOP_SRCDIR}/config -I${TOP_INCDIR} \ -I/usr/include -I/usr/include/sys -CFLAGS = ${DEBUG} ${INCLUDES} ${PAM_CFLAGS} +CFLAGS = ${DEBUG} ${INCLUDES} ${PAM_CFLAGS} -TARGETS = pam_afs.so.1 test_pam pam_afs.krb.so.1 - -include ../config/Makefile.version - -system all: $(TARGETS) +all: test_pam ${TOP_LIBDIR}/pam_afs.so.1 ${TOP_LIBDIR}/pam_afs.krb.so.1 afs_setcred.o: afs_setcred.c afs_pam_msg.h afs_message.h afs_util.h ${CC} ${CFLAGS} -c afs_setcred.c -o afs_setcred.o @@ -91,14 +104,38 @@ test_pam: test_pam.o echo No link line for system $(SYS_NAME). ;; \ esac -clean: - /bin/rm -f $(TARGETS) $(OBJS) afs_setcred.o afs_setcred_krb.o core *~ AFS_component_version_number.c +install: ${DESTDIR}${libdir}/pam_afs.so.1 ${DESTDIR}${libdir}/pam_afs.krb.so.1 -install: all - ${INSTALL} -s pam_afs.so.1 ${DESTDIR}lib/pam_afs.so.1 - ${INSTALL} -s pam_afs.krb.so.1 ${DESTDIR}lib/pam_afs.krb.so.1 +${DEST}/lib/pam_afs.so.1: pam_afs.so.1 + ${INSTALL} $? $@ + +${DEST}/lib/pam_afs.krb.so.1: pam_afs.krb.so.1 + ${INSTALL} $? $@ afs_auth.o: afs_auth.c afs_pam_msg.h afs_message.h afs_util.h afs_pam_msg.o: afs_pam_msg.c afs_pam_msg.h afs_message.h afs_message.o: afs_message.c afs_message.h afs_util.o: afs_util.c afs_util.h + +# +# Misc. targets +# +clean: + $(RM) -f *.a *.o *.so.1 test_pam core *~ AFS_component_version_number.c + +include ../config/Makefile.version + +${DESTDIR}${libdir}/pam_afs.so.1: pam_afs.so.1 + ${INSTALL} $? $@ + +${TOP_LIBDIR}/pam_afs.so.1: pam_afs.so.1 + ${INSTALL} $? $@ + +${DESTDIR}${libdir}/pam_afs.krb.so.1: pam_afs.krb.so.1 + ${INSTALL} $? $@ + +${TOP_LIBDIR}/pam_afs.krb.so.1: pam_afs.krb.so.1 + ${INSTALL} $? $@ + +dest: ${DEST}/lib/pam_afs.so.1 ${DEST}/lib/pam_afs.krb.so.1 + diff --git a/src/pam/afs_auth.c b/src/pam/afs_auth.c index 63dfa2c3f..ae9c95dc7 100644 --- a/src/pam/afs_auth.c +++ b/src/pam/afs_auth.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_auth.c,v 1.1.1.5 2001/07/14 22:23:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_auth.c,v 1.1.1.6 2001/09/11 14:34:00 hartmans Exp $"); #include #include @@ -29,7 +29,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_auth.c,v 1.1.1.5 2001/07/14 22: #define RET(x) { retcode = (x); goto out; } - extern int pam_sm_authenticate( pam_handle_t *pamh, @@ -45,14 +44,24 @@ pam_sm_authenticate( int nowarn = 0; int use_first_pass = 0; int try_first_pass = 0; - int ignore_root = 0; - int trust_root = 0; - int catch_su = 0; + int ignore_uid = 0; + uid_t ignore_uid_id = 0; + char my_password_buf[256]; + /* + * these options are added to handle stupid apps, which won't call + * pam_set_cred() + */ + int refresh_token = 0; + int set_token = 0; + int dont_fork = 0; + /* satisfy kdm 2.x + */ + int use_klog = 0; int set_expires = 0; /* This option is only used in pam_set_cred() */ int got_authtok = 0; /* got PAM_AUTHTOK upon entry */ int nouser = 0; - char my_password_buf[256]; char *user = NULL, *password = NULL; + long password_expires = -1; int torch_password = 1; int i; struct pam_conv *pam_convp = NULL; @@ -67,7 +76,7 @@ pam_sm_authenticate( #ifndef AFS_SUN56_ENV - openlog(pam_afs_ident, LOG_CONS, LOG_AUTH); + openlog(pam_afs_ident, LOG_CONS|LOG_PID, LOG_AUTH); #endif origmask = setlogmask(logmask); @@ -85,11 +94,31 @@ pam_sm_authenticate( } else if (strcasecmp(argv[i], "try_first_pass") == 0) { try_first_pass = 1; } else if (strcasecmp(argv[i], "ignore_root" ) == 0) { - ignore_root = 1; - } else if (strcasecmp(argv[i], "trust_root" ) == 0) { - trust_root = 1; - } else if (strcasecmp(argv[i], "catch_su" ) == 0) { - catch_su = 1; + ignore_uid = 1; + ignore_uid_id = 0; + } else if (strcasecmp(argv[i], "ignore_uid" ) == 0) { + i++; + if (i == argc) { + pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, "ignore_uid missing argument"); + ignore_uid = 0; + } else { + ignore_uid = 1; + ignore_uid_id = (uid_t) strtol(argv[i], (char**)NULL, 10); + if ( (ignore_uid_id < 0) || (ignore_uid_id > IGNORE_MAX)) { + ignore_uid = 0; + pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, argv[i]); + } + } + } else if (strcasecmp(argv[i], "refresh_token" ) == 0) { + refresh_token = 1; + } else if (strcasecmp(argv[i], "set_token" ) == 0) { + set_token = 1; + } else if (strcasecmp(argv[i], "dont_fork" ) == 0) { + if (!use_klog) dont_fork = 1; + else pam_afs_syslog(LOG_ERR, PAMAFS_CONFLICTOPT, "dont_fork"); + } else if (strcasecmp(argv[i], "use_klog" ) == 0) { + if (!dont_fork) use_klog = 1; + else pam_afs_syslog(LOG_ERR, PAMAFS_CONFLICTOPT, "use_klog"); } else if (strcasecmp(argv[i], "setenv_password_expires") == 0) { set_expires = 1; } else { @@ -102,33 +131,33 @@ pam_sm_authenticate( /* so turn that flag off right now. */ if (use_first_pass) try_first_pass = 0; - pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass, ignore_uid, ignore_uid_id, refresh_token, set_token, dont_fork, use_klog); /* Try to get the user-interaction info, if available. */ - errcode = pam_get_item(pamh, PAM_CONV, (void **) &pam_convp); + errcode = pam_get_item(pamh, PAM_CONV, (const void **) &pam_convp); if (errcode != PAM_SUCCESS) { pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT); pam_convp = NULL; } /* Who are we trying to authenticate here? */ - if ((errcode = pam_get_user(pamh, &user, "login: ")) != PAM_SUCCESS) { + if ((errcode = pam_get_user(pamh, (const char **)&user, "login: ")) != PAM_SUCCESS) { pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode); RET(PAM_USER_UNKNOWN); } - if ((!strncmp ("root", user, 4)) && trust_root) { - pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user); - RET(PAM_SUCCESS); - } - - pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user); /* * If the user has a "local" (or via nss, possibly nss_dce) pwent, * and its uid==0, and "ignore_root" was given in pam.conf, * ignore the user. */ + /* enhanced: use "ignore_uid " to specify the largest uid + * which should be ignored by this module + */ #if defined(AFS_HPUX_ENV) #if defined(AFS_HPUX110_ENV) i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd); @@ -137,41 +166,38 @@ pam_sm_authenticate( if ( i == 0 ) /* getpwnam_r success */ upwd = &unix_pwd; #endif /* else AFS_HPUX110_ENV */ - if (ignore_root && i == 0 && upwd->pw_uid == 0) { + if (ignore_uid && i == 0 && upwd->pw_uid <= ignore_uid_id) { pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user); RET(PAM_AUTH_ERR); } #else -#ifdef AFS_LINUX20_ENV +#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) upwd = getpwnam(user); #else upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf)); #endif - if (upwd != NULL && upwd->pw_uid == 0) { - if (ignore_root) { - pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user); - RET(PAM_AUTH_ERR); - } else if (trust_root && !catch_su) { - pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user); - RET(PAM_SUCCESS); - } + if (ignore_uid && upwd != NULL && upwd->pw_uid <= ignore_uid_id) { + pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user); + RET(PAM_AUTH_ERR); } #endif - errcode = pam_get_item(pamh, PAM_AUTHTOK, (void **) &password); + errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **) &password); if (errcode != PAM_SUCCESS || password == NULL) { if (use_first_pass) { pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user); RET(PAM_AUTH_ERR); } password = NULL; /* In case it isn't already NULL */ - pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); } else if (password[0] == '\0') { /* Actually we *did* get one but it was empty. */ torch_password = 0; pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user); RET(PAM_NEW_AUTHTOK_REQD); } else { - pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user); torch_password = 0; got_authtok = 1; } @@ -211,15 +237,30 @@ try_auth: * this storage, copy it to a buffer that won't need to be freed * later, and free this storage now. */ + strncpy(my_password_buf, password, sizeof(my_password_buf)); my_password_buf[sizeof(my_password_buf)-1] = '\0'; memset(password, 0, strlen(password)); free(password); password = my_password_buf; + } + /* Be sure to allocate a PAG here if we should set a token, + * All of the remaining stuff to authenticate the user and to + * get a token is done in a child process - if not suppressed by the config, + * see below + * But dont get a PAG if the refresh_token option was set + * We have to do this in such a way because some + * apps (such as screensavers) wont call setcred but authenticate :-( + */ + if (!refresh_token) { + setpag(); + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "New PAG created in pam_authenticate()"); } + if (!dont_fork) { /* Prepare for fork(): set SIGCHLD signal handler to default */ sigemptyset(&newAction.sa_mask); newAction.sa_handler = SIG_DFL; @@ -234,9 +275,35 @@ try_auth: * memory/sockets allocated will get cleaned up when the child * exits: defect 11686. */ + if (use_klog) { /* used by kdm 2.x */ + if (refresh_token || set_token) { + i = do_klog(user, password, NULL); + } else { + i = do_klog(user, password, "00:00:01"); + ktc_ForgetAllTokens(); + } + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "do_klog returned %d", i); + auth_ok = i ? 0 : 1; + } else { + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "forking ..."); cpid = fork(); if (cpid <= 0) { /* The child process */ - code = ka_VerifyUserPassword(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG, + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "in child"); + if (refresh_token || set_token) + code = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION, + user, /* kerberos name */ + (char *)0, /* instance */ + (char *)0, /* realm */ + password, /* password */ + 0, /* default lifetime */ + &password_expires, + 0, /* spare 2 */ + &reason /* error string */ ); + else + code = ka_VerifyUserPassword(KA_USERAUTH_VERSION, user, /* kerberos name */ (char *)0, /* instance */ (char *)0, /* realm */ @@ -249,9 +316,13 @@ try_auth: } else { auth_ok = 1; } + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "child: auth_ok=%d", auth_ok); if (cpid == 0) exit(auth_ok); } else { do { + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "in parent, waiting ..."); rcpid = waitpid(cpid, &status, 0); } while ((rcpid == -1) && (errno == EINTR)); @@ -260,13 +331,47 @@ try_auth: } else { auth_ok = 0; } + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "parent: auth_ok=%d", auth_ok); + } } - /* Restore old signal handler */ code = sigaction(SIGCHLD, &origAction, (struct sigaction *)0); if (code) { pam_afs_syslog(LOG_ERR, PAMAFS_PAMERROR, errno); } + } else { /* dont_fork, used by httpd */ + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "dont_fork"); + if (refresh_token || set_token) + code = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION, + user, /* kerberos name */ + (char *)0, /* instance */ + (char *)0, /* realm */ + password, /* password */ + 0, /* default lifetime */ + &password_expires, + 0, /* spare 2 */ + &reason /* error string */ ); + else + code = ka_VerifyUserPassword(KA_USERAUTH_VERSION, + user, /* kerberos name */ + (char *)0, /* instance */ + (char *)0, /* realm */ + password, /* password */ + 0, /* spare 2 */ + &reason /* error string */ ); + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "dont_fork, code = %d",code); + if (code) { + pam_afs_syslog(LOG_ERR, PAMAFS_LOGIN_FAILED, user, reason); + auth_ok = 0; + } else { + auth_ok = 1; + } + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "dont_fork: auth_ok=%d", auth_ok); + } if (!auth_ok && try_first_pass) { password = NULL; @@ -274,11 +379,18 @@ try_auth: } /* We don't care if this fails; all we can do is try. */ - if (auth_ok && !got_authtok) { + /* It is not reasonable to store the password only if it was correct + * because it could satisfy another module that is called in the chain + * after pam_afs + */ + if (!got_authtok) { torch_password = 0; - pam_set_item(pamh, PAM_AUTHTOK, password); + (void) pam_set_item(pamh, PAM_AUTHTOK, password); } + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "leaving auth: auth_ok=%d", auth_ok); + if (code == KANOENT) RET(PAM_USER_UNKNOWN); RET(auth_ok ? PAM_SUCCESS : PAM_AUTH_ERR); out: diff --git a/src/pam/afs_message.c b/src/pam/afs_message.c index cf9756605..88e8c35e5 100644 --- a/src/pam/afs_message.c +++ b/src/pam/afs_message.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_message.c,v 1.1.1.5 2001/07/14 22:23:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_message.c,v 1.1.1.6 2001/09/11 14:34:00 hartmans Exp $"); #include #include @@ -40,13 +40,13 @@ static char *fallback_messages[] = { "AFS not available", /* 10: AFS_UNAVAIL */ "AFS error code 0x%x", /* 11: AFS_ERROR */ "AFS Authentication succeeded.\n", /* 12: LOGIN_OK */ - "AFS Authentication failed for user %s %s\n", + "AFS Authentication failed for user %s. %s\n", /* 13: LOGIN_FAILED */ "AFS PAM error, code=%d", /* 14: PAMERROR */ "AFS uid exceeds OS bounds.\n", /* 15: UID_OVERFLOW */ "The AFS PAM module may not be used from a non-MT program.\n", /* 16: NON_MT_PROG */ - "AFS Options: nowarn=%d, use_first_pass=%d, try_first_pass=%d", + "AFS Options: nowarn=%d, use_first_pass=%d, try_first_pass=%d, ignore_uid = %d, ignore_uid_id = %d, refresh_token=%d, set_token=%d, dont_fork=%d, use_klog=%d", /* 17: OPTIONS */ "AFS No pam_conv conversation structure found; no user interaction", /* 18: NO_USER_INT */ @@ -68,17 +68,23 @@ static char *fallback_messages[] = { "AFS ReInitializing creds for user %s\n", /* 31: REINITCRED */ "AFS Failed to set PASSWORD_EXPIRES for user %s\n", /* 32: PASSEXPFAIL */ - "", - /* 33: */ - "", - /* 34: */ - "AFS blindly trusting user %s\n", /* 35: TRUSTROOT */ - "New AFS Password: ", /* 36: NEW_PWD_PROMPT */ - "New AFS Password (again): ", /* 37: VERIFY_PWD_PROMPT */ - "Failed to change AFS password", /* 38: KRBPASS_FAIL */ - "Missing PAM flag: %s", /* 39: FLAGS */ - "ka error, code=%d", /* 40: KAERROR */ - "Passwords are not equal" /* 41: NE_PASSWORD */ + "AFS Failed to chown krb ticketfile\n", /* 33: CHOWNKRB */ + "AFS Failed to set KRBTKTFILE\n", /* 34: KRBFAIL */ + "AFS Unknown remaining lifetime %s using default %d seconds\n", + /* 35: REMAINLIFETIME */ + "AFS Session closed", /* 36: SESSIONCLOSED1 */ + "AFS Session closed, Tokens destroyed\n", /* 37: SESSIONCLOSED2 */ + "AFS Option conflict dont_fork and use_klog: %s\n", + /* 38: CONFLICTOPT */ + "AFS Unknown uid: %s, option ignored\n", + /* 39: IGNOREUID */ + "New AFS Password: ", /* 40: NEW_PWD_PROMPT */ + "New AFS Password (again): ", /* 41: VERIFY_PWD_PROMPT */ + "Failed to change AFS password", /* 42: KRBPASS_FAIL */ + "Missing PAM flag: %s", /* 43: FLAGS */ + "ka error, code=%d", /* 44: KAERROR */ + "Passwords are not equal", /* 45: NE_PASSWORD */ + "AFS ignoring unregistered user %s\n" /* 46: IGNORE_UNREG */ }; static int num_fallbacks = sizeof(fallback_messages)/sizeof(char *); diff --git a/src/pam/afs_message.h b/src/pam/afs_message.h index 8b211b045..6ed88e153 100644 --- a/src/pam/afs_message.h +++ b/src/pam/afs_message.h @@ -45,13 +45,19 @@ #define PAMAFS_PASSEXPFAIL 32 /* "Failed to set PASSWORD_EXPIRES" */ #define PAMAFS_CHOWNKRB 33 /* "Failed to chown krb ticketfile" */ #define PAMAFS_KRBFAIL 34 /* "Failed to set KRBTKTFILE" */ -#define PAMAFS_TRUSTROOT 35 /* "Ignoring superuser %s" */ -#define PAMAFS_NEW_PWD_PROMPT 36 /* "New AFS Password:" */ -#define PAMAFS_VERIFY_PWD_PROMPT 37 /* "New AFS Password (again):" */ -#define PAMAFS_KAPASS_FAIL 38 /* "Failed to change AFS password" */ -#define PAMAFS_FLAGS 39 /* "Missing PAM flag:" */ -#define PAMAFS_KAERROR 40 /* "ka error, code=%d" */ -#define PAMAFS_NE_PASSWORD 41 /* "Passwords are not equal" */ +#define PAMAFS_REMAINLIFETIME 35 /* "Unknown remaining lifetime" */ +#define PAMAFS_SESSIONCLOSED1 36 /* "Session closed" */ +#define PAMAFS_SESSIONCLOSED2 37 /* "Session closed, Tokens destroyed"*/ +#define PAMAFS_CONFLICTOPT 38 /* "Option conflict" */ +#define PAMAFS_IGNOREUID 39 /* "Unknown uid" */ +#define PAMAFS_NEW_PWD_PROMPT 40 /* "New AFS Password:" */ +#define PAMAFS_VERIFY_PWD_PROMPT 41 /* "New AFS Password (again):" */ +#define PAMAFS_KAPASS_FAIL 42 /* "Failed to change AFS password" */ +#define PAMAFS_FLAGS 43 /* "Missing PAM flag:" */ +#define PAMAFS_KAERROR 44 /* "ka error, code=%d" */ +#define PAMAFS_NE_PASSWORD 45 /* "Passwords are not equal" */ +#define PAMAFS_IGNORE_UNREG 46 /* "AFS ignoring unregistered user" */ + char *pam_afs_message(int msgnum, int *freeit); void pam_afs_syslog(int priority, int msgid, ...); diff --git a/src/pam/afs_password.c b/src/pam/afs_password.c index b9a91923b..eda2fcc9b 100644 --- a/src/pam/afs_password.c +++ b/src/pam/afs_password.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_password.c,v 1.1.1.5 2001/07/14 22:23:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_password.c,v 1.1.1.6 2001/09/11 14:34:01 hartmans Exp $"); #include #include @@ -93,8 +93,11 @@ pam_sm_chauthtok( if (use_first_pass) try_first_pass = 0; - pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass); - pam_afs_syslog(LOG_DEBUG, PAMAFS_PAMERROR, flags); + if (logmask && LOG_MASK(LOG_DEBUG)) + { + pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass); + pam_afs_syslog(LOG_DEBUG, PAMAFS_PAMERROR, flags); + } /* Try to get the user-interaction info, if available. */ errcode = pam_get_item(pamh, PAM_CONV, (const void **) &pam_convp); @@ -109,7 +112,8 @@ pam_sm_chauthtok( RET(PAM_USER_UNKNOWN); } - pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user); /* * If the user has a "local" (or via nss, possibly nss_dce) pwent, @@ -129,7 +133,7 @@ pam_sm_chauthtok( RET(PAM_AUTH_ERR); } #else -#ifdef AFS_LINUX20_ENV +#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) upwd = getpwnam(user); #else upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf)); @@ -147,13 +151,15 @@ pam_sm_chauthtok( RET(PAM_AUTH_ERR); } password = NULL; /* In case it isn't already NULL */ - pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); } else if (password[0] == '\0') { /* Actually we *did* get one but it was empty. */ torch_password = 0; pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user); RET(PAM_NEW_AUTHTOK_REQD); } else { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user); torch_password = 0; got_authtok = 1; diff --git a/src/pam/afs_session.c b/src/pam/afs_session.c index 1a6a65c39..462036787 100644 --- a/src/pam/afs_session.c +++ b/src/pam/afs_session.c @@ -10,10 +10,17 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_session.c,v 1.1.1.4 2001/07/14 22:23:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_session.c,v 1.1.1.5 2001/09/11 14:34:01 hartmans Exp $"); #include #include +#include +#include +#include +#include +#include +#include "afs_message.h" +#include "afs_util.h" extern int pam_sm_open_session( @@ -26,6 +33,8 @@ pam_sm_open_session( } +#define REMAINLIFETIME 300 + extern int pam_sm_close_session( pam_handle_t *pamh, @@ -33,5 +42,68 @@ pam_sm_close_session( int argc, const char **argv) { + int i; + int logmask = LOG_UPTO(LOG_INFO); + int origmask; + int remain = 0; + int remainlifetime = REMAINLIFETIME; + int no_unlog = 0; + + openlog(pam_afs_ident, LOG_CONS|LOG_PID, LOG_AUTH); + origmask = setlogmask(logmask); + + /* + * Parse the user options. Log an error for any unknown options. + */ + for (i = 0; i < argc; i++) { + if ( strcasecmp(argv[i], "debug" ) == 0) { + logmask |= LOG_MASK(LOG_DEBUG); + (void) setlogmask(logmask); + } else if (strcasecmp(argv[i], "remain" ) == 0) { + remain = 1; + } else if (strcasecmp(argv[i], "remainlifetime") == 0) { + i++; + remain = 1; + remainlifetime = (int) strtol(argv[i], (char**)NULL, 10); + if (remainlifetime == 0) + if((errno == EINVAL) || (errno == ERANGE)) { + remainlifetime = REMAINLIFETIME; + pam_afs_syslog(LOG_ERR, PAMAFS_REMAINLIFETIME, argv[i], REMAINLIFETIME); + } else { + no_unlog = 0; + remain = 0; + } + } else if (strcmp(argv[i], "no_unlog") == 0) { + no_unlog = 1; + } else { + pam_afs_syslog(LOG_ERR, PAMAFS_UNKNOWNOPT, argv[i]); + } + } + + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "pam_afs_session_close: remain: %d, remainlifetime: %d, no_unlog: %d",remain,remainlifetime,no_unlog); + if(remain && !no_unlog) { + switch (fork()) { + case -1 : /* error */ + return(PAM_SESSION_ERR); + case 0 : /* child */ +#ifdef AFS_LINUX20_ENV + setpgrp(); +#endif + setsid(); + for (i = 0; i <64; i++) close (i); + sleep(remainlifetime); + ktc_ForgetAllTokens(); + pam_afs_syslog(LOG_INFO, PAMAFS_SESSIONCLOSED2); + exit(0); + default : /* parent */ + pam_afs_syslog(LOG_INFO, PAMAFS_SESSIONCLOSED1); + return(PAM_SUCCESS); + } + } + if (!no_unlog && ktc_ForgetAllTokens()) + return PAM_SESSION_ERR; + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "pam_afs_session_close: Session closed"); return PAM_SUCCESS; } diff --git a/src/pam/afs_setcred.c b/src/pam/afs_setcred.c index 6542f08a7..a1ae0bc30 100644 --- a/src/pam/afs_setcred.c +++ b/src/pam/afs_setcred.c @@ -14,10 +14,11 @@ #include #include #include +#include #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_setcred.c,v 1.1.1.5 2001/07/14 22:23:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_setcred.c,v 1.1.1.6 2001/09/11 14:34:01 hartmans Exp $"); #include #include @@ -44,12 +45,15 @@ pam_sm_setcred( int origmask; int logmask = LOG_UPTO(LOG_INFO); int nowarn = 0; - int use_first_pass = 1; /* use the password passed in by auth */ + int use_first_pass = 0; /* use the password passed in by auth */ int try_first_pass = 0; int got_authtok = 0; - int ignore_root = 0; - int trust_root = 0; + int ignore_uid = 0; + int no_unlog = 0; + uid_t ignore_uid_id = 0; + int refresh_token = 0; int set_expires = 0; /* the default is to not to set the env variable */ + int use_klog = 0; int i; struct pam_conv *pam_convp = NULL; char my_password_buf[256]; @@ -83,11 +87,31 @@ pam_sm_setcred( } else if (strcasecmp(argv[i], "try_first_pass") == 0) { try_first_pass = 1; } else if (strcasecmp(argv[i], "ignore_root" ) == 0) { - ignore_root = 1; - } else if (strcasecmp(argv[i], "trust_root" ) == 0) { - trust_root = 1; - } else if (strcasecmp(argv[i], "catch_su" ) == 0) { - use_first_pass = 0; + ignore_uid = 1; + ignore_uid_id = 0; + } else if (strcasecmp(argv[i], "ignore_uid" ) == 0) { + i++; + if (i == argc) { + pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, "ignore_uid missing argument"); + ignore_uid = 0; + } else { + ignore_uid = 1; + ignore_uid_id = (uid_t) strtol(argv[i], (char**)NULL, 10); + if ( (0 > ignore_uid_id) || (ignore_uid_id > IGNORE_MAX) ) { + ignore_uid = 0; + pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, argv[i]); + } + } + } else if (strcasecmp(argv[i], "no_unlog") == 0) { + no_unlog = 1; + } else if (strcasecmp(argv[i], "refresh_token" ) == 0) { + refresh_token = 1; + } else if (strcasecmp(argv[i], "set_token" ) == 0) { + ; + } else if (strcasecmp(argv[i], "dont_fork" ) == 0) { + ; + } else if (strcasecmp(argv[i], "use_klog" ) == 0) { + use_klog = 1; } else if (strcasecmp(argv[i], "setenv_password_expires")==0) { set_expires = 1; } else { @@ -97,16 +121,18 @@ pam_sm_setcred( if (use_first_pass) try_first_pass = 0; - pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass, ignore_uid, ignore_uid_id, 8, 8, 8, 8); /* Try to get the user-interaction info, if available. */ - errcode = pam_get_item(pamh, PAM_CONV, (void **) &pam_convp); + errcode = pam_get_item(pamh, PAM_CONV, (const void **) &pam_convp); if (errcode != PAM_SUCCESS) { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_NO_USER_INT); pam_convp = NULL; } /* Who are we trying to authenticate here? */ - if ((errcode = pam_get_user(pamh, &user, "AFS username:")) != PAM_SUCCESS) { + if ((errcode = pam_get_user(pamh, (const char **)&user, "AFS username:")) != PAM_SUCCESS) { pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode); RET(PAM_USER_UNKNOWN); } @@ -115,6 +141,9 @@ pam_sm_setcred( * and its uid==0, and "ignore_root" was given in pam.conf, * ignore the user. */ + /* enhanced: use "ignore_uid " to specify the largest uid + * which should be ignored by this module + */ #if defined(AFS_HPUX_ENV) #if defined(AFS_HPUX110_ENV) i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd); @@ -123,38 +152,36 @@ pam_sm_setcred( if ( i == 0 ) /* getpwnam_r success */ upwd = &unix_pwd; #endif /* AFS_HPUX110_ENV */ - if (ignore_root && i == 0 && upwd->pw_uid == 0) { + if (ignore_uid && i == 0 && upwd->pw_uid <= ignore_uid_id) { pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user); RET(PAM_AUTH_ERR); } #else -#ifdef AFS_LINUX20_ENV +#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) upwd = getpwnam(user); #else upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf)); #endif - if (upwd != NULL && upwd->pw_uid == 0) { - if (ignore_root) { + if (ignore_uid && upwd != NULL && upwd->pw_uid <= ignore_uid_id) { pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user); RET(PAM_AUTH_ERR); - } else if (trust_root) { - pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user); - RET(PAM_SUCCESS); - } } #endif if (flags & PAM_DELETE_CRED) { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_DELCRED, user); RET(PAM_SUCCESS); } else if (flags & PAM_REINITIALIZE_CRED) { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_REINITCRED, user); RET(PAM_SUCCESS); } else { /* flags are PAM_REFRESH_CRED, PAM_ESTABLISH_CRED, unknown */ + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_ESTABCRED, user); errcode = pam_get_data(pamh, pam_afs_lh, (const void **) &password); @@ -164,7 +191,8 @@ pam_sm_setcred( RET(PAM_AUTH_ERR); } password = NULL; /* In case it isn't already NULL */ - pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user); } else if (password[0] == '\0') { /* Actually we *did* get one but it was empty. */ got_authtok = 1; @@ -175,8 +203,10 @@ pam_sm_setcred( pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user); RET(PAM_NEW_AUTHTOK_REQD); } - pam_afs_syslog(LOG_DEBUG, PAMAFS_NILPASSWORD, user); + if (logmask && LOG_MASK(LOG_DEBUG)) + pam_afs_syslog(LOG_DEBUG, PAMAFS_NILPASSWORD, user); } else { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user); torch_password = 0; got_authtok = 1; @@ -206,6 +236,7 @@ pam_sm_setcred( RET(PAM_AUTH_ERR); } if (password[0] == '\0') { + if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_NILPASSWORD); RET(PAM_NEW_AUTHTOK_REQD); } @@ -216,16 +247,30 @@ pam_sm_setcred( * this storage, copy it to a buffer that won't need to be freed * later, and free this storage now. */ + strncpy(my_password_buf, password, sizeof(my_password_buf)); my_password_buf[sizeof(my_password_buf)-1] = '\0'; memset(password, 0, strlen(password)); free(password); password = my_password_buf; } + /* + * We only set a PAG here, if we haven't got one before in + * pam_sm_authenticate() or if it was destroyed by the application + */ + if ((!refresh_token) && (getPAG() == -1)) { + if (logmask && LOG_MASK(LOG_DEBUG)) + syslog(LOG_DEBUG, "New PAG created in pam_setcred()"); + setpag(); + } if ( flags & PAM_REFRESH_CRED ) { + if (use_klog) { + auth_ok = do_klog(user, password, "00:00:01"); + ktc_ForgetAllTokens(); + } else { if ( ka_VerifyUserPassword( - KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG, + KA_USERAUTH_VERSION, user, /* kerberos name */ (char *)0, /* instance */ (char *)0, /* realm */ @@ -238,10 +283,13 @@ pam_sm_setcred( auth_ok = 1; } } + } if ( flags & PAM_ESTABLISH_CRED ) { + if (use_klog) auth_ok = do_klog(user, password, NULL); + else { if ( ka_UserAuthenticateGeneral( - KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG, + KA_USERAUTH_VERSION, user, /* kerberos name */ (char *)0, /* instance */ (char *)0, /* realm */ @@ -256,19 +304,22 @@ pam_sm_setcred( auth_ok = 1; } } + } if (!auth_ok && try_first_pass) { password = NULL; goto try_auth; } - if (auth_ok && !got_authtok) { - torch_password = 0; - (void) pam_set_item(pamh, PAM_AUTHTOK, password); - } + /* pam_sm_authenticate should have set this + * if (auth_ok && !got_authtok) { + * torch_password = 0; + * (void) pam_set_item(pamh, PAM_AUTHTOK, password); + * } + */ if (auth_ok) { - if (set_expires && (password_expires >= 0) ) { + if (set_expires && !use_klog && (password_expires >= 0) ) { strcpy(sbuffer, "PASSWORD_EXPIRES="); strcat(sbuffer, cv2string(&sbuffer[100], password_expires)); errcode = pam_putenv( pamh, sbuffer); @@ -276,14 +327,15 @@ pam_sm_setcred( pam_afs_syslog(LOG_ERR, PAMAFS_PASSEXPFAIL, user); } #if defined(AFS_KERBEROS_ENV) - if (upwd) - { + if (!use_klog) { + if (upwd) { if ( chown(ktc_tkt_string(), upwd->pw_uid, upwd->pw_gid) < 0 ) pam_afs_syslog(LOG_ERR, PAMAFS_CHOWNKRB, user); sprintf(sbuffer, "KRBTKFILE=%s", ktc_tkt_string()); errcode = pam_putenv( pamh, sbuffer); if ( errcode != PAM_SUCCESS ) pam_afs_syslog(LOG_ERR, PAMAFS_KRBFAIL, user); + } } #endif diff --git a/src/pam/afs_util.c b/src/pam/afs_util.c index e305adf55..be05fada2 100644 --- a/src/pam/afs_util.c +++ b/src/pam/afs_util.c @@ -9,11 +9,15 @@ #include #include +#include +#include +#include #include #include #include +#include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_util.c,v 1.1.1.4 2001/07/14 22:23:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/afs_util.c,v 1.1.1.5 2001/09/11 14:34:02 hartmans Exp $"); #include "afs_util.h" @@ -53,12 +57,12 @@ these facilities, we can safely define these to be null functions */ #if !defined(AFS_HPUX110_ENV) /* For HP 11.0, this function is in util/hputil.c */ -sigvec() +sigvec(int sig, const struct sigvec* vec, struct sigvec* ovec) { assert(0); } #endif /* AFS_HPUX110_ENV */ -sigsetmask() +sigsetmask(int mask) { assert(0); } @@ -85,3 +89,115 @@ char *cv2string(ttp, aval) return tp; } +int do_klog(const char* user, const char* password, const char* lifetime) +{ +pid_t pid; +int pipedes[2]; +int status; +char* argv[32]; +int argc = 0; +char* klog_prog; +int ret = 1; + +#if defined(AFS_KERBEROS_ENV) + klog_prog = KLOGKRB; +#else + klog_prog = KLOG; +#endif + if (access(klog_prog, X_OK) != 0) { + syslog(LOG_ERR, "can not access klog program '%s'", KLOG); + goto out; + } +#if defined(AFS_KERBEROS_ENV) + argv[argc++] = "klog.krb"; + +#else + argv[argc++] = "klog"; +#endif + argv[argc++] = (char*)user; + argv[argc++] = "-silent"; + argv[argc++] = "-pipe"; + if (lifetime != NULL) { + argv[argc++] = "-lifetime"; + argv[argc++] = (char*)lifetime; + } + argv[argc] = NULL; + + if (pipe(pipedes) != 0) { + syslog(LOG_ERR, "can not open pipe: %s", strerror(errno)); + goto out; + } + pid = fork(); + switch(pid) { + case (-1): /* Error: fork failed */ + syslog(LOG_ERR, "fork failed: %s", strerror(errno)); + goto out; + case (0) : /* child */ + close(0); + dup(pipedes[0]); + close(pipedes[0]); + close(1); + dup(pipedes[1]); + close(pipedes[1]); + execv(klog_prog, argv); + /* notreached */ + syslog(LOG_ERR, "execv failed: %s", strerror(errno)); + close(0); + close(1); + goto out; + default : + write(pipedes[1], password, strlen(password)); + write(pipedes[1], "\n", 1); + close(pipedes[0]); + close(pipedes[1]); + if (pid != wait(&status)) return(0); + if (WIFEXITED(status)) { + ret = WEXITSTATUS(status); + goto out; + } + syslog(LOG_NOTICE, "%s for %s failed", klog_prog, user) ; + } +out: + /* syslog(LOG_DEBUG, "do_klog returns %d", ret); */ + return(ret); +} + +/* get the current AFS pag for the calling process */ +static afs_int32 curpag() +{ + gid_t groups[30]; + afs_uint32 g0, g1; + afs_uint32 h, l, ret; + + if (getgroups(sizeof groups/sizeof groups[0], groups) < 2) return 0; + + g0 = groups[0] & 0xffff; + g1 = groups[1] & 0xffff; + g0 -= 0x3f00; + g1 -= 0x3f00; + if (g0 < 0xc000 && g1 < 0xc000) { + l = ((g0 & 0x3fff) << 14) | (g1 & 0x3fff); + h = (g0 >> 14); + h = (g1 >> 14) + h + h + h; + ret = ((h << 28) | l); + /* Additional testing */ + if (((ret >> 24) & 0xff) == 'A') + return ret; + else + return -1; + } + return -1; +} + +/* Returns the AFS pag number, if any, otherwise return -1 */ +afs_int32 getPAG() +{ + afs_int32 pag; + + pag = curpag(); + if (pag == 0 || pag == -1) + return -1; + + /* high order byte is always 'A'; actual pag value is low 24 bits */ + return (pag & 0xFFFFFF); +} diff --git a/src/pam/afs_util.h b/src/pam/afs_util.h index 7d66bb92e..ff1503730 100644 --- a/src/pam/afs_util.h +++ b/src/pam/afs_util.h @@ -27,6 +27,11 @@ void nil_cleanup( extern char* cv2string(); +#define KLOG "/usr/afsws/bin/klog" +#define KLOGKRB "/usr/afsws/bin/klog.krb" +#define UNLOG "/usr/afsws/bin/unlog" +#define IGNORE_MAX 1000 + #if defined(AFS_HPUX_ENV) #if !defined(AFS_HPUX110_ENV) diff --git a/src/pam/test_pam.c b/src/pam/test_pam.c index d9f1f99ee..5a034aa84 100644 --- a/src/pam/test_pam.c +++ b/src/pam/test_pam.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pam/test_pam.c,v 1.1.1.5 2001/07/14 22:23:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pam/test_pam.c,v 1.1.1.6 2001/09/11 14:34:02 hartmans Exp $"); #include #include @@ -43,6 +43,7 @@ void main(int argc, char *argv[]) int authenticated = 0; int retcode; char *username; + int setcred = 1; if (argc < 2 || argc > 3) { fprintf(stderr, "Usage: %s [-u] \n", argv[0]); @@ -53,7 +54,8 @@ void main(int argc, char *argv[]) fprintf(stderr, "Usage: %s [-u] \n", argv[0]); exit(1); } - service = "unixtest"; + /* service = "unixtest"; */ + setcred = 0; username = argv[2]; } else { username = argv[1]; @@ -81,12 +83,18 @@ void main(int argc, char *argv[]) /* pam_open_session */ + if (setcred) if ((retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED)) != PAM_SUCCESS) { fprintf(stderr, "pam_setcred returned %d.\n", retcode); pam_end(pamh, PAM_ABORT); exit(1); } + if ((retcode = pam_open_session(pamh, PAM_SILENT)) != PAM_SUCCESS) { + fprintf(stderr, "pam_open_session returned %d.\n", retcode); + pam_end(pamh, PAM_ABORT); + exit(1); + } pam_end(pamh, PAM_SUCCESS); putenv(new_envstring); diff --git a/src/pinstall/install.c b/src/pinstall/install.c index e05f09fb8..e20034e2d 100644 --- a/src/pinstall/install.c +++ b/src/pinstall/install.c @@ -49,7 +49,7 @@ Generic install command. Options are: #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/pinstall/install.c,v 1.1.1.5 2001/07/14 22:23:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/pinstall/install.c,v 1.1.1.6 2001/09/11 14:34:03 hartmans Exp $"); #include #include @@ -94,10 +94,6 @@ extern struct passwd *getpwnam(); int stripcalled = 0; #endif -#ifndef rindex -extern char *rindex(); /* this should always be defined, shouldn't it? */ -#endif - #if defined(AFS_HPUX_ENV) && !defined(AFS_HPUX102_ENV) utimes(file,tvp) char *file; @@ -118,7 +114,7 @@ static char *strrpbrk (s, set) char sets[256]; int i; - bzero (sets, sizeof(sets)); + memset(sets, 0, sizeof(sets)); while (*set) sets[(int) *set++] = 1; i = strlen (s); while (i > 0) if (sets[(int)s[--i]]) return &s[i]; @@ -139,7 +135,7 @@ char *ErrorString(aerrno) int stripName(aname) char *aname; - {if (rindex(aname, '.') == 0) return 1; + {if (strrchr(aname, '.') == 0) return 1; else return 0; } @@ -642,7 +638,7 @@ main (argc, argv) for (i=0;i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/db_verify.c,v 1.1.1.5 2001/07/14 22:23:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/db_verify.c,v 1.1.1.6 2001/09/11 14:34:06 hartmans Exp $"); #include #include @@ -269,7 +269,7 @@ afs_int32 WalkHashTable (hashtable, hashType, map, misc) id = ntohl(e.id); if ( ((ntohl(e.flags) & (PRGRP | PRINST)) == 0) && - (index(e.name,'@')) ) { + (strchr(e.name,'@')) ) { /* Foreign user */ if (id > misc->maxForId) misc->maxForId = id; } else { @@ -613,7 +613,7 @@ afs_int32 WalkChains (map, misc) if (code) return code; code = WalkNextChain (map, misc, ea, &e); if (code) return code; - if (index(e.name,'@') == 0) { + if (strchr(e.name,'@') == 0) { misc->nusers++; /* Not a foreign user */ } else { misc->nforeigns++; /* A foreign user */ @@ -724,7 +724,7 @@ afs_int32 DumpRecreate (map, misc) rc = misc->recreate; idmap = misc->idmap; - bzero (idmap, misc->idRange*sizeof(misc->idmap[0])); + memset(idmap, 0, misc->idRange*sizeof(misc->idmap[0])); do { found = 0; for (ei=createLow; einEntries; ei++) { @@ -927,7 +927,7 @@ afs_int32 CheckPrDatabase (misc) if (misc->verbose) printf ("Database has %d entries\n", n); map = (char *)malloc (n); - bzero (map, n); + memset(map, 0, n); misc->nEntries = n; if (misc->verbose) { @@ -959,7 +959,7 @@ afs_int32 CheckPrDatabase (misc) code = -1; goto abort; } - bzero (misc->idmap, misc->idRange*sizeof(misc->idmap[0])); + memset(misc->idmap, 0, misc->idRange*sizeof(misc->idmap[0])); if (misc->verbose) { printf ("\nChecking entry chains\n"); @@ -1052,7 +1052,7 @@ WorkerBee (as, arock) initialize_u_error_table(); pr_dbaseName = AFSDIR_SERVER_PRDB_FILEPATH; - bzero (&misc, sizeof(misc)); + memset(&misc, 0, sizeof(misc)); pr_dbaseName = as->parms[0].items->data; /* -database */ misc.listuheader = (as->parms[1].items ? 1 : 0); /* -uheader */ diff --git a/src/ptserver/ptclient.c b/src/ptserver/ptclient.c index 8ea3a8554..f90061dfc 100644 --- a/src/ptserver/ptclient.c +++ b/src/ptserver/ptclient.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptclient.c,v 1.1.1.4 2001/07/14 22:23:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptclient.c,v 1.1.1.5 2001/09/11 14:34:06 hartmans Exp $"); #ifdef AFS_AIX32_ENV #include @@ -284,7 +284,7 @@ char **argv; else printf("location %d\n",pos); } else if (!strcmp(op,"du")) { - bzero(&entry,sizeof(entry)); + memset(&entry, 0, sizeof(entry)); /* scanf("%d",&pos); */ if (GetInt32 (&pos)) code = PRBADARG; else code = ubik_Call(PR_DumpEntry, pruclient, 0, pos, &entry); @@ -458,7 +458,7 @@ char **argv; else if (!strcmp(op,"fih")) { char tname[128]; struct PrUpdateEntry uentry; - bzero(&uentry, sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); /* scanf("%s",name); */ if (GetString (name, sizeof(name))) { code = PRBADARG; @@ -484,7 +484,7 @@ char **argv; else if (!strcmp(op,"fnh")) { int tid; struct PrUpdateEntry uentry; - bzero(&uentry, sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); /* scanf("%d", &id); */ if (GetInt32 (&id)) { code = PRBADARG; diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index a773d5d5f..db8dec12b 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptprocs.c,v 1.1.1.5 2001/07/14 22:23:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptprocs.c,v 1.1.1.6 2001/09/11 14:34:07 hartmans Exp $"); #include #include @@ -410,7 +410,7 @@ afs_int32 gid; if (code) ABORT_WITH(tt,PRPERM); tempu = FindByID(tt,aid); if (!tempu) ABORT_WITH(tt,PRNOENT); - bzero(&uentry,sizeof(uentry)); + memset(&uentry, 0, sizeof(uentry)); code = pr_ReadEntry(tt,0,tempu,&uentry); if (code != 0) ABORT_WITH(tt,code); /* we don't allow groups as members of groups at present */ @@ -790,8 +790,8 @@ afs_int32 gid; if (!tempu) ABORT_WITH(tt,PRNOENT); tempg = FindByID(tt,gid); if (!tempg) ABORT_WITH(tt,PRNOENT); - bzero(&uentry,sizeof(uentry)); - bzero(&gentry,sizeof(gentry)); + memset(&uentry, 0, sizeof(uentry)); + memset(&gentry, 0, sizeof(gentry)); code = pr_ReadEntry(tt,0,tempu,&uentry); if (code != 0) ABORT_WITH(tt,code); code = pr_ReadEntry(tt,0,tempg,&gentry); @@ -1164,7 +1164,7 @@ struct prcheckentry *aentry; aentry->ngroups = tentry.ngroups; aentry->nusers = tentry.nusers; aentry->count = tentry.count; - bzero (aentry->reserved, sizeof(aentry->reserved)); + memset(aentry->reserved, 0, sizeof(aentry->reserved)); code = ubik_EndTrans(tt); if (code) return code; return PRSUCCESS; @@ -1292,7 +1292,7 @@ afs_int32 put_prentries(tentry, bulkentries) entry->nusers = tentry->nusers; entry->count = tentry->count; strncpy(entry->name,tentry->name,PR_MAXNAMELEN); - bzero(entry->reserved, sizeof(entry->reserved)); + memset(entry->reserved, 0, sizeof(entry->reserved)); bulkentries->prentries_len++; return 0; } diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index 4cafd418e..69f015623 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -14,7 +14,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptuser.c,v 1.1.1.5 2001/07/14 22:23:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptuser.c,v 1.1.1.6 2001/09/11 14:34:08 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -181,7 +181,7 @@ afs_int32 pr_Initialize (secLevel, confDir, cell) com_err (whoami, code, "Could not get afs tokens, running unauthenticated."); - bzero (serverconns, sizeof(serverconns)); /* terminate list!!! */ + memset(serverconns, 0, sizeof(serverconns)); /* terminate list!!! */ for (i = 0;i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptutils.c,v 1.1.1.7 2001/07/14 22:23:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/ptutils.c,v 1.1.1.8 2001/09/11 14:34:08 hartmans Exp $"); #include #include @@ -56,7 +56,7 @@ static int CorrectUserName (name) extern int pr_realmNameLen; /* We accept foreign names, so we will deal with '@' later */ - if (index (name, ':') || index(name, '\n')) return 0; + if (strchr (name, ':') || strchr(name, '\n')) return 0; if (strlen (name) >= PR_MAXNAMELEN - pr_realmNameLen - 1) return 0; return 1; } @@ -104,7 +104,7 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) if (ntohl(tentry.flags) & PRGRP) { if ((tentry.count == 0) && !admin) return PRGROUPEMPTY; /* terminate prefix at colon if there is one */ - if (prefix = index(tentry.name, ':')) *prefix = 0; + if (prefix = strchr(tentry.name, ':')) *prefix = 0; } prefix = tentry.name; } @@ -112,7 +112,7 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) if ((strcmp (prefix, "system") == 0) && !admin) return PRPERM; strcpy (name, aname); /* in case aname & cname are same */ - suffix = index(name, ':'); + suffix = strchr(name, ':'); if (suffix == 0) { /* sysadmin can make groups w/o ':', but they must still look like * legal user names. */ @@ -126,10 +126,10 @@ static afs_int32 CorrectGroupName (ut, aname, cid, oid, cname) } done: /* check for legal name with either group rules or user rules */ - if (suffix = index(cname, ':')) { + if (suffix = strchr(cname, ':')) { /* check for confusing characters */ - if (index(cname, '\n') || /* restrict so recreate can work */ - index(suffix+1, ':')) /* avoid multiple colons */ + if (strchr(cname, '\n') || /* restrict so recreate can work */ + strchr(suffix+1, ':')) /* avoid multiple colons */ return PRBADNAM; } else { if (!CorrectUserName (cname)) return PRBADNAM; @@ -193,7 +193,7 @@ afs_int32 CreateEntry (at, aname, aid, idflag, flag, oid, creator) struct prentry tentry, tent; char *atsign; - bzero(&tentry, sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); if ((oid == 0) || (oid == ANONYMOUSID)) oid = creator; @@ -224,7 +224,7 @@ afs_int32 CreateEntry (at, aname, aid, idflag, flag, oid, creator) return PRBADARG; } - atsign = index(aname,'@'); + atsign = strchr(aname, '@'); if (!atsign) { /* A normal user or group. Pick an id for it */ if (idflag) @@ -431,7 +431,7 @@ afs_int32 RemoveFromEntry (at, aid, bid) afs_int32 hloc; if (aid == bid) return PRINCONSISTENT; - bzero(&hentry,sizeof(hentry)); + memset(&hentry, 0, sizeof(hentry)); temp = FindByID(at,bid); if (temp == 0) return PRNOENT; code = pr_ReadEntry(at, 0, temp, &tentry); @@ -487,7 +487,7 @@ afs_int32 RemoveFromEntry (at, aid, bid) } /* for all coentry slots */ hloc = nptr; nptr = centry.next; - bcopy(¢ry,&hentry,sizeof(centry)); + memcpy(&hentry, ¢ry, sizeof(centry)); } /* while there are coentries */ return PRNOENT; } @@ -505,7 +505,7 @@ afs_int32 DeleteEntry (at, tentry, loc) afs_int32 i; afs_int32 nptr; - if (index(tentry->name,'@')) { + if (strchr(tentry->name,'@')) { if (tentry->flags & PRGRP) { /* If there are still foreign user accounts from that cell don't delete the group */ @@ -594,7 +594,7 @@ afs_int32 DeleteEntry (at, tentry, loc) if (inc_header_word (at, instcount, -1)) return PRDBFAIL; } else { - if (index(tentry->name,'@')) { + if (strchr(tentry->name,'@')) { if (inc_header_word (at, foreigncount, -1)) return PRDBFAIL; } else { if (inc_header_word (at, usercount, -1)) return PRDBFAIL; @@ -698,7 +698,7 @@ afs_int32 AddToEntry (tt, entry, loc, aid) else { entry->next = nptr; } - bzero(&aentry,sizeof(aentry)); + memset(&aentry, 0, sizeof(aentry)); aentry.flags |= PRCONT; aentry.id = entry->id; aentry.next = 0; @@ -1091,8 +1091,8 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) char oldname[PR_MAXNAMELEN]; char *atsign; - bzero(holder,PR_MAXNAMELEN); - bzero(temp,PR_MAXNAMELEN); + memset(holder, 0, PR_MAXNAMELEN); + memset(temp, 0, PR_MAXNAMELEN); loc = FindByID(at,aid); if (!loc) return PRNOENT; code = pr_ReadEntry(at,0,loc,&tentry); @@ -1163,7 +1163,7 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) } } - atsign = index(tentry.name, '@'); /* check for foreign entry */ + atsign = strchr(tentry.name, '@'); /* check for foreign entry */ /* Change the owner */ if (oid && (oid != tentry.owner)) { @@ -1216,7 +1216,7 @@ afs_int32 ChangeEntry (at, aid, cid, name, oid, newid) { char *newatsign; - newatsign = index (name, '@'); + newatsign = strchr(name, '@'); if (newatsign != atsign){ /* if they are the same no problem*/ /*if the pointers are not equal the strings better be */ if ((atsign == NULL) || (newatsign == NULL) || @@ -1301,7 +1301,7 @@ AddAuthGroup(tentry, alist, size) prlist *alist; afs_int32 *size; { - if (!(index(tentry->name, '@'))) + if (!(strchr(tentry->name, '@'))) return (AddToPRList (alist, size, AUTHUSERID)); else return PRSUCCESS; diff --git a/src/ptserver/readgroup.c b/src/ptserver/readgroup.c index fc1f31f64..b46868536 100644 --- a/src/ptserver/readgroup.c +++ b/src/ptserver/readgroup.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/readgroup.c,v 1.1.1.4 2001/07/14 22:23:20 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/readgroup.c,v 1.1.1.5 2001/09/11 14:34:09 hartmans Exp $"); #include #ifndef AFS_NT40_ENV @@ -107,14 +107,14 @@ char **argv; if (buf[0] == '\n') break; if (buf[0] != ' ' && buf[0] != '\t') { /* grab the group name */ - bzero(gname,PR_MAXNAMELEN); - bzero(owner,PR_MAXNAMELEN); + memset(gname, 0, PR_MAXNAMELEN); + memset(owner, 0, PR_MAXNAMELEN); sscanf(buf,"%s %d",gname,&id); tmp = buf; skip(&tmp); skip(&tmp); stolower(gname); - ptr = index(gname,':'); + ptr = strchr(gname, ':'); strncpy(owner,gname,ptr-gname); if (strcmp(owner,"system") == 0) strncpy(owner,"system:administrators",PR_MAXNAMELEN); @@ -133,9 +133,9 @@ char **argv; } if (!fail) { /* read members out of buf and add to the group */ - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); while (sscanf(tmp,"%s",name) != EOF) { - if (index(name,':') == NULL) { + if (strchr(name,':') == NULL) { /* then it's not a group */ code = pr_AddToGroup(name,gname); report_error (code, name, gname); @@ -155,7 +155,7 @@ char **argv; } if (lnames.namelist_val) free(lnames.namelist_val); } - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); skip(&tmp); } } @@ -164,11 +164,11 @@ char **argv; /* if we couldn't create the group, and it wasn't already there, don't try to add more users */ if (fail) continue; /* read members out of buf and add to the group */ - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); tmp = buf; tmp++; while (sscanf(tmp,"%s",name) != EOF) { - if (index(name,':') == NULL) { + if (strchr(name,':') == NULL) { /* then it's not a group */ code = pr_AddToGroup(name,gname); report_error (code, name, gname); @@ -188,7 +188,7 @@ char **argv; } if (lnames.namelist_val) free(lnames.namelist_val); } - bzero(name,PR_MAXNAMELEN); + memset(name, 0, PR_MAXNAMELEN); skip(&tmp); } } diff --git a/src/ptserver/readpwd.c b/src/ptserver/readpwd.c index 445306ee1..0fc633615 100644 --- a/src/ptserver/readpwd.c +++ b/src/ptserver/readpwd.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/readpwd.c,v 1.1.1.4 2001/07/14 22:23:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/readpwd.c,v 1.1.1.5 2001/09/11 14:34:09 hartmans Exp $"); #include #ifndef AFS_NT40_ENV @@ -82,12 +82,12 @@ char **argv; exit(2); } while ((tmp = fgets(buf,150,fp)) != NULL) { - bzero(name,PR_MAXNAMELEN); - bzero(uid,8); - ptr = index(buf,':'); + memset(name, 0, PR_MAXNAMELEN); + memset(uid, 0, 8); + ptr = strchr(buf, ':'); strncpy(name,buf,ptr-buf); - aptr = index(++ptr,':'); - ptr = index(++aptr,':'); + aptr = strchr(++ptr, ':'); + ptr = strchr(++aptr, ':'); strncpy(uid,aptr,ptr-aptr); id = atoi(uid); if (verbose) diff --git a/src/ptserver/testpt.c b/src/ptserver/testpt.c index 40a30a3e9..62844ccfa 100644 --- a/src/ptserver/testpt.c +++ b/src/ptserver/testpt.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/testpt.c,v 1.1.1.5 2001/07/14 22:23:21 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/testpt.c,v 1.1.1.6 2001/09/11 14:34:10 hartmans Exp $"); #include #include @@ -464,12 +464,12 @@ TestManyMembers (as, arock) population = (char *)malloc (sqr(number)*sizeof(char)); nFilled = 0; - bzero (filled, number); + memset(filled, 0, number); nCleaned = 0; - bzero (cleaned, number); - bzero (population, sqr(number)); - bzero (users, number*sizeof(afs_int32)); - bzero (groups, number*sizeof(afs_int32)); + memset(cleaned, 0, number); + memset(population, 0, sqr(number)); + memset(users, 0, number*sizeof(afs_int32)); + memset(groups, 0, number*sizeof(afs_int32)); ownerUser = lastGroup = 0; groupOwners = (afs_int32 *) malloc (number*sizeof(afs_int32)); @@ -898,7 +898,7 @@ static int MyBeforeProc (as, arock) strncpy (cellinfo.hostName[i], serverList->data, MAXHOSTCHARS); th = gethostbyname(cellinfo.hostName[i]); if (!th) return UBADHOST; - bcopy(th->h_addr, &cellinfo.hostAddr[i].sin_addr, sizeof(afs_int32)); + memcpy(&cellinfo.hostAddr[i].sin_addr, th->h_addr, sizeof(afs_int32)); cellinfo.hostAddr[i].sin_family = AF_INET; cellinfo.hostAddr[i].sin_port = 0; } diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index 9231dca9a..465e6f989 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/utils.c,v 1.1.1.5 2001/07/14 22:23:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ptserver/utils.c,v 1.1.1.6 2001/09/11 14:34:10 hartmans Exp $"); #include #include @@ -90,7 +90,7 @@ struct prentry *tentry; struct prentry nentry; if (ntohl(1) != 1) { /* Need to swap bytes. */ - bzero (&nentry, sizeof(nentry)); /* make sure reseved fields are zero */ + memset(&nentry, 0, sizeof(nentry)); /* make sure reseved fields are zero */ nentry.flags = htonl(tentry->flags); nentry.id = htonl(tentry->id); nentry.cellid = htonl(tentry->cellid); @@ -140,7 +140,7 @@ struct prentry *tentry; } code = ubik_Read(tt, (char *) &nentry, sizeof(struct prentry)); if (code) return (code); - bzero (tentry, sizeof(*tentry)); /* make sure reseved fields are zero */ + memset(tentry, 0, sizeof(*tentry)); /* make sure reseved fields are zero */ tentry->flags = ntohl(nentry.flags); tentry->id = ntohl(nentry.id); tentry->cellid = ntohl(nentry.cellid); @@ -181,7 +181,7 @@ pr_WriteCoEntry(tt, afd, pos, tentry) struct contentry nentry; if (ntohl(1) != 1) { /* No need to swap */ - bzero (&nentry, sizeof(nentry)); /* make reseved fields zero */ + memset(&nentry, 0, sizeof(nentry)); /* make reseved fields zero */ nentry.flags = htonl(tentry->flags); nentry.id = htonl(tentry->id); nentry.cellid = htonl(tentry->cellid); @@ -211,7 +211,7 @@ struct contentry *tentry; } code = ubik_Read(tt, (char *) &nentry, sizeof(struct contentry)); if (code) return (code); - bzero (tentry, sizeof(*tentry)); /* make reseved fields zero */ + memset(tentry, 0, sizeof(*tentry)); /* make reseved fields zero */ tentry->flags = ntohl(nentry.flags); tentry->id = ntohl(nentry.id); tentry->cellid = ntohl(nentry.cellid); @@ -259,7 +259,7 @@ afs_int32 pos; register afs_int32 code; struct prentry tentry; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); tentry.next = ntohl(cheader.freePtr); tentry.flags |= PRFREE; cheader.freePtr = htonl(pos); @@ -284,13 +284,13 @@ afs_int32 aid; i = IDHash(aid); entry = ntohl(cheader.idHash[i]); if (entry == 0) return entry; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at, 0, entry, &tentry); if (code != 0) return 0; if (aid == tentry.id) return entry; entry = tentry.nextID; while (entry != 0) { - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at,0,entry,&tentry); if (code != 0) return 0; if (aid == tentry.id) return entry; @@ -314,13 +314,13 @@ struct prentry *tentryp; i = NameHash(aname); entry = ntohl(cheader.nameHash[i]); if (entry == 0) return entry; - bzero(tentryp,sizeof(struct prentry)); + memset(tentryp, 0, sizeof(struct prentry)); code = pr_ReadEntry(at, 0, entry, tentryp); if (code != 0) return 0; if ((strncmp(aname,tentryp->name,PR_MAXNAMELEN)) == 0) return entry; entry = tentryp->nextName; while (entry != 0) { - bzero(tentryp, sizeof(struct prentry)); + memset(tentryp, 0, sizeof(struct prentry)); code = pr_ReadEntry(at,0,entry, tentryp); if (code != 0) return 0; if ((strncmp(aname,tentryp->name,PR_MAXNAMELEN)) == 0) return entry; @@ -436,8 +436,8 @@ afs_int32 *loc; /* ??? in case ID hashed twice ??? */ if ((aid == PRBADID) || (aid == 0)) return PRINCONSISTENT; i = IDHash(aid); current = ntohl(cheader.idHash[i]); - bzero(&tentry,sizeof(tentry)); - bzero(&bentry,sizeof(bentry)); + memset(&tentry, 0, sizeof(tentry)); + memset(&bentry, 0, sizeof(bentry)); trail = 0; if (current == 0) return PRSUCCESS; /* already gone */ code = pr_ReadEntry(tt,0,current,&tentry); @@ -478,7 +478,7 @@ afs_int32 loc; /* ??? */ if ((aid == PRBADID) || (aid == 0)) return PRINCONSISTENT; i = IDHash(aid); - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(tt,0,loc,&tentry); if (code) return PRDBFAIL; tentry.nextID = ntohl(cheader.idHash[i]); @@ -503,8 +503,8 @@ afs_int32 *loc; i = NameHash(aname); current = ntohl(cheader.nameHash[i]); - bzero(&tentry,sizeof(tentry)); - bzero(&bentry,sizeof(bentry)); + memset(&tentry, 0, sizeof(tentry)); + memset(&bentry, 0, sizeof(bentry)); trail = 0; if (current == 0) return PRSUCCESS; /* already gone */ code = pr_ReadEntry(tt,0,current,&tentry); @@ -544,7 +544,7 @@ afs_int32 loc; struct prentry tentry; i = NameHash(aname); - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(tt,0,loc,&tentry); if (code) return PRDBFAIL; tentry.nextName = ntohl(cheader.nameHash[i]); @@ -690,7 +690,7 @@ afs_int32 gid; return PRSUCCESS; } nptr = ntohl(cheader.orphan); - bzero(&bentry,sizeof(bentry)); + memset(&bentry, 0, sizeof(bentry)); loc = 0; while (nptr != 0) { code = pr_ReadEntry(at,0,nptr,&tentry); @@ -707,7 +707,7 @@ afs_int32 gid; } loc = nptr; nptr = tentry.nextOwned; - bcopy(&tentry,&bentry, sizeof(tentry)); + memcpy(&bentry, &tentry, sizeof(tentry)); } return PRSUCCESS; } @@ -765,7 +765,7 @@ afs_int32 gid; if ((gid == 0) || (aid == 0)) return 0; loc = FindByID(at,gid); if (!loc) return 0; - bzero(&tentry,sizeof(tentry)); + memset(&tentry, 0, sizeof(tentry)); code = pr_ReadEntry(at, 0, loc,&tentry); if (code) return 0; if (!(tentry.flags & PRGRP)) return 0; @@ -776,7 +776,7 @@ afs_int32 gid; if (tentry.next) { loc = tentry.next; while (loc) { - bzero(¢ry,sizeof(centry)); + memset(¢ry, 0, sizeof(centry)); code = pr_ReadCoEntry(at,0,loc,¢ry); if (code) return 0; for (i=0;i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rcp/rcp.c,v 1.1.1.4 2001/07/14 22:23:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rcp/rcp.c,v 1.1.1.5 2001/09/11 14:34:11 hartmans Exp $"); #include #include @@ -70,7 +70,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rcp/rcp.c,v 1.1.1.4 2001/07/14 22:23:23 #endif int rem; -char *colon(), *index(), *rindex(), *malloc(), *strcpy(); +char *colon(), *malloc(), *strcpy(); int errs; #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) extern char *sys_errlist[]; @@ -170,7 +170,7 @@ main(argc, argv) *targ++ = 0; if (*targ == 0) targ = "."; - thost = index(argv[argc - 1], '@'); + thost = strchr(argv[argc - 1], '@'); if (thost) { *thost++ = 0; tuser = argv[argc - 1]; @@ -197,7 +197,7 @@ main(argc, argv) *src++ = 0; if (*src == 0) src = "."; - host = index(argv[i], '@'); + host = strchr(argv[i], '@'); if (host) { *host++ = 0; suser = argv[i]; @@ -258,7 +258,7 @@ main(argc, argv) *src++ = 0; if (*src == 0) src = "."; - host = index(argv[i], '@'); + host = strchr(argv[i], '@'); if (host) { *host++ = 0; suser = argv[i]; @@ -415,7 +415,7 @@ notreg: error("rcp: %s: not a plain file\n", name); continue; } - last = rindex(name, '/'); + last = strrchr(name, '/'); if (last == 0) last = name; else @@ -477,7 +477,7 @@ rsource(name, statp) error("rcp: %s: %s\n", name, sys_errlist[errno]); return; } - last = rindex(name, '/'); + last = strrchr(name, '/'); if (last == 0) last = name; else diff --git a/src/rlogind/rexecd.c b/src/rlogind/rexecd.c index 010a3b5ba..4a32b091c 100644 --- a/src/rlogind/rexecd.c +++ b/src/rlogind/rexecd.c @@ -7,7 +7,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rlogind/rexecd.c,v 1.1.1.3 2001/07/14 22:23:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rlogind/rexecd.c,v 1.1.1.4 2001/09/11 14:34:11 hartmans Exp $"); #include /* for UserAuthGeneral */ #include @@ -36,7 +36,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rlogind/rexecd.c,v 1.1.1.3 2001/07/14 2 extern errno; struct passwd *getpwnam(); -char *crypt(), *rindex(), *strncat(); +char *crypt(), *strncat(); #if !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SUN5_ENV) char *sprintf(); #endif @@ -326,7 +326,7 @@ doit(f, fromp) addenvvar("PASSWORD_EXPIRES", pwd_expires_str); } #endif - cp = rindex(pwd->pw_shell, '/'); + cp = strrchr(pwd->pw_shell, '/'); if (cp) cp++; else diff --git a/src/rlogind/rlogind.c b/src/rlogind/rlogind.c index 5a9cf2e73..e8e442eca 100644 --- a/src/rlogind/rlogind.c +++ b/src/rlogind/rlogind.c @@ -19,7 +19,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rlogind/rlogind.c,v 1.1.1.3 2001/07/14 22:23:24 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rlogind/rlogind.c,v 1.1.1.4 2001/09/11 14:34:12 hartmans Exp $"); #ifdef MSG #include "rlogind_msg.h" @@ -239,7 +239,7 @@ main(argc, argv) syslog(LOG_WARNING,MSGSTR(SETDEBUG,"setsockopt (SO_DEBUG): %m")); /*MSG*/ /* set-up signal handler routines for SRC TRACE ON/OFF support */ - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sa.sa_flags = SA_RESTART; @@ -378,11 +378,11 @@ doit(f, fromp) hp = gethostbyname(remotehost); if (hp) #if defined(BSD_42) - if (!bcmp(hp->h_addr, (caddr_t)&fromp->sin_addr, + if (!memcmp(hp->h_addr, (caddr_t)&fromp->sin_addr, sizeof(fromp->sin_addr))) { #else /* BSD_42 */ for (; hp->h_addr_list[0]; hp->h_addr_list++) - if (!bcmp(hp->h_addr_list[0], (caddr_t)&fromp->sin_addr, + if (!memcmp(hp->h_addr_list[0], (caddr_t)&fromp->sin_addr, sizeof(fromp->sin_addr))) { #endif /* BSD_42 */ hostok++; @@ -745,7 +745,7 @@ gotpty: { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; sigaction(SIGQUIT, &sa, (struct sigaction *)0); sa.sa_handler = SIG_DFL; @@ -779,7 +779,7 @@ gotpty: { struct sigaction sa; - bzero((char *)&sa, sizeof(sa)); + memset((char *)&sa, 0, sizeof(sa)); sa.sa_mask.losigs = sigmask(SIGUSR2); sa.sa_handler = trace_handler; sigaction(SIGUSR1, &sa, (struct sigaction *)0); @@ -911,7 +911,7 @@ control(pty, cp, n) if (n < 4+sizeof (w) || cp[2] != 's' || cp[3] != 's') return (0); oobdata[0] &= ~TIOCPKT_WINDOW; /* we know he heard */ - bcopy(cp+4, (char *)&w, sizeof(w)); + memcpy((char *)&w, cp+4, sizeof(w)); w.ws_row = ntohs(w.ws_row); w.ws_col = ntohs(w.ws_col); w.ws_xpixel = ntohs(w.ws_xpixel); @@ -1031,7 +1031,7 @@ protocol(f, p) if (n) { left -= n; if (left > 0) - bcopy(cp+n, cp, left); + memcpy(cp, cp+n, left); fcc -= n; goto top; /* n^2 */ } @@ -1274,7 +1274,7 @@ setup_term(fd) int fd; { #ifndef AFS_OSF_ENV - register char *cp = index(term, '/'), **cpp; + register char *cp = strchr(term, '/'), **cpp; #endif #ifdef AFS_AIX32_ENV #ifdef _AIX @@ -1301,7 +1301,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; #ifdef _AIX @@ -1364,7 +1364,7 @@ setup_term(fd) #else /* AFS_AIX32_ENV */ #ifdef AFS_OSF_ENV - register char *cp = index(term+ENVSIZE, '/'); + register char *cp = strchr(term+ENVSIZE, '/'); char *speed; struct termios tt; @@ -1372,7 +1372,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; cfsetspeed(&tt, atoi(speed)); @@ -1381,7 +1381,7 @@ setup_term(fd) tt.c_iflag = TTYDEF_IFLAG; tt.c_oflag = TTYDEF_OFLAG; tt.c_lflag = TTYDEF_LFLAG; - bcopy(ttydefchars, tt.c_cc, sizeof(tt.c_cc)); + memcpy(tt.c_cc, ttydefchars, sizeof(tt.c_cc)); tcsetattr(fd, TCSAFLUSH, &tt); #else struct sgttyb sgttyb; @@ -1391,7 +1391,7 @@ setup_term(fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++) @@ -1421,7 +1421,7 @@ local_domain(h) char *h; { char localhost[MAXHOSTNAMELEN]; - char *p1, *p2 = index(h, '.'); + char *p1, *p2 = strchr(h, '.'); #ifdef AFS_OSF_ENV char *topdomain(); @@ -1433,7 +1433,7 @@ local_domain(h) p1 = topdomain(localhost); p2 = topdomain(h); #else - p1 = index(localhost, '.'); + p1 = strchr(localhost, '.'); #endif if (p1 == NULL || p2 == NULL || !strcasecmp(p1, p2)) return(1); @@ -1793,7 +1793,7 @@ int s; /* (5) sessionKey */ bp = bp + index + 1; - bcopy(bp, token.sessionKey.data, 8); + memcpy(token.sessionKey.data, bp, 8); /* (6) kvno */ @@ -1843,7 +1843,7 @@ int s; exit(1); } - bcopy(bp, token.ticket, token.ticketLen); + memcpy(token.ticket, bp, token.ticketLen); bp = bp + token.ticketLen; diff --git a/src/rsh/rcmd.c b/src/rsh/rcmd.c index c9e2b26a2..8f4614e75 100644 --- a/src/rsh/rcmd.c +++ b/src/rsh/rcmd.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rcmd.c,v 1.1.1.5 2001/07/14 22:23:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rcmd.c,v 1.1.1.6 2001/09/11 14:34:12 hartmans Exp $"); #ifdef aiws /*AIX*/ #include @@ -76,8 +76,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rcmd.c,v 1.1.1.5 2001/07/14 22:23:2 # define DPRINTF(args) #endif -char *index(); - #include static _checkhost(); @@ -116,7 +114,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) struct hostent *hp; fd_set reads; - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); someSignals[0] = 1<<(SIGURG-1); sigBlock = *((sigset_t *)someSignals); @@ -156,9 +154,9 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #endif sin.sin_family = hp->h_addrtype; #ifdef AFS_OSF_ENV - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr_list[0], hp->h_length); #else - bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr, hp->h_length); #endif sin.sin_port = rport; /* attempt to remote authenticate first... */ @@ -231,8 +229,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) errno = oerrno; perror(0); hp->h_addr_list++; - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, - hp->h_length); + memcpy((caddr_t)&sin.sin_addr, hp->h_addr_list[0], hp->h_length); fprintf(stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr)); continue; @@ -597,7 +594,7 @@ _checkhost(rhost, lhost, len) return(0); } ldomain[MAXHOSTNAMELEN] = '\0'; - if ((domainp = index(ldomain, '.')) == (char *)NULL) { + if ((domainp = strchr(ldomain, '.')) == (char *)NULL) { nodomain = 1; return(0); } diff --git a/src/rsh/rlogin.c b/src/rsh/rlogin.c index 611920e19..6d02dc2d3 100644 --- a/src/rsh/rlogin.c +++ b/src/rsh/rlogin.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rlogin.c,v 1.1.1.3 2001/07/14 22:23:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rlogin.c,v 1.1.1.4 2001/09/11 14:34:13 hartmans Exp $"); #if !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) #include @@ -32,7 +32,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rlogin.c,v 1.1.1.3 2001/07/14 22:23 # define TIOCPKT_WINDOW 0x80 # endif /* TIOCPKT_WINDOW */ -char *index(), *rindex(), *malloc(), *getenv(); +char *malloc(), *getenv(); struct passwd *getpwuid(); char *name; int rem; @@ -78,7 +78,7 @@ main(argc, argv) setlocale(LC_ALL,""); #endif - host = rindex(argv[0], '/'); + host = strrchr(argv[0], '/'); if (host) host++; else @@ -372,7 +372,7 @@ sigwinch() struct winsize ws; if (dosigwinch && !nosigwin && ioctl(0, TIOCGWINSZ, &ws) == 0 && - bcmp(&ws, &winsize, sizeof (ws))) { + memcmp(&ws, &winsize, sizeof (ws))) { winsize = ws; sendwindow(); } diff --git a/src/rsh/rsh.c b/src/rsh/rsh.c index 38fa5c8b9..796733af3 100644 --- a/src/rsh/rsh.c +++ b/src/rsh/rsh.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rsh.c,v 1.1.1.3 2001/07/14 22:23:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rsh/rsh.c,v 1.1.1.4 2001/09/11 14:34:13 hartmans Exp $"); #include /* select() prototype */ #include /* fd_set on older platforms */ @@ -139,7 +139,7 @@ main(argc, argv0) */ check_and_run_afs_vers(argv); #endif - bzero(&ign_act, sizeof(ign_act)); + memset(&ign_act, 0, sizeof(ign_act)); ign_act.sa_handler=SIG_IGN; #endif host = strrchr(argv[0], '/'); @@ -331,7 +331,7 @@ another: } (void) setuid(getuid()); - bzero((char *)someSignals, sizeof(someSignals)); + memset((char *)someSignals, 0, sizeof(someSignals)); #ifdef AFS_HPUX_ENV someSignals[0] = mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM)|mask(SIGHUP); #else diff --git a/src/rx/AIX/rx_knet.c b/src/rx/AIX/rx_knet.c index ef91730dc..352647f61 100644 --- a/src/rx/AIX/rx_knet.c +++ b/src/rx/AIX/rx_knet.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/AIX/rx_knet.c,v 1.1.1.4 2001/07/14 22:23:39 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/AIX/rx_knet.c,v 1.1.1.5 2001/09/11 14:34:28 hartmans Exp $"); #ifdef AFS_AIX41_ENV #include "../rx/rx_kcommon.h" @@ -109,7 +109,7 @@ void ip_stripoptions(struct mbuf *m, STRIP_ARG2_TYPE mopt) olen = (ip->ip_hl<<2) - sizeof (struct ip); opts = (caddr_t)(ip + 1); i = m->m_len - (sizeof (struct ip) + olen); - bcopy(opts + olen, opts, (unsigned)i); + memcpy(opts, opts + olen, (unsigned)i); m->m_len -= olen; if (m->m_flags & M_PKTHDR) m->m_pkthdr.len -= olen; @@ -382,7 +382,7 @@ int istack; m->m_len = 0; while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -416,7 +416,7 @@ int istack; m_freem(top); /* free mbuf chain */ return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); um->m_pkthdr.len = sizeof(*addr); um->m_flags |= M_PKTHDR; diff --git a/src/rx/DARWIN/rx_knet.c b/src/rx/DARWIN/rx_knet.c index efe356eed..92886b94b 100644 --- a/src/rx/DARWIN/rx_knet.c +++ b/src/rx/DARWIN/rx_knet.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DARWIN/rx_knet.c,v 1.1.1.3 2001/07/14 22:23:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DARWIN/rx_knet.c,v 1.1.1.4 2001/09/11 14:34:30 hartmans Exp $"); #include "../rx/rx_kcommon.h" @@ -153,7 +153,7 @@ osi_NetSend(asocket, addr, dvec, nvecs, alength, istack) goto bad; } nam->m_len=addr->sin_len=sizeof(struct sockaddr_in); - bcopy((caddr_t)addr, mtod(nam, caddr_t), addr->sin_len); + memcpy(mtod(nam, caddr_t), (caddr_t)addr, addr->sin_len); code = sosend(asocket, mtod(nam, struct sockaddr *), &u, NULL, NULL, 0); m_freem(nam); bad: diff --git a/src/rx/DUX/rx_knet.c b/src/rx/DUX/rx_knet.c index 1f0adbaba..6c0c1f379 100644 --- a/src/rx/DUX/rx_knet.c +++ b/src/rx/DUX/rx_knet.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DUX/rx_knet.c,v 1.1.1.4 2001/07/14 22:23:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DUX/rx_knet.c,v 1.1.1.5 2001/09/11 14:34:29 hartmans Exp $"); #ifdef AFS_DUX40_ENV #include "../rx/rx_kcommon.h" @@ -31,7 +31,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ extern int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; /* @@ -292,7 +292,7 @@ nopages: tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -328,7 +328,7 @@ nopages: splx(s); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/FBSD/rx_knet.c b/src/rx/FBSD/rx_knet.c index b5abc37fd..5136de965 100644 --- a/src/rx/FBSD/rx_knet.c +++ b/src/rx/FBSD/rx_knet.c @@ -23,7 +23,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/FBSD/rx_knet.c,v 1.1.1.3 2001/07/14 22:23:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/FBSD/rx_knet.c,v 1.1.1.4 2001/09/11 14:34:30 hartmans Exp $"); #ifdef AFS_FBSD40_ENV #include "../rx/rx_kcommon.h" @@ -44,7 +44,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ extern int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; /* @@ -303,7 +303,7 @@ nopages: tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -339,7 +339,7 @@ nopages: splx(s); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/HPUX/rx_knet.c b/src/rx/HPUX/rx_knet.c index 8032113ae..ff72371ca 100644 --- a/src/rx/HPUX/rx_knet.c +++ b/src/rx/HPUX/rx_knet.c @@ -5,7 +5,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/HPUX/rx_knet.c,v 1.1.1.3 2001/07/14 22:23:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/HPUX/rx_knet.c,v 1.1.1.4 2001/09/11 14:34:31 hartmans Exp $"); #include "../h/types.h" #include "../h/param.h" @@ -74,7 +74,7 @@ rxk_init() { /* force UDP checksumming on for AFS */ int udpcksum; udpcksum = 1; - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; rxk_initDone = 1; @@ -227,14 +227,14 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) /* Guess based on rxk_NewSocket */ bp = allocb((size+SO_MSGOFFSET+1), BPRI_MED); if (!bp) return ENOBUFS; - bcopy((caddr_t)addr, (caddr_t)bp->b_rptr+SO_MSGOFFSET, size); + memcpy((caddr_t)bp->b_rptr+SO_MSGOFFSET, (caddr_t)addr, size); bp->b_wptr = bp->b_rptr + (size+SO_MSGOFFSET+1); - bcopy((caddr_t)dvec, (caddr_t)temp, nvec * sizeof(struct iovec)); + memcpy((caddr_t)temp, (caddr_t)dvec, nvec * sizeof(struct iovec)); /* devresource.hp.com/Drivers/Docs/Refs/11i/ddRef/Chap02R.pdf has details on use of uio */ - bzero((caddr_t)&uio, sizeof(uio)); + memset((caddr_t)&uio, 0, sizeof(uio)); uio.uio_resid = asize; uio.uio_iov = temp; uio.uio_iovcnt = nvec; @@ -258,7 +258,7 @@ int osi_NetReceive(struct socket *so, struct sockaddr_in *from, if (iovcnt > RX_MAXWVECS+2) { osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt); } - bcopy((char*)iov, tmpvec, iovcnt/*(RX_MAXWVECS+1)*/ * sizeof(struct iovec)); + memcpy(tmpvec, (char*)iov, iovcnt/*(RX_MAXWVECS+1)*/ * sizeof(struct iovec)); tuio.uio_iov = tmpvec; tuio.uio_iovcnt = iovcnt; tuio.uio_fpflags = 0; @@ -270,7 +270,7 @@ int osi_NetReceive(struct socket *so, struct sockaddr_in *from, if (!code) { *lengthp = *lengthp - tuio.uio_resid; if (bp) { - bcopy((char*)bp->b_rptr, (char*)from, sizeof(struct sockaddr_in)); + memcpy((char*)from, (char*)bp->b_rptr, sizeof(struct sockaddr_in)); } else { code = -1; } diff --git a/src/rx/IRIX/rx_knet.c b/src/rx/IRIX/rx_knet.c index 0835620e8..44493d2b3 100644 --- a/src/rx/IRIX/rx_knet.c +++ b/src/rx/IRIX/rx_knet.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/IRIX/rx_knet.c,v 1.1.1.4 2001/07/14 22:23:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/IRIX/rx_knet.c,v 1.1.1.5 2001/09/11 14:34:31 hartmans Exp $"); #include "../rx/rx_kcommon.h" #include "../h/tcp-param.h" @@ -68,7 +68,7 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from, if (iovcnt > RX_MAXWVECS+2) { osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt); } - bcopy((char*)iov, tmpvec, (RX_MAXWVECS+1) * sizeof(struct iovec)); + memcpy(tmpvec, (char*)iov, (RX_MAXWVECS+1) * sizeof(struct iovec)); #ifdef AFS_SGI65_ENV code = soreceive(&bhv, &maddr, &tuio, NULL, NULL); #else @@ -103,7 +103,7 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from, else { *lengthp = *lengthp - tuio.uio_resid; if (maddr) { - bcopy((char*)mtod(maddr, struct sockaddr_in *), (char*)from, + memcpy((char*)from, (char*)mtod(maddr, struct sockaddr_in *), sizeof(struct sockaddr_in)); m_freem(maddr); } @@ -262,7 +262,7 @@ void rxk_init(void) { last = inetdomain.dom_protoswNPROTOSW; for (tpro = inetdomain.dom_protosw; tpro < last; tpro++) { if (tpro->pr_protocol == IPPROTO_UDP) { - bcopy(tpro, &parent_proto, sizeof(parent_proto)); + memcpy(&parent_proto, tpro, sizeof(parent_proto)); tpro->pr_input = rxk_input; tpro->pr_fasttimo = rxk_fasttimo; rxk_initDone = 1; @@ -424,7 +424,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) if (nvec > RX_MAXWVECS+1) { osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvec); } - bcopy((char*)dvec, (char*)tvecs, nvec * sizeof(struct iovec)); + memcpy((char*)tvecs, (char*)dvec, nvec * sizeof(struct iovec)); tuio.uio_iov = tvecs; tuio.uio_iovcnt = nvec; @@ -441,7 +441,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) to = m_get(M_WAIT, MT_SONAME); to->m_len = sizeof(struct sockaddr_in); - bcopy((char*)addr, mtod(to, caddr_t), to->m_len); + memcpy(mtod(to, caddr_t), (char*)addr, to->m_len); BHV_PDATA(&bhv) = (void*)asocket; code = sosend(&bhv, to, &tuio, 0, NULL); @@ -522,7 +522,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) tpa = mtod(m, caddr_t); while (len) { rlen = MIN(len, tl); - bcopy(tdata, tpa, rlen); + memcpy(tpa, tdata, rlen); asize -= rlen; len -= rlen; tpa += rlen; @@ -559,7 +559,7 @@ osi_NetSend(asocket, addr, dvec, nvec, asize, istack) AFS_SBUNLOCK(&asocket->so_snd, NETEVENT_SODOWN, asocket, s1); return 1; } - bcopy(addr, mtod(um, caddr_t), sizeof(*addr)); + memcpy(mtod(um, caddr_t), addr, sizeof(*addr)); um->m_len = sizeof(*addr); /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf * around it is gone. we free address ourselves. */ diff --git a/src/rx/SOLARIS/rx_knet.c b/src/rx/SOLARIS/rx_knet.c index ff7e05264..c567ba49a 100644 --- a/src/rx/SOLARIS/rx_knet.c +++ b/src/rx/SOLARIS/rx_knet.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/SOLARIS/rx_knet.c,v 1.1.1.5 2001/07/14 22:23:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/SOLARIS/rx_knet.c,v 1.1.1.6 2001/09/11 14:34:32 hartmans Exp $"); #ifdef AFS_SUN5_ENV #include "../rx/rx_kcommon.h" @@ -240,7 +240,7 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) if (msg.msg_name == NULL) { error = -1; } else { - bcopy(msg.msg_name, addr, msg.msg_namelen); + memcpy(addr, msg.msg_name, msg.msg_namelen); kmem_free(msg.msg_name, msg.msg_namelen); *alength = *alength - uio.uio_resid; } @@ -350,7 +350,7 @@ struct osi_socket *rxk_NewSocket(short aport) t_kclose(udp_tiptr, 0); return (struct osi_socket *)0; } - if (bcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) { + if (memcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) { t_kfree(udp_tiptr, (char *)reqp, T_BIND); t_kfree(udp_tiptr, (char *)rspp, T_BIND); t_kclose(udp_tiptr, 0); @@ -422,7 +422,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) } /* Copy the data into the buffer */ - bcopy((char *)dvec[0].iov_base, (char *)bp->b_wptr, dvec[0].iov_len); + memcpy((char *)bp->b_wptr, (char *)dvec[0].iov_base, dvec[0].iov_len); bp->b_datap->db_type = M_DATA; bp->b_wptr += dvec[0].iov_len; @@ -439,7 +439,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) } /* Copy the data into the buffer */ - bcopy((char *)dvec[i].iov_base, (char *)dbp->b_wptr, dvec[i].iov_len); + memcpy((char *)dbp->b_wptr, (char *)dvec[i].iov_base, dvec[i].iov_len); dbp->b_datap->db_type = M_DATA; dbp->b_wptr += dvec[i].iov_len; @@ -461,7 +461,7 @@ int osi_NetSend(asocket, addr, dvec, nvecs, asize, istack) udreq->addr.buf = (char *)kmem_alloc(sizeof(struct sockaddr_in), KM_SLEEP); udreq->opt.len = 0; udreq->opt.maxlen = 0; - bcopy((char *)&sin, udreq->addr.buf, sizeof(struct sockaddr_in)); + memcpy(udreq->addr.buf, (char *)&sin, sizeof(struct sockaddr_in)); udreq->udata.udata_mp = bp; udreq->udata.len = asize; @@ -563,7 +563,7 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) /* * Save the source address */ - bcopy(udreq->addr.buf, (char *)addr, sizeof(struct sockaddr_in)); + memcpy((char *)addr, udreq->addr.buf, sizeof(struct sockaddr_in)); /* * Copy out the message buffers, take care not to overflow @@ -580,12 +580,12 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength) while (dbp != NULL && tlen > 0) { blen = dbp->b_wptr - dbp->b_rptr; if (blen > tlen) { - bcopy((char *)dbp->b_rptr, tbase, tlen); + memcpy(tbase, (char *)dbp->b_rptr, tlen); length -= tlen; dbp->b_rptr += tlen; tlen = 0; } else { - bcopy((char *)dbp->b_rptr, tbase, blen); + memcpy(tbase, (char *)dbp->b_rptr, blen); length -= blen; tlen -= blen; tbase += blen; diff --git a/src/rx/bulk.example/bulk_client.c b/src/rx/bulk.example/bulk_client.c index f86b2c7f6..1e9bbcf50 100644 --- a/src/rx/bulk.example/bulk_client.c +++ b/src/rx/bulk.example/bulk_client.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/bulk.example/bulk_client.c,v 1.1.1.4 2001/07/14 22:23:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/bulk.example/bulk_client.c,v 1.1.1.5 2001/09/11 14:34:33 hartmans Exp $"); #include #include @@ -35,7 +35,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/bulktest/bulk_client.c b/src/rx/bulktest/bulk_client.c index bbb106d48..7fde52204 100644 --- a/src/rx/bulktest/bulk_client.c +++ b/src/rx/bulktest/bulk_client.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/bulktest/bulk_client.c,v 1.1.1.4 2001/07/14 22:23:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/bulktest/bulk_client.c,v 1.1.1.5 2001/09/11 14:34:34 hartmans Exp $"); #include #include @@ -45,7 +45,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } @@ -116,7 +116,7 @@ async_BulkTest(host, conn, store, count, verbose, file) work->store = store; work->count = count; work->verbose = verbose; - name = (char *)rindex(file, '/'); + name = strrchr(file, '/'); if (!name) name = file; else name++; /* sprintf(tempfile, "/usr/tmp/%s.%s", myHostName, name);*/ sprintf(tempfile, "/usr/tmp/%s", name); diff --git a/src/rx/multi.example/sample_client.c b/src/rx/multi.example/sample_client.c index 3d2a48289..899636c4e 100644 --- a/src/rx/multi.example/sample_client.c +++ b/src/rx/multi.example/sample_client.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/multi.example/sample_client.c,v 1.1.1.4 2001/07/14 22:23:44 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/multi.example/sample_client.c,v 1.1.1.5 2001/09/11 14:34:35 hartmans Exp $"); #include #include @@ -33,7 +33,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/rx.h b/src/rx/rx.h index addb64cff..79ab60835 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -54,6 +54,7 @@ # include "rx_event.h" # include "rx_packet.h" # include "rx_misc.h" +# include "rx_null.h" #ifndef AFS_NT40_ENV # include #endif diff --git a/src/rx/rx_event.c b/src/rx/rx_event.c index 31e8aa4f0..5d42c3a8c 100644 --- a/src/rx/rx_event.c +++ b/src/rx/rx_event.c @@ -7,14 +7,14 @@ * directory or online at http://www.openafs.org/dl/license10.html */ +#include #ifdef KERNEL #include "../afs/param.h" #else #include #endif -#include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_event.c,v 1.1.1.4 2001/07/11 03:10:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_event.c,v 1.1.1.5 2001/09/11 14:34:16 hartmans Exp $"); #ifdef KERNEL #ifndef UKERNEL @@ -420,6 +420,7 @@ void shutdown_rxevent(void) osi_Free((char *)xp, sizeof(struct xfreelist)); xp = nxp; } + xfreemallocs = (struct xfreelist *) 0; #endif } diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index e96185b20..1d919e69d 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -14,7 +14,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.6 2001/07/14 22:23:32 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.7 2001/09/11 14:34:17 hartmans Exp $"); #include "../rx/rx_kcommon.h" @@ -440,8 +440,8 @@ void shutdown_rxkernel(void) for (tpro = inetdomain.dom_protosw; tpro < last; tpro++) if (tpro->pr_protocol == IPPROTO_UDP) { /* restore original udp protocol switch */ - bcopy((void *)&parent_proto, (void *)tpro, sizeof(parent_proto)); - bzero((void *)&parent_proto, sizeof(parent_proto)); + memcpy((void *)tpro, (void *)&parent_proto, sizeof(parent_proto)); + memset((void *)&parent_proto, 0, sizeof(parent_proto)); rxk_initDone = 0; rxk_shutdownPorts(); return; @@ -468,8 +468,8 @@ int rxi_GetcbiInfo() afs_uint32 addrs[ADDRSPERSITE]; int mtus[ADDRSPERSITE]; - bzero((void *)addrs, sizeof(addrs)); - bzero((void *)mtus, sizeof(mtus)); + memset((void *)addrs, 0, sizeof(addrs)); + memset((void *)mtus, 0, sizeof(mtus)); for (i=0; ib_rptr+SO_MSGOFFSET, addrsize); + memcpy((caddr_t)bindnam->b_rptr+SO_MSGOFFSET, (caddr_t)&myaddr, addrsize); bindnam->b_wptr = bindnam->b_rptr + (addrsize+SO_MSGOFFSET+1); code = sobind(newSocket, bindnam, addrsize); @@ -794,7 +794,7 @@ struct osi_socket *rxk_NewSocket(short aport) #ifdef AFS_OSF_ENV myaddr.sin_len = nam->m_len; #endif /* AFS_OSF_ENV */ - bcopy(&myaddr, mtod(nam, caddr_t), sizeof(myaddr)); + memcpy(mtod(nam, caddr_t), &myaddr, sizeof(myaddr)); #ifdef AFS_SGI65_ENV BHV_PDATA(&bhv) = (void*)newSocket; code = sobind(&bhv, nam); diff --git a/src/rx/rx_misc.c b/src/rx/rx_misc.c index 3014df9bb..ec5a407be 100644 --- a/src/rx/rx_misc.c +++ b/src/rx/rx_misc.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_misc.c,v 1.1.1.5 2001/07/14 22:23:32 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_misc.c,v 1.1.1.6 2001/09/11 14:34:18 hartmans Exp $"); #ifdef KERNEL #include @@ -29,11 +29,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_misc.c,v 1.1.1.5 2001/07/14 22:23 #include "rx.h" #endif /* AFS_PTHREAD_ENV */ #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H diff --git a/src/rx/rx_packet.h b/src/rx/rx_packet.h index 8941e26a3..b77cffe39 100644 --- a/src/rx/rx_packet.h +++ b/src/rx/rx_packet.h @@ -151,7 +151,6 @@ * the receiver should be greater than * this one, rather than a resend of an * earlier sequence number */ -#define RX_FREE_PACKET 16 /* Unallocated to a call */ #define RX_SLOW_START_OK 32 /* Set this flag in an ack packet to * inform the sender that slow start is * supported by the receiver. */ @@ -164,6 +163,14 @@ #define RX_PRESET_FLAGS (RX_CLIENT_INITIATED | RX_LAST_PACKET) +/* + * Flags for the packet structure itself, housekeeping for the + * most part. These live in rx_packet->flags. + */ +#define RX_PKTFLAG_ACKED 0x01 +#define RX_PKTFLAG_FREE 0x02 + + /* The rx part of the header of a packet, in host form */ struct rx_header { afs_uint32 epoch; /* Start time of client process */ @@ -245,7 +252,7 @@ struct rx_packet { unsigned int niovecs; struct iovec wirevec[RX_MAXWVECS+1]; /* the new form of the packet */ - u_char acked; /* This packet has been *tentatively* acknowledged */ + u_char flags; /* Flags for local state of this packet */ u_char backoff; /* for multiple re-sends */ u_short length; /* Data length */ /* NT port relies on the fact that the next two are physically adjacent. @@ -313,13 +320,13 @@ struct rx_packet *rxi_SplitJumboPacket(); #define rx_packetwrite(p, off, len, in) \ ( (off) + (len) > (p)->wirevec[1].iov_len ? \ rx_SlowWritePacket(p, off, len, (char*)(in)) : \ - ((bcopy((char *)(in), (char*)((p)->wirevec[1].iov_base)+(off), (len))),0)) + ((memcpy((char*)((p)->wirevec[1].iov_base)+(off), (char *)(in), (len))),0)) /* copy data from an RX packet */ #define rx_packetread(p, off, len, out) \ ( (off) + (len) > (p)->wirevec[1].iov_len ? \ rx_SlowReadPacket(p, off, len, (char*)out) : \ - ((bcopy((char*)((p)->wirevec[1].iov_base)+(off), (char *)(out), len)),0)) + ((memcpy((char *)(out), (char*)((p)->wirevec[1].iov_base)+(off), len)),0)) #define rx_computelen(p,l) { register int i; \ for (l=0, i=1; i < p->niovecs; i++ ) l += p->wirevec[i].iov_len; } diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 6784c4c3f..0c04028e2 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -14,7 +14,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_rdwr.c,v 1.1.1.7 2001/07/14 22:23:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_rdwr.c,v 1.1.1.8 2001/09/11 14:34:22 hartmans Exp $"); #ifdef KERNEL #ifndef UKERNEL @@ -72,11 +72,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_rdwr.c,v 1.1.1.7 2001/07/14 22:23 # include # include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H @@ -250,7 +250,7 @@ MTUXXX doesn't there need to be an "else" here ??? while (nbytes && cp) { t = MIN((int)call->curlen, nbytes); t = MIN(t, (int)call->nLeft); - bcopy (call->curpos, buf, t); + memcpy(buf, call->curpos, t); buf += t; nbytes -= t; call->curpos += t; @@ -325,7 +325,7 @@ int rx_ReadProc(call, buf, nbytes) tnLeft = call->nLeft; if (!call->error && tcurlen > nbytes && tnLeft > nbytes) { tcurpos = call->curpos; - bcopy(tcurpos, buf, nbytes); + memcpy(buf, tcurpos, nbytes); call->curpos = tcurpos + nbytes; call->curlen = tcurlen - nbytes; call->nLeft = tnLeft - nbytes; @@ -383,7 +383,7 @@ int rx_ReadProc32(call, value) if (!((long)tcurpos & (sizeof(afs_int32)-1))) { *value = *((afs_int32 *)(tcurpos)); } else { - bcopy(tcurpos, (char *)value, sizeof(afs_int32)); + memcpy((char *)value, tcurpos, sizeof(afs_int32)); } call->curpos = tcurpos + sizeof(afs_int32); call->curlen = tcurlen - sizeof(afs_int32); @@ -795,7 +795,7 @@ int rxi_WriteProc(call, buf, nbytes) t = MIN((int)call->curlen, nbytes); t = MIN((int)call->nFree, t); - bcopy (buf, call->curpos, t); + memcpy(call->curpos, buf, t); buf += t; nbytes -= t; call->curpos += t; @@ -862,7 +862,7 @@ int rx_WriteProc(call, buf, nbytes) tnFree = (int)call->nFree; if (!call->error && tcurlen >= nbytes && tnFree >= nbytes) { tcurpos = call->curpos; - bcopy(buf, tcurpos, nbytes); + memcpy(tcurpos, buf, nbytes); call->curpos = tcurpos + nbytes; call->curlen = tcurlen - nbytes; call->nFree = tnFree - nbytes; @@ -920,7 +920,7 @@ int rx_WriteProc32(call, value) if (!((long)tcurpos & (sizeof(afs_int32)-1))) { *((afs_int32 *)(tcurpos)) = *value; } else { - bcopy((char *)value, tcurpos, sizeof(afs_int32)); + memcpy(tcurpos, (char *)value, sizeof(afs_int32)); } call->curpos = tcurpos + sizeof(afs_int32); call->curlen = tcurlen - sizeof(afs_int32); diff --git a/src/rx/rx_stream.c b/src/rx/rx_stream.c index 149469bf6..ee1000ef2 100644 --- a/src/rx/rx_stream.c +++ b/src/rx/rx_stream.c @@ -18,7 +18,7 @@ This file is now obsolete. #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_stream.c,v 1.1.1.4 2001/07/14 22:23:33 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_stream.c,v 1.1.1.5 2001/09/11 14:34:23 hartmans Exp $"); #ifdef KERNEL #include "../h/types.h" @@ -58,11 +58,11 @@ int rx_stream_ReadProc(sd, buf, nbytes) } if (nbytes < sd->sd.rd.nLeft) { sd->sd.rd.nLeft -= nbytes; - bcopy(sd->sd.rd.nextByte, buf, nbytes); + memcpy(buf, sd->sd.rd.nextByte, nbytes); sd->sd.rd.nextByte += nbytes; return totalBytes; } - bcopy(sd->sd.rd.nextByte, buf, sd->sd.rd.nLeft); + memcpy(buf, sd->sd.rd.nextByte, sd->sd.rd.nLeft); buf += sd->sd.rd.nLeft; nbytes -= sd->sd.rd.nLeft; tp = queue_First(&sd->sd.rd.rq, rx_packet); @@ -152,13 +152,13 @@ int rx_stream_WriteProc(sd, buf, nbytes) sd->sd.wd.freePtr = rx_DataOf(queue_First(&sd->sd.wd.wq, rx_packet)); } if (nbytes < sd->sd.wd.nFree) { - if (buf) bcopy(buf, sd->sd.wd.freePtr, nbytes), buf += nbytes; + if (buf) memcpy(sd->sd.wd.freePtr, buf, nbytes), buf += nbytes; sd->sd.wd.nFree -= nbytes; sd->sd.wd.freePtr += nbytes; nbytes = 0; break; } - if (buf) bcopy(buf, sd->sd.wd.freePtr, sd->sd.wd.nFree), buf += sd->sd.wd.nFree; + if (buf) memcpy(sd->sd.wd.freePtr, buf, sd->sd.wd.nFree), buf += sd->sd.wd.nFree; nbytes -= sd->sd.wd.nFree; sd->sd.wd.nFree = 0; if (rx_stream_FlushWrite(sd)) break; diff --git a/src/rx/rx_stream.h b/src/rx/rx_stream.h index b886eecaf..66dcb1d9f 100644 --- a/src/rx/rx_stream.h +++ b/src/rx/rx_stream.h @@ -64,7 +64,7 @@ int rx_stream_AllocIov(); /* If it returns 0, the call status should be checked with rx_Error. */ #define rx_stream_Write(iod, buf, nbytes) \ (iod)->sd.wd.nFree > (nbytes) ? \ - (buf) && bcopy((buf), (iod)->sd.wd.freePtr, (nbytes)), \ + (buf) && memcpy((iod)->sd.wd.freePtr, (buf), (nbytes)), \ (iod)->sd.wd.nFree -= (nbytes), \ (iod)->sd.wd.freePtr += (nbytes), (nbytes) \ : rx_stream_WriteProc((iod), (buf), (nbytes)) @@ -74,7 +74,7 @@ int rx_stream_AllocIov(); /* If it returns less than requested, the call status should be checked with rx_Error */ #define rx_stream_Read(iod, buf, nbytes) \ (iod)->sd.rd.nLeft > (nbytes) ? \ - bcopy((iod)->sd.rd.nextByte, (buf), (nbytes)), \ + memcpy((buf), (iod)->sd.rd.nextByte, (nbytes)), \ (iod)->sd.rd.nLeft -= (nbytes), (iod)->sd.rd.nextByte += (nbytes), (nbytes) \ : rx_stream_ReadProc((iod), (buf), (nbytes)) diff --git a/src/rx/rx_trace.c b/src/rx/rx_trace.c index f193f37c8..6b0998de2 100644 --- a/src/rx/rx_trace.c +++ b/src/rx/rx_trace.c @@ -10,14 +10,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_trace.c,v 1.1.1.5 2001/07/14 22:23:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_trace.c,v 1.1.1.6 2001/09/11 14:34:23 hartmans Exp $"); #ifdef RXDEBUG -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef AFS_NT40_ENV @@ -119,7 +119,7 @@ void rxi_calltrace(event, call) break; } - bcopy(&rxtinfo, rxi_tracebuf+rxi_tracepos, sizeof(struct rx_trace)); + memcpy(rxi_tracebuf+rxi_tracepos, &rxtinfo, sizeof(struct rx_trace)); rxi_tracepos += sizeof(struct rx_trace); if (rxi_tracepos >= (4096 - sizeof(struct rx_trace))) rxi_flushtrace(); diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index 738bc7915..e1b92b7e6 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_user.c,v 1.1.1.5 2001/07/14 22:23:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_user.c,v 1.1.1.6 2001/09/11 14:34:25 hartmans Exp $"); # include # include @@ -35,11 +35,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_user.c,v 1.1.1.5 2001/07/14 22:23 #endif #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif @@ -372,10 +372,10 @@ void rx_GetIFInfo() LOCK_IF rxi_numNetAddrs = 0; - bzero(rxi_NetAddrs, sizeof(rxi_NetAddrs)); - bzero(myNetFlags, sizeof(myNetFlags)); - bzero(myNetMTUs, sizeof(myNetMTUs)); - bzero(myNetMasks, sizeof(myNetMasks)); + memset(rxi_NetAddrs, 0, sizeof(rxi_NetAddrs)); + memset(myNetFlags, 0, sizeof(myNetFlags)); + memset(myNetMTUs, 0, sizeof(myNetMTUs)); + memset(myNetMasks, 0, sizeof(myNetMasks)); UNLOCK_IF s = socket(AF_INET, SOCK_DGRAM, 0); @@ -389,7 +389,7 @@ void rx_GetIFInfo() #else ifc.ifc_len = sizeof(ifs); ifc.ifc_buf = (caddr_t) &ifs[0]; - bzero(&ifs[0], sizeof(ifs)); + memset(&ifs[0], 0, sizeof(ifs)); #endif res = ioctl(s, SIOCGIFCONF, &ifc); if (res < 0) { diff --git a/src/rx/rxdebug.c b/src/rx/rxdebug.c index 5f3db7603..92166ac66 100644 --- a/src/rx/rxdebug.c +++ b/src/rx/rxdebug.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rxdebug.c,v 1.1.1.6 2001/07/14 22:23:36 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rxdebug.c,v 1.1.1.7 2001/09/11 14:34:25 hartmans Exp $"); #include #include @@ -30,11 +30,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rxdebug.c,v 1.1.1.6 2001/07/14 22:23 #ifdef HAVE_UNISTD_H #include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include @@ -159,7 +159,7 @@ struct cmd_syndesc *as; printf("rxdebug: host %s not found in host table\n", name); exit(1); } - bcopy(th->h_addr, &onlyHost, sizeof(afs_int32)); + memcpy(&onlyHost, th->h_addr, sizeof(afs_int32)); } else onlyHost = -1; if (as->parms[9].items) { @@ -184,7 +184,7 @@ struct cmd_syndesc *as; printf("rxdebug: host %s not found in host table\n", hostName); exit(1); } - bcopy(th->h_addr, &host, sizeof(afs_int32)); + memcpy(&host, th->h_addr, sizeof(afs_int32)); } else host = htonl(0x7f000001); /* IP localhost */ diff --git a/src/rx/simple.example/sample_client.c b/src/rx/simple.example/sample_client.c index fa5a3eb5d..0299098d2 100644 --- a/src/rx/simple.example/sample_client.c +++ b/src/rx/simple.example/sample_client.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/simple.example/sample_client.c,v 1.1.1.4 2001/07/14 22:23:45 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/simple.example/sample_client.c,v 1.1.1.5 2001/09/11 14:34:36 hartmans Exp $"); #include #include @@ -29,7 +29,7 @@ static u_long GetIpAddress(hostname) printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); return host; } diff --git a/src/rx/test/kctest.c b/src/rx/test/kctest.c index 3947e1b26..0af406f6f 100644 --- a/src/rx/test/kctest.c +++ b/src/rx/test/kctest.c @@ -10,7 +10,7 @@ #include "afs/param.h" #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/test/kctest.c,v 1.1.1.3 2001/07/11 03:11:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/test/kctest.c,v 1.1.1.4 2001/09/11 14:34:36 hartmans Exp $"); #include #include @@ -36,8 +36,8 @@ static MakeVTest(akey, aticket, asession) struct rxvab_EncryptionKey *akey, *asession; struct rxvab_Ticket *aticket; { aticket->ViceId = htonl(71); - bcopy("testkeyx", &aticket->HandShakeKey, 8); - bcopy("testkeyx", asession, 8); + memcpy(&aticket->HandShakeKey, "testkeyx", 8); + memcpy(asession, "testkeyx", 8); bcrypt_encrypt(aticket, aticket, sizeof(struct rxvab_Ticket), akey); return 0; } @@ -71,7 +71,7 @@ char **argv; { printf("could not find host '%s' in host table\n", argv[i+1]); return -1; } - bcopy(th->h_addr, &host, sizeof(long)); + memcpy(&host, th->h_addr, sizeof(long)); i++; } else if (!strcmp(argv[i],"-count")) { diff --git a/src/rx/test/testclient.c b/src/rx/test/testclient.c index c35147962..096dd63a4 100644 --- a/src/rx/test/testclient.c +++ b/src/rx/test/testclient.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/test/testclient.c,v 1.1.1.4 2001/07/14 22:23:46 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/test/testclient.c,v 1.1.1.5 2001/09/11 14:34:37 hartmans Exp $"); #include #include @@ -179,7 +179,7 @@ char **argv; if (!hostent) Abort("host %s not found", hostname); if (hostent->h_length != 4) Abort("host address is disagreeable length (%d)", hostent->h_length); - bcopy(hostent->h_addr, (char *)&host, sizeof(host)); + memcpy((char *)&host, hostent->h_addr, sizeof(host)); if (setFD>0) OpenFD(setFD); if (rx_Init(0) != 0) { diff --git a/src/rx/xdr_afsuuid.c b/src/rx/xdr_afsuuid.c index 3a423e46b..87707e798 100644 --- a/src/rx/xdr_afsuuid.c +++ b/src/rx/xdr_afsuuid.c @@ -14,12 +14,14 @@ #include "afs/param.h" #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_afsuuid.c,v 1.1.1.3 2001/07/11 03:10:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_afsuuid.c,v 1.1.1.4 2001/09/11 14:34:26 hartmans Exp $"); #if defined(KERNEL) && !defined(UKERNEL) #ifdef AFS_LINUX20_ENV #include "../h/string.h" -#define bzero(A,C) memset((A), 0, (C)) +#if 0 +#define bzero(A, C) memset((A), 0, (C)) +#endif #else #include #include diff --git a/src/rx/xdr_int64.c b/src/rx/xdr_int64.c index 6ba1f729e..6fe7a605f 100644 --- a/src/rx/xdr_int64.c +++ b/src/rx/xdr_int64.c @@ -6,12 +6,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_int64.c,v 1.1.1.3 2001/07/14 22:23:39 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_int64.c,v 1.1.1.4 2001/09/11 14:34:27 hartmans Exp $"); #if defined(KERNEL) && !defined(UKERNEL) #ifdef AFS_LINUX20_ENV #include "../h/string.h" +#if 0 #define bzero(A,C) memset((A), 0, (C)) +#endif #else #include #include diff --git a/src/rx/xdr_mem.c b/src/rx/xdr_mem.c index b93d43401..b65b0c38b 100644 --- a/src/rx/xdr_mem.c +++ b/src/rx/xdr_mem.c @@ -29,7 +29,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_mem.c,v 1.1.1.3 2001/07/14 22:23:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_mem.c,v 1.1.1.4 2001/09/11 14:34:27 hartmans Exp $"); #ifndef NeXT @@ -128,7 +128,7 @@ xdrmem_getbytes(xdrs, addr, len) if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(xdrs->x_private, addr, len); + memcpy(addr, xdrs->x_private, len); xdrs->x_private += len; return (TRUE); } @@ -142,7 +142,7 @@ xdrmem_putbytes(xdrs, addr, len) if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(addr, xdrs->x_private, len); + memcpy(xdrs->x_private, addr, len); xdrs->x_private += len; return (TRUE); } diff --git a/src/rx/xdr_rec.c b/src/rx/xdr_rec.c index 5695d36a0..6af2232af 100644 --- a/src/rx/xdr_rec.c +++ b/src/rx/xdr_rec.c @@ -46,7 +46,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_rec.c,v 1.1.1.3 2001/07/14 22:23:38 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_rec.c,v 1.1.1.4 2001/09/11 14:34:27 hartmans Exp $"); #include #include "xdr.h" @@ -269,7 +269,7 @@ xdrrec_putbytes(xdrs, addr, len) while (len > 0) { current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger; current = (len < current) ? len : current; - bcopy(addr, rstrm->out_finger, current); + memcpy(rstrm->out_finger, addr, current); rstrm->out_finger += current; addr += current; len -= current; @@ -520,7 +520,7 @@ get_input_bytes(rstrm, addr, len) continue; } current = (len < current) ? len : current; - bcopy(rstrm->in_finger, addr, current); + memcpy(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; diff --git a/src/rx/xdr_refernce.c b/src/rx/xdr_refernce.c index febbc78a3..984c4111d 100644 --- a/src/rx/xdr_refernce.c +++ b/src/rx/xdr_refernce.c @@ -29,7 +29,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_refernce.c,v 1.1.1.3 2001/07/14 22:23:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_refernce.c,v 1.1.1.4 2001/09/11 14:34:28 hartmans Exp $"); #ifndef NeXT @@ -79,7 +79,7 @@ xdr_reference(xdrs, pp, size, proc) if (loc == NULL) { return (FALSE); } - bzero(loc, (int)size); + memset(loc, 0, (int)size); break; } diff --git a/src/rxgen/rpc_clntout.c b/src/rxgen/rpc_clntout.c index da2f13aea..1b403232a 100644 --- a/src/rxgen/rpc_clntout.c +++ b/src/rxgen/rpc_clntout.c @@ -35,7 +35,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_clntout.c,v 1.1.1.4 2001/07/14 22:23:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_clntout.c,v 1.1.1.5 2001/09/11 14:34:38 hartmans Exp $"); #include #include @@ -112,7 +112,7 @@ printbody(proc) } f_print(fout, "res;\n"); f_print(fout, "\n"); - f_print(fout, "\tbzero(%sres, sizeof(res));\n", ampr(proc->res_type)); + f_print(fout, "\tmemset(%sres, 0, sizeof(res));\n", ampr(proc->res_type)); f_print(fout, "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n", proc->proc_name, stringfix(proc->arg_type), diff --git a/src/rxgen/rpc_cout.c b/src/rxgen/rpc_cout.c index 658d3b7b8..ddd1ea84f 100644 --- a/src/rxgen/rpc_cout.c +++ b/src/rxgen/rpc_cout.c @@ -35,15 +35,15 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_cout.c,v 1.1.1.4 2001/07/14 22:23:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_cout.c,v 1.1.1.5 2001/09/11 14:34:38 hartmans Exp $"); #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "rpc_util.h" diff --git a/src/rxgen/rpc_main.c b/src/rxgen/rpc_main.c index 7427df1f7..9f69c7f5d 100644 --- a/src/rxgen/rpc_main.c +++ b/src/rxgen/rpc_main.c @@ -36,17 +36,17 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_main.c,v 1.1.1.6 2001/07/14 22:23:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_main.c,v 1.1.1.7 2001/09/11 14:34:39 hartmans Exp $"); #include #include #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_SIGNAL_H @@ -201,7 +201,7 @@ main(argc, argv) OutFileFlag = NULL; S_output(cmd.infile, "-DRPC_SERVER", !EXTEND, cmd.outfile, 1); } else { - if (OutFileFlag && (rindex(OutFile,'.') == NULL)) + if (OutFileFlag && (strrchr(OutFile,'.') == NULL)) strcat(OutFile, "."); if (cmd.rflag) { C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT", EXTEND, ".cs.c", 1); @@ -286,11 +286,11 @@ extendfile(file, ext) if (res == NULL) { abort(); } - p = (char *) rindex(file, '.'); + p = (char *) strrchr(file, '.'); if (p == NULL) { p = file + strlen(file); } - sname = (char *) rindex(file,'/'); + sname = (char *) strrchr(file, '/'); if (sname == NULL) sname = file; else @@ -404,7 +404,7 @@ c_output(infile, define, extend, outfile, append) open_input(infile, define); cflag = 1; - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -516,7 +516,7 @@ h_output(infile, define, extend, outfile, append) open_input(infile, define); hflag = 1; - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -525,12 +525,13 @@ h_output(infile, define, extend, outfile, append) outfilename = extend ? extendfile(fullname, outfile) : outfile; open_output(infile, outfilename); strcpy(fullname, outfilename); - if (p = (char *)index(fullname, '.')) *p = '\0'; + if (p = strchr(fullname, '.')) *p = '\0'; f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n"); f_print(fout, "#ifndef _RXGEN_%s_\n", uppercase(fullname)); f_print(fout, "#define _RXGEN_%s_\n\n", uppercase(fullname)); f_print(fout, "#ifdef KERNEL\n"); f_print(fout, "/* The following 'ifndefs' are not a good solution to the vendor's omission of surrounding all system includes with 'ifndef's since it requires that this file is included after the system includes...*/\n"); + f_print(fout, "#include \n"); f_print(fout, "#include \"../afs/param.h\"\n"); f_print(fout, "#ifdef UKERNEL\n"); f_print(fout, "#include \"../afs/sysincludes.h\"\n"); @@ -728,7 +729,7 @@ int append; Cflag = 1; open_input(infile, define); - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -803,7 +804,7 @@ int append; Sflag = 1; open_input(infile, define); - bzero(fullname, sizeof(fullname)); + memset(fullname, 0, sizeof(fullname)); if (append) { strcpy(fullname, prefix); strcat(fullname, infile); @@ -902,7 +903,7 @@ parseargs(argc, argv, cmd) if (argc < 2) { return (0); } - bzero(flag, sizeof(flag)); + memset(flag, 0, sizeof(flag)); cmd->outfile = NULL; for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { diff --git a/src/rxgen/rpc_parse.c b/src/rxgen/rpc_parse.c index bc3fd361d..3cab4116e 100644 --- a/src/rxgen/rpc_parse.c +++ b/src/rxgen/rpc_parse.c @@ -35,16 +35,16 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_parse.c,v 1.1.1.5 2001/07/14 22:23:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_parse.c,v 1.1.1.6 2001/09/11 14:34:40 hartmans Exp $"); #include #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "rpc_util.h" @@ -148,7 +148,7 @@ get_definition() token tok; defp = ALLOC(definition); - bzero((char *)defp, sizeof(definition)); + memset((char *)defp, 0, sizeof(definition)); get_token(&tok); switch (tok.kind) { case TOK_STRUCT: @@ -882,7 +882,7 @@ token *tokp; do { get_token(tokp); Proc_list = ALLOC(proc1_list); - bzero((char *)Proc_list, sizeof(proc1_list)); + memset((char *)Proc_list, 0, sizeof(proc1_list)); Proc_list->pl.param_flag = 0; switch (tokp->kind) { case TOK_IN: @@ -904,7 +904,7 @@ token *tokp; *Proc_listp = Proc_list; Proc_listp = &Proc_list->next; decls = ALLOC(decl_list); - bzero((char *)decls, sizeof(decl_list)); + memset((char *)decls, 0, sizeof(decl_list)); decls->decl = dec; *tailp = decls; tailp = &decls->next; @@ -1172,7 +1172,7 @@ int split_flag; for (plist1 = defp->pc.plists; plist1; plist1 = plist1->next) { if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) { char *star=""; - char *pntr = index(plist1->pl.param_type, '*'); + char *pntr = strchr(plist1->pl.param_type, '*'); if (pntr) star = "*"; if (plist1->pl.param_flag & OUT_STRING) { f_print(fout, ", *%s%s", star, plist1->pl.param_name); @@ -1399,11 +1399,11 @@ int *somefrees; for (plist = defp->pc.plists; plist; plist = plist->next) { if ((plist->component_kind == DEF_PARAM) && !(plist->pl.param_flag & PROCESSED_PARAM)) { if (plist->pl.param_flag & INDIRECT_PARAM) { - char pres, *pntr = index(plist->pl.param_type, '*'); + char pres, *pntr = strchr(plist->pl.param_type, '*'); if (pntr){ --pntr; pres = *pntr; *pntr = (char)0; } f_print(fout, "\t%s %s", plist->pl.param_type, plist->pl.param_name); *pntr = pres; - } else if (index(plist->pl.param_type, '*') == 0) { + } else if (strchr(plist->pl.param_type, '*') == 0) { f_print(fout, "\t%s %s", plist->pl.param_type, plist->pl.param_name); } else { plist->pl.param_flag |= FREETHIS_PARAM; @@ -1415,7 +1415,7 @@ int *somefrees; if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) { if (plist1->pl.param_flag & INDIRECT_PARAM) { f_print(fout, ", %s", plist1->pl.param_name); - } else if (index(plist1->pl.param_type, '*') == 0) { + } else if (strchr(plist1->pl.param_type, '*') == 0) { f_print(fout, ", %s", plist1->pl.param_name); } else { plist1->pl.param_flag |= FREETHIS_PARAM; diff --git a/src/rxgen/rpc_scan.c b/src/rxgen/rpc_scan.c index 8d3ecb35e..1ccbd8be4 100644 --- a/src/rxgen/rpc_scan.c +++ b/src/rxgen/rpc_scan.c @@ -35,16 +35,16 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_scan.c,v 1.1.1.4 2001/07/14 22:23:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_scan.c,v 1.1.1.5 2001/09/11 14:34:40 hartmans Exp $"); #include #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "rpc_scan.h" diff --git a/src/rxgen/rpc_svcout.c b/src/rxgen/rpc_svcout.c index 4a5813ed7..8c43c0b36 100644 --- a/src/rxgen/rpc_svcout.c +++ b/src/rxgen/rpc_svcout.c @@ -35,14 +35,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_svcout.c,v 1.1.1.4 2001/07/14 22:23:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_svcout.c,v 1.1.1.5 2001/09/11 14:34:40 hartmans Exp $"); #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "rpc_parse.h" @@ -231,7 +231,7 @@ write_program(def, storage) f_print(fout, "\t\treturn;\n"); f_print(fout, "\t}\n"); - f_print(fout, "\tbzero(&%s, sizeof(%s));\n", ARG, ARG); + f_print(fout, "\tmemset(&%s, 0, sizeof(%s));\n", ARG, ARG); printif("getargs", TRANSP, "&", ARG); printerr("decode", TRANSP); f_print(fout, "\t\treturn;\n"); diff --git a/src/rxgen/rpc_util.c b/src/rxgen/rpc_util.c index 8af98b723..39a9e5737 100644 --- a/src/rxgen/rpc_util.c +++ b/src/rxgen/rpc_util.c @@ -35,14 +35,14 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_util.c,v 1.1.1.4 2001/07/14 22:23:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_util.c,v 1.1.1.5 2001/09/11 14:34:41 hartmans Exp $"); #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "rpc_scan.h" @@ -72,7 +72,7 @@ static printwhere(); reinitialize() { int i; - bzero(curline, MAXLINESIZE); + memset(curline, 0, MAXLINESIZE); where = curline; linenum = 0; defined = NULL; diff --git a/src/rxkad/domestic/crypt_conn.c b/src/rxkad/domestic/crypt_conn.c index c4d7e120b..00a7f6cab 100644 --- a/src/rxkad/domestic/crypt_conn.c +++ b/src/rxkad/domestic/crypt_conn.c @@ -18,7 +18,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/crypt_conn.c,v 1.1.1.5 2001/07/14 22:23:54 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/crypt_conn.c,v 1.1.1.6 2001/09/11 14:34:45 hartmans Exp $"); #ifdef KERNEL #include "../afs/stds.h" @@ -63,7 +63,7 @@ afs_int32 rxkad_DecryptPacket (conn, schedule, ivec, len, packet) rxkad_stats.bytesDecrypted[rxkad_TypeIndex(tp->type)] += len; UNLOCK_RXKAD_STATS - bcopy ((void *)ivec, (void *)xor, sizeof(xor)); + memcpy((void *)xor, (void *)ivec, sizeof(xor)); for (i = 0; len ; i++) { data = rx_data(packet, i, tlen); if (!data || !tlen) @@ -106,7 +106,7 @@ afs_int32 rxkad_EncryptPacket (conn, schedule, ivec, len, packet) */ rx_PutInt32(packet, 1*sizeof(afs_int32), 0); - bcopy ((void *)ivec, (void *)xor, sizeof(xor)); + memcpy((void *)xor, (void *)ivec, sizeof(xor)); for (i = 0; len ; i++) { data = rx_data(packet, i, tlen); if (!data || !tlen) diff --git a/src/rxkad/domestic/fcrypt.c b/src/rxkad/domestic/fcrypt.c index d3a25203e..227bd5e28 100644 --- a/src/rxkad/domestic/fcrypt.c +++ b/src/rxkad/domestic/fcrypt.c @@ -19,7 +19,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/fcrypt.c,v 1.1.1.5 2001/07/14 22:23:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/fcrypt.c,v 1.1.1.6 2001/09/11 14:34:46 hartmans Exp $"); #define DEBUG 0 #ifdef KERNEL @@ -130,8 +130,8 @@ afs_int32 fc_ecb_encrypt(clear, cipher, schedule, encrypt) #endif #if 0 - bcopy (clear, &L, sizeof(afs_int32)); - bcopy (clear+1, &R, sizeof(afs_int32)); + memcpy(&L, clear, sizeof(afs_int32)); + memcpy(&R, clear+1, sizeof(afs_int32)); #else L = ntohl(*clear); R = ntohl(*(clear+1)); @@ -181,8 +181,8 @@ afs_int32 fc_ecb_encrypt(clear, cipher, schedule, encrypt) } } #if 0 - bcopy (&L, cipher, sizeof(afs_int32)); - bcopy (&R, cipher+1, sizeof(afs_int32)); + memcpy(cipher, &L, sizeof(afs_int32)); + memcpy(cipher+1, &R, sizeof(afs_int32)); #else *cipher = htonl(L); *(cipher+1) = htonl(R); @@ -210,7 +210,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) if (encrypt) { for (i = 0; length > 0; i++, length -= 8) { /* get input */ - bcopy (input, t_input, sizeof(t_input)); + memcpy(t_input, input, sizeof(t_input)); input += sizeof(t_input); /* zero pad */ @@ -224,7 +224,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) fc_ecb_encrypt (xor, t_output, key, encrypt); /* copy temp output and save it for cbc */ - bcopy (t_output, output, sizeof(t_output)); + memcpy(output, t_output, sizeof(t_output)); output += sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ @@ -240,7 +240,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) /* decrypt */ for (i = 0; length > 0; i++, length -= 8) { /* get input */ - bcopy (input, t_input, sizeof(t_input)); + memcpy(t_input, input, sizeof(t_input)); input += sizeof(t_input); /* no padding for decrypt */ @@ -251,7 +251,7 @@ afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt) t_output[1] ^= xor[1] ; /* copy temp output */ - bcopy (t_output, output, sizeof(t_output)); + memcpy(output, t_output, sizeof(t_output)); output += sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ diff --git a/src/rxkad/domestic/tcrypt.c b/src/rxkad/domestic/tcrypt.c index 93406a4cc..e27caa308 100644 --- a/src/rxkad/domestic/tcrypt.c +++ b/src/rxkad/domestic/tcrypt.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/tcrypt.c,v 1.1.1.4 2001/07/14 22:23:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/domestic/tcrypt.c,v 1.1.1.5 2001/09/11 14:34:46 hartmans Exp $"); #include #include @@ -101,14 +101,14 @@ int main (argc, argv) afs_uint32 xor[2]; for (i=0; i<10; i++) msg[i]=htonl(i); - bcopy ("abcdefgh", &key, sizeof(struct ktc_encryptionKey)); + memcpy(&key, "abcdefgh", sizeof(struct ktc_encryptionKey)); fc_keysched (&key, schedule); print_msg ("Starting msg is:", msg, sizeof(msg)); - bcopy(&key, xor, 2*sizeof(afs_int32)); + memcpy(xor, &key, 2*sizeof(afs_int32)); fc_cbc_encrypt (msg, out, sizeof(msg), schedule, &key, ENCRYPT); - bcopy(&key, xor, 2*sizeof(afs_int32)); + memcpy(xor, &key, 2*sizeof(afs_int32)); fc_cbc_encrypt (out, dec, sizeof(msg), schedule, &key, DECRYPT); - if (bcmp (msg, dec, sizeof(msg)) != 0) + if (memcmp (msg, dec, sizeof(msg)) != 0) printf ("Encryption FAILED!\n"); print_msg ("Encrypted is:", out, sizeof(out)); print_msg ("Decrypted is:", dec, sizeof(dec)); @@ -120,7 +120,7 @@ int main (argc, argv) #endif e[0] = 0x11111111; e[1] = 0xaaaaaaaa; - bcopy ("abcdefgh", &key, sizeof(struct ktc_encryptionKey)); + memcpy(&key, "abcdefgh", sizeof(struct ktc_encryptionKey)); for (rounds=2; rounds<=MAXROUNDS; rounds +=2) { #ifdef TCRYPT ROUNDS = rounds; diff --git a/src/rxkad/rxkad_client.c b/src/rxkad/rxkad_client.c index b0bf3d8d7..211889fd1 100644 --- a/src/rxkad/rxkad_client.c +++ b/src/rxkad/rxkad_client.c @@ -18,7 +18,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_client.c,v 1.1.1.5 2001/07/14 22:23:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_client.c,v 1.1.1.6 2001/09/11 14:34:42 hartmans Exp $"); #ifdef KERNEL #include "../afs/stds.h" @@ -130,15 +130,14 @@ rxkad_AllocCID(aobj, aconn) if (aobj) { /* block is ready for encryption with session key, let's go for it. */ tcp = (struct rxkad_cprivate *) aobj->privateData; - bcopy((void *)tcp->ivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, (void *)tcp->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt((char *) &tgen, (char *) &tgen, sizeof(tgen), tcp->keysched, xor, ENCRYPT); } else { /* Create a session key so that we can encrypt it */ } - bcopy(((char *)&tgen) + sizeof(tgen) - ENCRYPTIONBLOCKSIZE, - (void *)Cuid, ENCRYPTIONBLOCKSIZE); + memcpy((void *)Cuid, ((char *)&tgen) + sizeof(tgen) - ENCRYPTIONBLOCKSIZE, ENCRYPTIONBLOCKSIZE); Cuid[0] = (Cuid[0] & ~0x40000000) | 0x80000000; Cuid[1] &= RX_CIDMASK; rx_SetEpoch (Cuid[0]); /* for future rxnull connections */ @@ -174,22 +173,22 @@ rxkad_NewClientSecurityObject(level, sessionkey, kvno, ticketLen, ticket) size = sizeof(struct rx_securityClass); tsc = (struct rx_securityClass *) rxi_Alloc (size); - bzero ((void *)tsc, size); + memset((void *)tsc, 0, size); tsc->refCount = 1; /* caller gets one for free */ tsc->ops = &rxkad_client_ops; size = sizeof(struct rxkad_cprivate); tcp = (struct rxkad_cprivate *) rxi_Alloc (size); - bzero ((void *)tcp, size); + memset((void *)tcp, 0, size); tsc->privateData = (char *) tcp; tcp->type |= rxkad_client; tcp->level = level; code = fc_keysched (sessionkey, tcp->keysched); if (code) return 0; /* bad key */ - bcopy ((void *)sessionkey, (void *)tcp->ivec, sizeof(tcp->ivec)); + memcpy((void *)tcp->ivec, (void *)sessionkey, sizeof(tcp->ivec)); tcp->kvno = kvno; /* key version number */ tcp->ticketLen = ticketLen; /* length of ticket */ - bcopy(ticket, tcp->ticket, ticketLen); + memcpy(tcp->ticket, ticket, ticketLen); LOCK_RXKAD_STATS rxkad_stats_clientObjects++; @@ -244,7 +243,7 @@ rxs_return_t rxkad_GetResponse (aobj, aconn, apacket) if (v2) { int i; afs_uint32 xor[2]; - bzero ((void *)&r_v2, sizeof(r_v2)); + memset((void *)&r_v2, 0, sizeof(r_v2)); r_v2.version = htonl(RXKAD_CHALLENGE_PROTOCOL_VERSION); r_v2.spare = 0; (void) rxkad_SetupEndpoint (aconn, &r_v2.encrypted.endpoint); @@ -258,13 +257,13 @@ rxs_return_t rxkad_GetResponse (aobj, aconn, apacket) r_v2.kvno = htonl(tcp->kvno); r_v2.ticketLen = htonl(tcp->ticketLen); r_v2.encrypted.endpoint.cksum = rxkad_CksumChallengeResponse (&r_v2); - bcopy((void *)tcp->ivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, (void *)tcp->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt (&r_v2.encrypted, &r_v2.encrypted, sizeof(r_v2.encrypted), tcp->keysched, xor, ENCRYPT); response = (char *)&r_v2; responseSize = sizeof(r_v2); } else { - bzero ((void *)&r_old, sizeof(r_old)); + memset((void *)&r_old, 0, sizeof(r_old)); r_old.encrypted.incChallengeID = htonl(challengeID + 1); r_old.encrypted.level = htonl((afs_int32)tcp->level); r_old.kvno = htonl(tcp->kvno); diff --git a/src/rxkad/rxkad_common.c b/src/rxkad/rxkad_common.c index 8fafce1e4..d3b0196fe 100644 --- a/src/rxkad/rxkad_common.c +++ b/src/rxkad/rxkad_common.c @@ -16,7 +16,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_common.c,v 1.1.1.5 2001/07/14 22:23:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_common.c,v 1.1.1.6 2001/09/11 14:34:42 hartmans Exp $"); #ifdef KERNEL #ifndef UKERNEL @@ -59,9 +59,9 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_common.c,v 1.1.1.5 2001/07/ char *rxi_Alloc(); -#ifndef max -#define max(a,b) ((a) < (b)? (b) : (a)) -#endif /* max */ +#ifndef afs_max +#define afs_max(a,b) ((a) < (b)? (b) : (a)) +#endif /* afs_max */ #ifndef KERNEL #define osi_Time() time(0) @@ -96,11 +96,10 @@ rxkad_DeriveXORInfo(aconnp, aschedule, aivec, aresult) afs_uint32 xor[2]; rxkad_SetupEndpoint(aconnp, &tendpoint); - bcopy(aivec, (void *)xor, 2*sizeof(afs_int32)); + memcpy((void *)xor, aivec, 2*sizeof(afs_int32)); fc_cbc_encrypt(&tendpoint, &tendpoint, sizeof(tendpoint), aschedule, xor, ENCRYPT); - bcopy(((char *)&tendpoint) + sizeof(tendpoint) - ENCRYPTIONBLOCKSIZE, - aresult, ENCRYPTIONBLOCKSIZE); + memcpy(aresult, ((char *)&tendpoint) + sizeof(tendpoint) - ENCRYPTIONBLOCKSIZE, ENCRYPTIONBLOCKSIZE); return 0; } @@ -215,7 +214,7 @@ rxs_return_t rxkad_NewConnection (aobj, aconn) if (rx_IsServerConn(aconn)) { int size = sizeof(struct rxkad_sconn); aconn->securityData = (char *) rxi_Alloc (size); - bzero(aconn->securityData, size); /* initialize it conveniently */ + memset(aconn->securityData, 0, size); /* initialize it conveniently */ } else { /* client */ struct rxkad_cprivate *tcp; @@ -223,7 +222,7 @@ rxs_return_t rxkad_NewConnection (aobj, aconn) int size = sizeof(struct rxkad_cconn); tccp = (struct rxkad_cconn *) rxi_Alloc (size); aconn->securityData = (char *) tccp; - bzero(aconn->securityData, size); /* initialize it conveniently */ + memset(aconn->securityData, 0, size); /* initialize it conveniently */ tcp = (struct rxkad_cprivate *) aobj->privateData; if (!(tcp->type & rxkad_client)) return RXKADINCONSISTENCY; rxkad_SetLevel(aconn, tcp->level); /* set header and trailer sizes */ @@ -453,7 +452,7 @@ rxs_return_t rxkad_PreparePacket (aobj, acall, apacket) switch (level) { case rxkad_clear: return 0; /* shouldn't happen */ case rxkad_auth: - nlen = max (ENCRYPTIONBLOCKSIZE, + nlen = afs_max (ENCRYPTIONBLOCKSIZE, len + rx_GetSecurityHeaderSize(tconn)); if (nlen > (len + rx_GetSecurityHeaderSize(tconn))) { rxi_RoundUpPacket(apacket, nlen - (len + rx_GetSecurityHeaderSize(tconn))); diff --git a/src/rxkad/rxkad_server.c b/src/rxkad/rxkad_server.c index b567c6015..d4e1c22dc 100644 --- a/src/rxkad/rxkad_server.c +++ b/src/rxkad/rxkad_server.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_server.c,v 1.1.1.6 2001/07/14 22:23:54 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_server.c,v 1.1.1.7 2001/09/11 14:34:43 hartmans Exp $"); #include #include @@ -120,12 +120,12 @@ rxkad_NewServerSecurityObject (level, get_key_rock, get_key, user_ok) size = sizeof(struct rx_securityClass); tsc = (struct rx_securityClass *) osi_Alloc (size); - bzero (tsc, size); + memset(tsc, 0, size); tsc->refCount = 1; /* caller has one reference */ tsc->ops = &rxkad_server_ops; size = sizeof(struct rxkad_sprivate); tsp = (struct rxkad_sprivate *) osi_Alloc (size); - bzero (tsp, size); + memset(tsp, 0, size); tsc->privateData = (char *) tsp; tsp->type |= rxkad_server; /* so can identify later */ @@ -190,7 +190,7 @@ rxs_return_t rxkad_GetChallenge (aobj, aconn, apacket) if (rx_IsUsingPktCksum(aconn)) sconn->cksumSeen = 1; if (sconn->cksumSeen) { - bzero (&c_v2, sizeof(c_v2)); + memset(&c_v2, 0, sizeof(c_v2)); c_v2.version = htonl(RXKAD_CHALLENGE_PROTOCOL_VERSION); c_v2.challengeID = htonl(sconn->challengeID); c_v2.level = htonl((afs_int32)sconn->level); @@ -198,7 +198,7 @@ rxs_return_t rxkad_GetChallenge (aobj, aconn, apacket) challenge = (char *)&c_v2; challengeSize = sizeof(c_v2); } else { - bzero (&c_old, sizeof(c_old)); + memset(&c_old, 0, sizeof(c_old)); c_old.challengeID = htonl(sconn->challengeID); c_old.level = htonl((afs_int32)sconn->level); challenge = (char *)&c_old; @@ -313,7 +313,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) code = fc_keysched (&sessionkey, sconn->keysched); if (code) return RXKADBADKEY; - bcopy (&sessionkey, sconn->ivec, sizeof(sconn->ivec)); + memcpy(sconn->ivec, &sessionkey, sizeof(sconn->ivec)); if (sconn->cksumSeen) { /* using v2 response */ @@ -322,7 +322,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) int i; afs_uint32 xor[2]; - bcopy(sconn->ivec, xor, 2*sizeof(afs_int32)); + memcpy(xor, sconn->ivec, 2*sizeof(afs_int32)); fc_cbc_encrypt (&v2r.encrypted, &v2r.encrypted, sizeof(v2r.encrypted), sconn->keysched, xor, DECRYPT); cksum = rxkad_CksumChallengeResponse (&v2r); @@ -330,7 +330,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket) return RXKADSEALEDINCON; (void) rxkad_SetupEndpoint (aconn, &endpoint); v2r.encrypted.endpoint.cksum = 0; - if (bcmp (&endpoint, &v2r.encrypted.endpoint, sizeof(endpoint)) != 0) + if (memcmp (&endpoint, &v2r.encrypted.endpoint, sizeof(endpoint)) != 0) return RXKADSEALEDINCON; for (i=0; ikvno = kvno; - bcopy (&client, &rock->client, sizeof(rock->client)); + memcpy(&rock->client, &client, sizeof(rock->client)); sconn->rock = rock; } return 0; diff --git a/src/rxkad/test/stress.c b/src/rxkad/test/stress.c index 95015eb66..bfd6057e3 100644 --- a/src/rxkad/test/stress.c +++ b/src/rxkad/test/stress.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress.c,v 1.1.1.4 2001/07/14 22:23:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress.c,v 1.1.1.5 2001/09/11 14:34:43 hartmans Exp $"); #include #include @@ -105,8 +105,8 @@ static int CommandProc (as, arock) sParms = (struct serverParms *) osi_Alloc (sizeof(*sParms)); cParms = (struct clientParms *) osi_Alloc (sizeof(*cParms)); - bzero (sParms, sizeof(*sParms)); - bzero (cParms, sizeof(*cParms)); + memset(sParms, 0, sizeof(*sParms)); + memset(cParms, 0, sizeof(*cParms)); sParms->whoami = cParms->whoami = whoami; if (!(startServer || startClient)) { diff --git a/src/rxkad/test/stress_c.c b/src/rxkad/test/stress_c.c index ab81fdb48..a27bf57ed 100644 --- a/src/rxkad/test/stress_c.c +++ b/src/rxkad/test/stress_c.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress_c.c,v 1.1.1.5 2001/07/14 22:23:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress_c.c,v 1.1.1.6 2001/09/11 14:34:44 hartmans Exp $"); #include #include @@ -48,7 +48,7 @@ static long GetServer(aname) fprintf (stderr, "host %s not found\n", aname); return errno; } - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } @@ -252,7 +252,7 @@ static long CallSimultaneously (threads, rock, proc) #endif assert (i < MAX_CTHREADS); w = (struct worker *) osi_Alloc (sizeof(struct worker)); - bzero (w, sizeof(*w)); + memset(w, 0, sizeof(*w)); w->next = workers; workers = w; w->index = i; @@ -353,7 +353,7 @@ static long RunLoadTest (parms, conn) DivideUpCalls (parms->slowCalls, parms->threads, slowCalls); DivideUpCalls (parms->copiousCalls, parms->threads, copiousCalls); - bzero (&c, sizeof(c)); + memset(&c, 0, sizeof(c)); c.conn = conn; c.sendLen = parms->sendLen; c.recvLen = parms->recvLen; @@ -519,7 +519,7 @@ static long MakeMultiChannelCall (conn, each, expectedCode, codes) int i; struct multiChannel mc; - bzero (&mc, sizeof(mc)); + memset(&mc, 0, sizeof(mc)); mc.conn = conn; for (i=0; i #include -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress_s.c,v 1.1.1.4 2001/07/14 22:23:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/test/stress_s.c,v 1.1.1.5 2001/09/11 14:34:45 hartmans Exp $"); #include #include @@ -41,7 +41,7 @@ static long GetKey (rock, kvno, key) IN long kvno; OUT struct ktc_encryptionKey *key; { - bcopy (&serviceKey, key, sizeof(*key)); + memcpy(key, &serviceKey, sizeof(*key)); return 0; } diff --git a/src/rxkad/ticket.c b/src/rxkad/ticket.c index ba08b2600..5b200ca33 100644 --- a/src/rxkad/ticket.c +++ b/src/rxkad/ticket.c @@ -14,7 +14,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket.c,v 1.1.1.5 2001/07/14 22:23:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket.c,v 1.1.1.6 2001/09/11 14:34:43 hartmans Exp $"); #if defined(UKERNEL) #include "../afs/sysincludes.h" @@ -181,15 +181,15 @@ static int decode_athena_ticket (ticket, ticketLen, name, inst, realm, getstr (inst, 0); getstr (realm, 0); - bcopy (ticket, host, sizeof (*host)); + memcpy(host, ticket, sizeof (*host)); ticket += sizeof(*host); *host = ktohl (flags, *host); - bcopy (ticket, sessionKey, sizeof (struct ktc_encryptionKey)); + memcpy(sessionKey, ticket, sizeof (struct ktc_encryptionKey)); ticket += sizeof (struct ktc_encryptionKey); lifetime = *ticket++; - bcopy (ticket, start, sizeof (*start)); + memcpy(start, ticket, sizeof (*start)); ticket += sizeof(*start); *start = ktohl (flags, *start); *end = life_to_time (*start, lifetime); @@ -208,7 +208,7 @@ static int decode_athena_ticket (ticket, ticketLen, name, inst, realm, strcpy (ticket, name); \ ticket += slen+1 #define putint(num) num = htonl(num);\ - bcopy (&num, ticket, sizeof(num));\ + memcpy(ticket, &num, sizeof(num));\ ticket += sizeof(num) static int assemble_athena_ticket (ticket, ticketLen, name, inst, realm, @@ -234,7 +234,7 @@ static int assemble_athena_ticket (ticket, ticketLen, name, inst, realm, putstr (realm, 0); putint (host); - bcopy (sessionKey, ticket, sizeof(struct ktc_encryptionKey)); + memcpy(ticket, sessionKey, sizeof(struct ktc_encryptionKey)); ticket += sizeof(struct ktc_encryptionKey); life = time_to_life (start, end); diff --git a/src/scout/scout.c b/src/scout/scout.c index ab7e3f4be..082042767 100644 --- a/src/scout/scout.c +++ b/src/scout/scout.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/scout/scout.c,v 1.1.1.4 2001/07/14 22:23:57 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/scout/scout.c,v 1.1.1.5 2001/09/11 14:34:47 hartmans Exp $"); #undef IN #ifdef AFS_AIX32_ENV @@ -1546,7 +1546,7 @@ static int init_mini_line(a_skt, a_lineNum, a_line, a_srvname) * Fill in the top fields (except the disk fields, which will be * done elsewhere), then create the light onodes. */ - bcopy((char *)a_skt, (char *)&(a_line->skt), sizeof(struct sockaddr_in)); + memcpy((char *)&(a_line->skt), (char *)a_skt, sizeof(struct sockaddr_in)); a_line->numDisks = 0; a_line->base_line = a_lineNum + scout_screen.base_line_num; a_line->num_lines = 1; @@ -1752,7 +1752,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, a_numservers, sktbytes); scout_CleanExit(-1); } - bzero(FSSktArray, sktbytes); + memset(FSSktArray, 0, sktbytes); /* * Sweep through the server names provided, filling in the socket @@ -1772,7 +1772,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, fullsrvname); return(-1); } - bcopy(he->h_addr, &(curr_skt->sin_addr.s_addr), 4); + memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4); curr_skt->sin_family = htons(AF_INET); /*Internet family*/ curr_skt->sin_port = htons(7000); /*FileServer port*/ @@ -1794,7 +1794,7 @@ static int execute_scout(a_numservers, a_srvname, a_pkg) rn, mini_line_bytes, a_numservers); return(-1); } - bzero(mini_lines, mini_line_bytes); + memset(mini_lines, 0, mini_line_bytes); /* * Set up each line in the mini_lines, creating and initializing diff --git a/src/sys/rmtsysc.c b/src/sys/rmtsysc.c index b0d9d21a0..13ccbd062 100644 --- a/src/sys/rmtsysc.c +++ b/src/sys/rmtsysc.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/sys/rmtsysc.c,v 1.1.1.6 2001/07/14 22:24:04 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/sys/rmtsysc.c,v 1.1.1.7 2001/09/11 14:34:51 hartmans Exp $"); #include #include @@ -107,7 +107,7 @@ char *syscall; printf("host %s not found; %s call aborted\n", afs_server, syscall); return 0; } - bcopy(th->h_addr, &hostAddr, sizeof(hostAddr)); + memcpy(&hostAddr, th->h_addr, sizeof(hostAddr)); return hostAddr; } @@ -229,7 +229,7 @@ struct ViceIoctl *data; if (!(inbuffer = (char *)malloc(ins))) return (-1); /* helpless here */ if (data->in_size) - bcopy(data->in, inbuffer, data->in_size); + memcpy(inbuffer, data->in, data->in_size); InData.rmtbulk_len = data->in_size; InData.rmtbulk_val = inbuffer; inparam_conversion(cmd, InData.rmtbulk_val, 0); diff --git a/src/sys/rmtsyss.c b/src/sys/rmtsyss.c index 6ed8badad..313730c9f 100644 --- a/src/sys/rmtsyss.c +++ b/src/sys/rmtsyss.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/sys/rmtsyss.c,v 1.1.1.5 2001/07/14 22:24:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/sys/rmtsyss.c,v 1.1.1.6 2001/09/11 14:34:52 hartmans Exp $"); #include #include @@ -134,9 +134,9 @@ rmtbulk *InData, *OutData; data.in = (char *)malloc(InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32)); if (!data.in) return (-1); /* helpless here */ if (!strcmp(path, NIL_PATHP)) pathp = (char *)0; /* It meant to be NIL */ - bcopy(blob, data.in, sizeof(blob)); + memcpy(data.in, blob, sizeof(blob)); inparam_conversion(cmd, InData->rmtbulk_val, 1); - bcopy(InData->rmtbulk_val, data.in+sizeof(blob), InData->rmtbulk_len); + memcpy(data.in+sizeof(blob), InData->rmtbulk_val, InData->rmtbulk_len); data.in_size = InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32); data.out = OutData->rmtbulk_val; data.out_size = OutData->rmtbulk_len; diff --git a/src/tbutc/NTMakefile b/src/tbutc/NTMakefile index 6848183f0..15afcf44c 100644 --- a/src/tbutc/NTMakefile +++ b/src/tbutc/NTMakefile @@ -93,7 +93,7 @@ include ..\config\NTMakefile.version # nmake /nologo /f ntmakefile install #----------------------------------------------- BUTC -$(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS) +$(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS) $(EXECONLINK) $(EXEPREP) diff --git a/src/tsm41/aix41_auth.c b/src/tsm41/aix41_auth.c index 1bf1fe19d..6dcc65cb8 100644 --- a/src/tsm41/aix41_auth.c +++ b/src/tsm41/aix41_auth.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/tsm41/aix41_auth.c,v 1.1.1.4 2001/07/14 22:24:05 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/tsm41/aix41_auth.c,v 1.1.1.5 2001/09/11 14:34:53 hartmans Exp $"); #if defined(AFS_AIX41_ENV) #include @@ -107,7 +107,7 @@ int afs_initialize(struct secmethod_table *meths) { * each time we call the authenticate routine. */ ka_Init(0); - bzero(meths, sizeof(struct secmethod_table)); + memset(meths, 0, sizeof(struct secmethod_table)); /* * Initialize the exported interface routines. Except the authenticate one * the others are currently mainly noops. diff --git a/src/tviced/NTMakefile b/src/tviced/NTMakefile index b989022f9..f01f165af 100644 --- a/src/tviced/NTMakefile +++ b/src/tviced/NTMakefile @@ -190,6 +190,7 @@ EXELIBS = \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ + $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\pthread.lib $(EXEFILE): $(EXEOBJS) $(EXELIBS) diff --git a/src/ubik/beacon.c b/src/ubik/beacon.c index d31f43e2a..968ec1698 100644 --- a/src/ubik/beacon.c +++ b/src/ubik/beacon.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/beacon.c,v 1.1.1.7 2001/07/14 22:24:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/beacon.c,v 1.1.1.8 2001/09/11 14:34:55 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -201,7 +201,7 @@ ubeacon_InitServerListCommon(ame, info, clones, aservers) for (i = 0; i < info->numServers; i++) { if (i == me) continue; ts = (struct ubik_server *) malloc(sizeof(struct ubik_server)); - bzero(ts, sizeof(struct ubik_server)); + memset(ts, 0, sizeof(struct ubik_server)); ts->next = ubik_servers; ubik_servers = ts; ts->addr[0] = info->hostAddr[i].sin_addr.s_addr; @@ -232,7 +232,7 @@ ubeacon_InitServerListCommon(ame, info, clones, aservers) while (servAddr = *aservers++) { if (i >= MAXSERVERS) return UNHOSTS; /* too many hosts */ ts = (struct ubik_server *) malloc(sizeof(struct ubik_server)); - bzero(ts, sizeof(struct ubik_server)); + memset(ts, 0, sizeof(struct ubik_server)); ts->next = ubik_servers; ubik_servers = ts; ts->addr[0] = servAddr; /* primary address in net byte order */ diff --git a/src/ubik/disk.c b/src/ubik/disk.c index 79b94bbed..bfd8a1beb 100644 --- a/src/ubik/disk.c +++ b/src/ubik/disk.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/disk.c,v 1.1.1.4 2001/07/14 22:24:06 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/disk.c,v 1.1.1.5 2001/09/11 14:34:55 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -80,7 +80,7 @@ udisk_Debug(aparm) struct buffer *tb; int i; - bcopy(&ubik_dbase->version, &aparm->localVersion, sizeof(struct ubik_version)); + memcpy(&aparm->localVersion, &ubik_dbase->version, sizeof(struct ubik_version)); aparm->lockedPages = 0; aparm->writeLockedPages = 0; tb = Buffers; @@ -217,7 +217,7 @@ static int DInit (abuffers) int i; struct buffer *tb; Buffers = (struct buffer *) malloc(abuffers * sizeof(struct buffer)); - bzero(Buffers, abuffers * sizeof(struct buffer)); + memset(Buffers, 0, abuffers * sizeof(struct buffer)); BufferData = (char *) malloc(abuffers * PAGESIZE); nbuffers = abuffers; for(i=0;idata, PAGESIZE); + memset(tb->data, 0, PAGESIZE); tb->lockers++; code = (*dbase->read)(dbase, fid, tb->data, page*PAGESIZE, PAGESIZE); @@ -558,7 +558,7 @@ static char *DNew (dbase, fid, page) if ((tb = newslot(dbase, fid, page)) == 0) return (char *) 0; tb->lockers++; - bzero(tb->data, PAGESIZE); + memset(tb->data, 0, PAGESIZE); return tb->data; } @@ -582,7 +582,7 @@ udisk_read(atrans, afile, abuffer, apos, alen) offset = apos & (PAGESIZE-1); len = PAGESIZE - offset; if (len > alen) len = alen; - bcopy(bp+offset, abuffer, len); + memcpy(abuffer, bp+offset, len); abuffer += len; apos += len; alen -= len; @@ -658,13 +658,13 @@ udisk_write(atrans, afile, abuffer, apos, alen) if (!bp) { bp = DNew(dbase, afile, apos>>LOGPAGESIZE); if (!bp) return UIOERROR; - bzero(bp, PAGESIZE); + memset(bp, 0, PAGESIZE); } /* otherwise, min of remaining bytes and end of buffer to user mode */ offset = apos & (PAGESIZE-1); len = PAGESIZE-offset; if (len > alen) len = alen; - bcopy(abuffer, bp+offset, len); + memcpy(bp+offset, abuffer, len); abuffer += len; apos += len; alen -= len; @@ -694,7 +694,7 @@ udisk_begin(adbase, atype, atrans) if (code) return code; } tt = (struct ubik_trans *) malloc(sizeof(struct ubik_trans)); - bzero(tt, sizeof(struct ubik_trans)); + memset(tt, 0, sizeof(struct ubik_trans)); tt->dbase = adbase; tt->next = adbase->activeTrans; adbase->activeTrans = tt; diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index c67980a69..a3b1bc1bf 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/recovery.c,v 1.1.1.5 2001/07/14 22:24:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/recovery.c,v 1.1.1.6 2001/09/11 14:34:56 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -26,6 +26,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/recovery.c,v 1.1.1.5 2001/07/14 22 #include #include #include +#include #define UBIK_INTERNALS #include "ubik.h" @@ -529,7 +530,7 @@ FetchEndCall: if (!code) { /* we got a new file, set up its header */ urecovery_state |= UBIK_RECHAVEDB; - bcopy(&tversion, &ubik_dbase->version, sizeof(struct ubik_version)); + memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version)); (*ubik_dbase->sync)(ubik_dbase, 0); /* get data out first */ /* after data is good, sync disk with correct label */ code = (*ubik_dbase->setlabel)(ubik_dbase, 0, &ubik_dbase->version); diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 7049d3848..f1afaf65e 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/remote.c,v 1.1.1.5 2001/07/14 22:24:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/remote.c,v 1.1.1.6 2001/09/11 14:34:56 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -522,7 +522,7 @@ SDISK_SendFile(rxcall, file, length, avers) This way, good label is only on good database. */ (*ubik_dbase->sync)(dbase, file); code = (*ubik_dbase->setlabel)(dbase, file, avers); - bcopy(avers, &ubik_dbase->version, sizeof(struct ubik_version)); + memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version)); udisk_Invalidate(dbase, file); /* new dbase, flush disk buffers */ LWP_NoYieldSignal(&dbase->version); DBRELE(dbase); diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index 73f1e73d3..ac7dbe650 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/ubik.c,v 1.1.1.6 2001/07/14 22:24:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/ubik.c,v 1.1.1.7 2001/09/11 14:34:57 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -222,8 +222,8 @@ int ubik_ServerInitCommon(myHost, myPort, info, clones, serverList, pathName, db tdb->pathName = (char *) malloc(strlen(pathName)+1); strcpy(tdb->pathName, pathName); tdb->activeTrans = (struct ubik_trans *) 0; - bzero(&tdb->version, sizeof(struct ubik_version)); - bzero(&tdb->cachedVersion, sizeof(struct ubik_version)); + memset(&tdb->version, 0, sizeof(struct ubik_version)); + memset(&tdb->cachedVersion, 0, sizeof(struct ubik_version)); Lock_Init(&tdb->versionLock); tdb->flags = 0; tdb->read = uphys_read; @@ -399,7 +399,7 @@ int ubik_AbortTrans(transPtr) dbase = transPtr->dbase; DBHOLD(dbase); - bzero(&dbase->cachedVersion, sizeof(struct ubik_version)); + memset(&dbase->cachedVersion, 0, sizeof(struct ubik_version)); /* see if we're still up-to-date */ if (!urecovery_AllBetter(dbase, transPtr->flags & TRREADANY)) { udisk_abort(transPtr); @@ -451,7 +451,7 @@ int ubik_EndTrans(transPtr) dbase = transPtr->dbase; DBHOLD(dbase); - bzero(&dbase->cachedVersion, sizeof(struct ubik_version)); + memset(&dbase->cachedVersion, 0, sizeof(struct ubik_version)); /* give up if no longer current */ if (!urecovery_AllBetter(dbase, transPtr->flags & TRREADANY)) { @@ -530,7 +530,7 @@ int ubik_EndTrans(transPtr) success: udisk_end(transPtr); /* update version on successful EndTrans */ - bcopy(&dbase->version, &dbase->cachedVersion, sizeof(struct ubik_version)); + memcpy(&dbase->cachedVersion, &dbase->version, sizeof(struct ubik_version)); DBRELE(dbase); return 0; @@ -667,9 +667,7 @@ int ubik_Write(transPtr, buffer, length) iovec[transPtr->iovec_info.iovec_wrt_len].position = transPtr->seekPos; iovec[transPtr->iovec_info.iovec_wrt_len].length = length; - bcopy(buffer, - &transPtr->iovec_data.iovec_buf_val[transPtr->iovec_data.iovec_buf_len], - length); + memcpy(&transPtr->iovec_data.iovec_buf_val[transPtr->iovec_data.iovec_buf_len], buffer, length); transPtr->iovec_info.iovec_wrt_len++; transPtr->iovec_data.iovec_buf_len += length; diff --git a/src/ubik/ubikcmd.c b/src/ubik/ubikcmd.c index d8beab6e4..a016e8b62 100644 --- a/src/ubik/ubikcmd.c +++ b/src/ubik/ubikcmd.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/ubikcmd.c,v 1.1.1.4 2001/07/14 22:24:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/ubikcmd.c,v 1.1.1.5 2001/09/11 14:34:58 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -48,7 +48,7 @@ ubik_ParseServerList(argc, argv, ahost, aothers) gethostname(hostname, sizeof(hostname)); th = gethostbyname(hostname); if (!th) return UBADHOST; - bcopy(th->h_addr, &myHost, sizeof(afs_int32)); + memcpy(&myHost, th->h_addr, sizeof(afs_int32)); *ahost = myHost; inServer = 0; /* haven't seen -servers yet */ @@ -66,7 +66,7 @@ ubik_ParseServerList(argc, argv, ahost, aothers) /* otherwise this is a new host name */ th = gethostbyname(tp); if (!th) return UBADHOST; - bcopy(th->h_addr, &temp, sizeof(afs_int32)); + memcpy(&temp, th->h_addr, sizeof(afs_int32)); if (temp != myHost) { if (counter++ >= MAXSERVERS) return UNHOSTS; *aothers++ = temp; diff --git a/src/ubik/udebug.c b/src/ubik/udebug.c index d3289af71..92935b026 100644 --- a/src/ubik/udebug.c +++ b/src/ubik/udebug.c @@ -10,15 +10,15 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/udebug.c,v 1.1.1.7 2001/07/14 22:24:09 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/udebug.c,v 1.1.1.8 2001/09/11 14:34:58 hartmans Exp $"); #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef AFS_NT40_ENV @@ -121,7 +121,7 @@ struct cmd_syndesc *as; { printf("udebug: host %s not found in host table\n", hostName); exit(1); } - bcopy(th->h_addr, &hostAddr, sizeof(afs_int32)); + memcpy(&hostAddr, th->h_addr, sizeof(afs_int32)); } else hostAddr = htonl(0x7f000001); /* IP localhost */ diff --git a/src/ubik/vote.c b/src/ubik/vote.c index 8a37b308b..fd96741b2 100644 --- a/src/ubik/vote.c +++ b/src/ubik/vote.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/vote.c,v 1.1.1.6 2001/07/14 22:24:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/vote.c,v 1.1.1.7 2001/09/11 14:34:59 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -343,7 +343,7 @@ SVOTE_XSDebug(rxcall, awhich, aparm, isclone) aparm->altAddr[i] = ntohl(ts->addr[i+1]); aparm->lastVoteTime = ts->lastVoteTime; aparm->lastBeaconSent = ts->lastBeaconSent; - bcopy(&ts->version, &aparm->remoteVersion, sizeof(struct ubik_version)); + memcpy(&aparm->remoteVersion, &ts->version, sizeof(struct ubik_version)); aparm->lastVote = ts->lastVote; aparm->up = ts->up; aparm->beaconSinceDown = ts->beaconSinceDown; @@ -406,8 +406,8 @@ SVOTE_Debug(rxcall, aparm) (urecovery_state & UBIK_RECHAVEDB ) ) { aparm->recoveryState |= UBIK_RECLABELDB; } - bcopy(&ubik_dbVersion, &aparm->syncVersion, sizeof(struct ubik_version)); - bcopy(&ubik_dbTid, &aparm->syncTid, sizeof(struct ubik_tid)); + memcpy(&aparm->syncVersion, &ubik_dbVersion, sizeof(struct ubik_version)); + memcpy(&aparm->syncTid, &ubik_dbTid, sizeof(struct ubik_tid)); aparm->activeWrite = (ubik_dbase->flags & DBWRITING); aparm->tidCounter = ubik_dbase->tidCounter; @@ -437,7 +437,7 @@ SVOTE_SDebugOld(rxcall, awhich, aparm) aparm->addr = ntohl(ts->addr[0]); /* primary interface */ aparm->lastVoteTime = ts->lastVoteTime; aparm->lastBeaconSent = ts->lastBeaconSent; - bcopy(&ts->version, &aparm->remoteVersion, sizeof(struct ubik_version)); + memcpy(&aparm->remoteVersion, &ts->version, sizeof(struct ubik_version)); aparm->lastVote = ts->lastVote; aparm->up = ts->up; aparm->beaconSinceDown = ts->beaconSinceDown; @@ -484,8 +484,8 @@ SVOTE_DebugOld(rxcall, aparm) (urecovery_state & UBIK_RECHAVEDB ) ) { aparm->recoveryState |= UBIK_RECLABELDB; } - bcopy(&ubik_dbVersion, &aparm->syncVersion, sizeof(struct ubik_version)); - bcopy(&ubik_dbTid, &aparm->syncTid, sizeof(struct ubik_tid)); + memcpy(&aparm->syncVersion, &ubik_dbVersion, sizeof(struct ubik_version)); + memcpy(&aparm->syncTid, &ubik_dbTid, sizeof(struct ubik_tid)); aparm->activeWrite = (ubik_dbase->flags & DBWRITING); aparm->tidCounter = ubik_dbase->tidCounter; diff --git a/src/update/client.c b/src/update/client.c index b5e62b2d2..444e8383e 100644 --- a/src/update/client.c +++ b/src/update/client.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/update/client.c,v 1.1.1.5 2001/07/14 22:24:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/update/client.c,v 1.1.1.6 2001/09/11 14:35:00 hartmans Exp $"); #include #ifdef AFS_AIX32_ENV @@ -35,11 +35,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/update/client.c,v 1.1.1.5 2001/07/14 22 #include #include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H @@ -77,7 +77,7 @@ char *aname; { printf("host %s not found \n", aname); exit(1); } - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } diff --git a/src/update/server.c b/src/update/server.c index 53ab1a53f..c87c09cae 100644 --- a/src/update/server.c +++ b/src/update/server.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/update/server.c,v 1.1.1.5 2001/07/14 22:24:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/update/server.c,v 1.1.1.6 2001/09/11 14:35:01 hartmans Exp $"); #include #ifdef AFS_AIX32_ENV @@ -30,11 +30,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/update/server.c,v 1.1.1.5 2001/07/14 22 #include #include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H diff --git a/src/update/utils.c b/src/update/utils.c index cb656ad53..a9ae58217 100644 --- a/src/update/utils.c +++ b/src/update/utils.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/update/utils.c,v 1.1.1.5 2001/07/14 22:24:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/update/utils.c,v 1.1.1.6 2001/09/11 14:35:02 hartmans Exp $"); #include #include @@ -21,11 +21,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/update/utils.c,v 1.1.1.5 2001/07/14 22: #include #endif #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_UNISTD_H diff --git a/src/usd/usd_file.c b/src/usd/usd_file.c index f6d76e288..32e4c5fd6 100644 --- a/src/usd/usd_file.c +++ b/src/usd/usd_file.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/usd/usd_file.c,v 1.1.1.6 2001/07/14 22:24:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/usd/usd_file.c,v 1.1.1.7 2001/09/11 14:35:03 hartmans Exp $"); #include #include @@ -357,7 +357,7 @@ static int usd_FileOpen( return errno; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)fd; usd->read = usd_FileRead; usd->write = usd_FileWrite; @@ -427,7 +427,7 @@ static int usd_FileStandardInput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)((unsigned long)0); usd->read = usd_FileRead; usd->write = usd_FileWrite; @@ -455,7 +455,7 @@ static int usd_FileStandardOutput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)((unsigned long)1); usd->read = usd_FileRead; usd->write = usd_FileWrite; diff --git a/src/usd/usd_nt.c b/src/usd/usd_nt.c index 105dfd5f1..0b9759450 100644 --- a/src/usd/usd_nt.c +++ b/src/usd/usd_nt.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/usd/usd_nt.c,v 1.1.1.4 2001/07/14 22:24:12 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/usd/usd_nt.c,v 1.1.1.5 2001/09/11 14:35:03 hartmans Exp $"); #include #include @@ -485,7 +485,7 @@ static int usd_DeviceOpen( return nterr_nt2unix(GetLastError(), EIO); usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); _ASSERT(sizeof(devhandle) <= sizeof(usd->handle)); @@ -541,7 +541,7 @@ static int usd_DeviceStandardInput(usd_handle_t *usdP) *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)0; usd->read = usd_DeviceRead; usd->write = usd_DeviceWrite; @@ -568,7 +568,7 @@ static int usd_DeviceStandardOutput( *usdP = NULL; usd = (usd_handle_t) malloc(sizeof(*usd)); - bzero(usd, sizeof(*usd)); + memset(usd, 0, sizeof(*usd)); usd->handle = (void *)1; usd->read = usd_DeviceRead; usd->write = usd_DeviceWrite; diff --git a/src/uss/lex.c b/src/uss/lex.c index 5e14dda94..ce3837141 100644 --- a/src/uss/lex.c +++ b/src/uss/lex.c @@ -11,11 +11,10 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/lex.c,v 1.1.1.4 2001/07/14 22:24:13 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/lex.c,v 1.1.1.5 2001/09/11 14:35:04 hartmans Exp $"); #include "y.tab.h" #include "uss_common.h" -extern char *index(); int line=1; #ifdef DEBUG #define dprint(x) {fprintf(stderr, x); fflush(stderr);} @@ -92,7 +91,7 @@ Replace(in, out) } out_cp = out; - while ((in_var = index(in_text, '$')) != NULL) { + while ((in_var = strchr(in_text, '$')) != NULL) { while(in_text < in_var) *out_cp++ = *in_text++; VarNo = *(in_var+1); @@ -185,7 +184,7 @@ Replace(in, out) *out_cp++ = *in_text++; if (isQuotedString) { - nullP = index(out, '"'); + nullP = strchr(out, '"'); if (nullP == (char *)0) nullP = out_cp; } diff --git a/src/uss/uss_fs.c b/src/uss/uss_fs.c index e3d28e91c..236d74c93 100644 --- a/src/uss/uss_fs.c +++ b/src/uss/uss_fs.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_fs.c,v 1.1.1.4 2001/07/14 22:24:15 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_fs.c,v 1.1.1.5 2001/09/11 14:35:06 hartmans Exp $"); #include "uss_fs.h" /*Interface to this module*/ #include @@ -131,7 +131,7 @@ static char *ParentAndComponent(a_path, a_parentBuff, a_componentPP) * we cheat and return ``.''. */ strcpy(a_parentBuff, a_path); - rightSlashP = (char *) rindex(a_parentBuff, '/'); + rightSlashP = (char *) strrchr(a_parentBuff, '/'); if (rightSlashP) { *rightSlashP = 0; *a_componentPP = rightSlashP+1; diff --git a/src/uss/uss_kauth.c b/src/uss/uss_kauth.c index 63ee519f1..0167ead34 100644 --- a/src/uss/uss_kauth.c +++ b/src/uss/uss_kauth.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_kauth.c,v 1.1.1.4 2001/07/14 22:24:15 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_kauth.c,v 1.1.1.5 2001/09/11 14:35:06 hartmans Exp $"); #include "uss_kauth.h" /*Module interface*/ #include "uss_common.h" /*Common defs & operations*/ @@ -30,7 +30,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_kauth.c,v 1.1.1.4 2001/07/14 22 extern int errno; extern afs_int32 KAM_CreateUser(); -extern char *index(); #define uss_kauth_MAX_SIZE 2048 @@ -150,7 +149,7 @@ static char *getpipepass() { static char gpbuf[BUFSIZ]; /* read a password from stdin, stop on \n or eof */ register int i, tc; - bzero(gpbuf, sizeof(gpbuf)); + memset(gpbuf, 0, sizeof(gpbuf)); for(i=0; i<(sizeof(gpbuf)-1); i++) { tc = fgetc(stdin); if (tc == '\n' || tc == EOF) break; @@ -555,7 +554,7 @@ afs_int32 uss_kauth_CheckUserName() uss_whoami, UserCell); return(-1); } - if (index(UserPrincipal, ':') != NULL) { + if (strchr(UserPrincipal, ':') != NULL) { fprintf(stderr, "%s: User name '%s' can't have a colon\n", uss_whoami, UserPrincipal); return(-1); diff --git a/src/uss/uss_procs.c b/src/uss/uss_procs.c index 73b3ff451..fa5abce5a 100644 --- a/src/uss/uss_procs.c +++ b/src/uss/uss_procs.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_procs.c,v 1.1.1.4 2001/07/14 22:24:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_procs.c,v 1.1.1.5 2001/09/11 14:35:06 hartmans Exp $"); #include "uss_procs.h" /*Module interface*/ #include "uss_common.h" /*Common defs & operations*/ @@ -43,7 +43,6 @@ extern int errno; char temp[1000]; extern int line; -extern char *rindex(); static int Copy(); static int Echo(); @@ -234,7 +233,7 @@ afs_int32 uss_procs_CpFile(a_path, a_mode, a_owner, a_proto) } if (stbuf.st_mode & S_IFDIR) { - if ((cp = rindex(a_path, '/')) == NULL) { + if ((cp = strrchr(a_path, '/')) == NULL) { strcat(a_proto, "/"); strcat(a_proto, a_path); } @@ -812,7 +811,7 @@ FILE *uss_procs_FindAndOpen(a_fileToOpen) /* * If a full pathname was given, just take it as is. */ - if (index(a_fileToOpen, '/')) { + if (strchr(a_fileToOpen, '/')) { strcpy(tmp_str, a_fileToOpen); rv = fopen(a_fileToOpen, "r"); } diff --git a/src/uss/uss_ptserver.c b/src/uss/uss_ptserver.c index 9d140f1b9..053c2a6f4 100644 --- a/src/uss/uss_ptserver.c +++ b/src/uss/uss_ptserver.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_ptserver.c,v 1.1.1.4 2001/07/14 22:24:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_ptserver.c,v 1.1.1.5 2001/09/11 14:35:07 hartmans Exp $"); #include "uss_ptserver.h" /*Module interface*/ #include /*Protection Server client interface*/ @@ -30,7 +30,6 @@ extern int errno; #undef USS_PTSERVER_DB extern int line; -extern char *rindex(); /* diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c index 8614f1883..8eaf0b924 100644 --- a/src/uss/uss_vol.c +++ b/src/uss/uss_vol.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_vol.c,v 1.1.1.4 2001/07/14 22:24:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/uss/uss_vol.c,v 1.1.1.5 2001/09/11 14:35:07 hartmans Exp $"); #include "uss_vol.h" /*Interface to this module*/ #include "uss_common.h" /*Common definitions*/ @@ -405,7 +405,7 @@ afs_int32 uss_vol_GetServer(a_name) th = gethostbyname(a_name); if (!th) return(0); - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return(addr); } /*uss_vol_GetServer*/ diff --git a/src/util/NTMakefile b/src/util/NTMakefile index 04fde9ecd..174691f29 100644 --- a/src/util/NTMakefile +++ b/src/util/NTMakefile @@ -29,6 +29,9 @@ INCFILES =\ $(DESTDIR)\include\afs\dirent.h: dirent_nt.h $(COPY) $** $@ +$(DESTDIR)\include\afs\dirpath.h: dirpath.hin + $(COPY) $** $@ + LIBFILE = $(DESTDIR)\lib\afs\afsutil.lib LIBOBJS = \ diff --git a/src/util/hostparse.c b/src/util/hostparse.c index 2a5d78d9b..91b36848b 100644 --- a/src/util/hostparse.c +++ b/src/util/hostparse.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/hostparse.c,v 1.1.1.6 2001/07/14 22:24:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/hostparse.c,v 1.1.1.7 2001/09/11 14:35:12 hartmans Exp $"); #ifdef UKERNEL #include "../afs/sysincludes.h" @@ -33,11 +33,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/util/hostparse.c,v 1.1.1.6 2001/07/14 2 #include #include #endif -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include @@ -77,7 +77,7 @@ register char *ahost; { /* decimal address, return fake hostent with only hostaddr field good */ tval = 0; dots = 0; - bzero(addr, sizeof(addr)); + memset(addr, 0, sizeof(addr)); while ((tc = *ahost++)) { if (tc == '.') { if (dots >= 3) return (struct hostent *) 0; /* too many dots */ diff --git a/src/util/kreltime.c b/src/util/kreltime.c index 3836c52b4..5794a4924 100644 --- a/src/util/kreltime.c +++ b/src/util/kreltime.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/kreltime.c,v 1.1.1.4 2001/07/14 22:24:22 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/kreltime.c,v 1.1.1.5 2001/09/11 14:35:13 hartmans Exp $"); #include #include @@ -76,7 +76,7 @@ Int32To_ktimeRelDate(int32Date, kdptr) afs_int32 int32Date; struct ktime_date *kdptr; { - bzero(kdptr, sizeof(*kdptr)); + memset(kdptr, 0, sizeof(*kdptr)); kdptr->day = int32Date % (MAX_DAY_VALUE + 1); if ( kdptr->day != 0 ) @@ -152,7 +152,7 @@ ParseRelDate(dateStr, relDatePtr) afs_int32 value, digit_limit; afs_int32 type_index; - bzero(relDatePtr, sizeof(*relDatePtr)); + memset(relDatePtr, 0, sizeof(*relDatePtr)); type_index = 0; while ( 1 ) diff --git a/src/util/ktime.c b/src/util/ktime.c index c8230cc29..468a4e47e 100644 --- a/src/util/ktime.c +++ b/src/util/ktime.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/ktime.c,v 1.1.1.4 2001/07/14 22:24:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/ktime.c,v 1.1.1.5 2001/09/11 14:35:14 hartmans Exp $"); #include #include @@ -169,7 +169,7 @@ register char *astr; { struct ktime tk; -bzero(&tk, sizeof(tk)); +memset(&tk, 0, sizeof(tk)); if ( ParseTime(&tk, astr) ) return (-1); /* syntax error */ @@ -243,7 +243,7 @@ char *adate; { register afs_int32 code; struct ptemp *tp; - bzero(ak, sizeof(*ak)); + memset(ak, 0, sizeof(*ak)); code = LocalParseLine(adate, &tt); if (code) return -1; for(;tt;tt=tt->next) { diff --git a/src/util/netutils.c b/src/util/netutils.c index 1859fde92..bacfc8bd2 100644 --- a/src/util/netutils.c +++ b/src/util/netutils.c @@ -19,15 +19,15 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/util/netutils.c,v 1.1.1.5 2001/07/14 22:24:23 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/netutils.c,v 1.1.1.6 2001/09/11 14:35:15 hartmans Exp $"); #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include diff --git a/src/util/serverLog.c b/src/util/serverLog.c index 6b5412d4d..a0a7382a6 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -19,7 +19,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/serverLog.c,v 1.1.1.7 2001/07/14 22:24:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/serverLog.c,v 1.1.1.8 2001/09/11 14:35:17 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -36,11 +36,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/util/serverLog.c,v 1.1.1.7 2001/07/14 2 #include /* signal(), kill(), wait(), etc. */ #include #include -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #include "afsutil.h" diff --git a/src/util/uuid.c b/src/util/uuid.c index 2dff1f410..90b9dea78 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -14,13 +14,13 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/util/uuid.c,v 1.1.1.5 2001/07/14 22:24:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/uuid.c,v 1.1.1.6 2001/09/11 14:35:18 hartmans Exp $"); #ifdef KERNEL #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" -#define uuid_memcmp(A,B,C) bcmp(A,B,C) -#define uuid_memcpy(A,B,C) bcopy(B,A,C) +#define uuid_memcmp(A,B,C) memcmp(A, B, C) +#define uuid_memcpy(A,B,C) memcpy(A, B, C) #else /* KERNEL */ #include #include diff --git a/src/util/volparse.c b/src/util/volparse.c index 4d09350e2..63c84db05 100644 --- a/src/util/volparse.c +++ b/src/util/volparse.c @@ -10,13 +10,13 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/volparse.c,v 1.1.1.6 2001/07/14 22:24:26 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/volparse.c,v 1.1.1.7 2001/09/11 14:35:19 hartmans Exp $"); -#ifdef HAVE_STRINGS_H -#include -#else #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include #endif #endif #ifdef HAVE_STDLIB_H @@ -85,7 +85,7 @@ char *volutil_PartitionName_r(int avalue, char *tbuffer, int buflen) tbuffer[0] = '\0'; return tbuffer; } - bzero(tbuffer, buflen); + memset(tbuffer, 0, buflen); tempString[1] = tempString[2] = 0; strcpy(tbuffer, "/vicep"); if (avalue < 0 || avalue >= (26*26+26)) { diff --git a/src/venus/cacheout.c b/src/venus/cacheout.c index 036248fba..59b4e4017 100644 --- a/src/venus/cacheout.c +++ b/src/venus/cacheout.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cacheout.c,v 1.1.1.4 2001/07/14 22:24:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cacheout.c,v 1.1.1.5 2001/09/11 14:35:22 hartmans Exp $"); #include #include @@ -174,8 +174,8 @@ afs_int32 ListServers() afs_uint32 *p; /* get list of file servers in NW byte order */ - bzero(&addrs, sizeof(addrs)); - bzero(&spare3, sizeof(spare3)); + memset(&addrs, 0, sizeof(addrs)); + memset(&spare3, 0, sizeof(spare3)); code=ubik_Call(VL_GetAddrs,client,0,Handle,spare2,&spare3, &server_count,&addrs); if(code) diff --git a/src/venus/cmdebug.c b/src/venus/cmdebug.c index 882d7537d..ccca38df7 100644 --- a/src/venus/cmdebug.c +++ b/src/venus/cmdebug.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cmdebug.c,v 1.1.1.4 2001/07/14 22:24:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cmdebug.c,v 1.1.1.5 2001/09/11 14:35:22 hartmans Exp $"); #include @@ -165,7 +165,7 @@ struct cmd_syndesc *as; { printf("cmdebug: can't resolve address for host %s.\n", hostName); exit(1); } - bcopy(thp->h_addr, &addr, sizeof(afs_int32)); + memcpy(&addr, thp->h_addr, sizeof(afs_int32)); secobj = rxnull_NewServerSecurityObject(); conn = rx_NewConnection(addr, htons(port), 1, secobj, 0); if (!conn) { diff --git a/src/venus/fs.c b/src/venus/fs.c index 8d28763c4..8d6615ce2 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/venus/fs.c,v 1.1.1.7 2001/07/14 22:24:35 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/venus/fs.c,v 1.1.1.8 2001/09/11 14:35:23 hartmans Exp $"); #include #include @@ -250,7 +250,7 @@ static char *Parent(apath) { char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -1099,7 +1099,7 @@ static SetQuotaCmd(as) struct cmd_syndesc ts; /* copy useful stuff from our command slot; we may later have to reorder */ - bcopy(as, &ts, sizeof(ts)); /* copy whole thing */ + memcpy(&ts, as, sizeof(ts)); /* copy whole thing */ return SetVolCmd(&ts); } @@ -1234,7 +1234,7 @@ static WhereIsCmd(as) blob.out_size = MAXSIZE; blob.in_size = 0; blob.out = space; - bzero(space, sizeof(space)); + memset(space, 0, sizeof(space)); code = pioctl(ti->data, VIOCWHEREIS, &blob, 1); if (code) { Die(errno, ti->data); @@ -1373,7 +1373,7 @@ static ListMountCmd(as) * name (we know there is one) and splice in the symlink value. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -1384,7 +1384,7 @@ static ListMountCmd(as) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -1414,7 +1414,7 @@ static ListMountCmd(as) blob.in_size = strlen(last_component)+1; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1); @@ -1470,7 +1470,7 @@ defect #3069 /* Check for a cellname in the volume specification, and complain * if it doesn't match what was specified with -cell */ - if (tmpName = index(volName, ':')) { + if (tmpName = strchr(volName, ':')) { *tmpName = '\0'; if (cellName) { if (strcasecmp(cellName,volName)) { @@ -1550,7 +1550,7 @@ static RemoveMountCmd(as) for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per file */ - tp = (char *) rindex(ti->data, '/'); + tp = (char *) strrchr(ti->data, '/'); if (tp) { strncpy(tbuffer, ti->data, code=tp-ti->data); /* the dir name */ tbuffer[code] = 0; @@ -1603,13 +1603,13 @@ static CheckServersCmd(as) struct afsconf_cell info; struct chservinfo checkserv; - bzero(&checkserv,sizeof(struct chservinfo)); + memset(&checkserv, 0, sizeof(struct chservinfo)); blob.in_size=sizeof(struct chservinfo); blob.in=(caddr_t)&checkserv; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ + memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ /* prepare flags for checkservers command */ temp = 2; /* default to checking local cell only */ @@ -1659,7 +1659,7 @@ static CheckServersCmd(as) Die(errno, 0); return 1; } - bcopy(space, &temp, sizeof(afs_int32)); + memcpy(&temp, space, sizeof(afs_int32)); if (checkserv.tinterval >= 0) { if (checkserv.tinterval > 0) printf("The new down server probe interval (%d secs) is now in effect (old interval was %d secs)\n", @@ -1674,7 +1674,7 @@ static CheckServersCmd(as) else { printf("These servers unavailable due to network or server problems: "); for(j=0; ; j++) { - bcopy(space + j*sizeof(afs_int32), &temp, sizeof(afs_int32)); + memcpy(&temp, space + j*sizeof(afs_int32), sizeof(afs_int32)); if (temp == 0) break; tp = hostutil_GetNameByINet(temp); printf(" %s", tp); @@ -1695,12 +1695,12 @@ static MessagesCmd(as) struct gaginfo gagflags; struct cmd_item *show; - bzero (&gagflags, sizeof(struct gaginfo)); + memset(&gagflags, 0, sizeof(struct gaginfo)); blob.in_size = sizeof(struct gaginfo); blob.in = (caddr_t) &gagflags; blob.out_size = MAXSIZE; blob.out = space; - bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ + memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ if (show = as->parms[0].items) { if (!strcasecmp (show->data, "user")) @@ -1826,7 +1826,7 @@ static ListCellsCmd(as) for(i=0;;i++) { tp = space; - bcopy(&i, tp, sizeof(afs_int32)); + memcpy(tp, &i, sizeof(afs_int32)); blob.out_size = MAXSIZE; blob.in_size = sizeof(afs_int32); blob.in = space; @@ -1843,7 +1843,7 @@ static ListCellsCmd(as) afs_int32 addr; char *name, tbuffer[20]; - bcopy(tp + j*sizeof(afs_int32), &addr, sizeof(afs_int32)); + memcpy(&addr, tp + j*sizeof(afs_int32), sizeof(afs_int32)); if (addr == 0) break; if (resolve) { @@ -1899,7 +1899,7 @@ static NewCellCmd(as) scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS); /* Now setup and do the NEWCELL pioctl call */ - bzero(space, (scount+1) * sizeof(afs_int32)); + memset(space, 0, (scount+1) * sizeof(afs_int32)); tp = space; lp = (afs_int32 *)tp; *lp++ = 0x12345678; @@ -1911,7 +1911,7 @@ static NewCellCmd(as) pn, ti->data); } else { - bcopy(thp->h_addr, tp, sizeof(afs_int32)); + memcpy(tp, thp->h_addr, sizeof(afs_int32)); tp += sizeof(afs_int32); } } @@ -2048,7 +2048,7 @@ static MonitorCmd(as) return 1; } } - else bcopy(thp->h_addr, &hostAddr, sizeof(afs_int32)); + else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32)); } } else { @@ -2108,7 +2108,7 @@ static SysNameCmd(as) input += strlen(ti->data); *(input++) = '\0'; } - bcopy(&setp, space, sizeof(afs_int32)); + memcpy(space, &setp, sizeof(afs_int32)); code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1); if (code) { Die(errno, 0); @@ -2119,15 +2119,15 @@ static SysNameCmd(as) return 0; } input = space; - bcopy(input, &setp, sizeof(afs_int32)); + memcpy(&setp, input, sizeof(afs_int32)); input += sizeof(afs_int32); if (!setp) { fprintf(stderr, "No sysname name value was found\n"); return 1; } - printf("Current sysname%s is:", setp>1 ? " list" : ""); + printf("Current sysname%s is", setp>1 ? " list" : ""); for(;setp>0;--setp) { - printf(" %s", input); + printf(" \'%s\'", input); input += strlen(input) + 1; } printf("\n"); @@ -2398,7 +2398,7 @@ static VLDBInit(noAuthFlag, info) pn, info->numServers, VLDB_MAXSERVERS); exit(1); } - bzero(serverconns, sizeof(serverconns)); + memset(serverconns, 0, sizeof(serverconns)); for (i = 0;inumServers;i++) serverconns[i] = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr, info->hostAddr[i].sin_port, USER_SERVICE_ID, @@ -2493,7 +2493,7 @@ static addServer(name, rank) } sp = (struct spref *) (gblob.in + gblob.in_size); - bcopy (thostent->h_addr_list[t], &(sp->server.s_addr), sizeof(afs_uint32)); + memcpy(&(sp->server.s_addr), thostent->h_addr_list[t], sizeof(afs_uint32)); sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank); gblob.in_size += sizeof(struct spref); ssp->num_servers++; @@ -2724,7 +2724,7 @@ static StoreBehindCmd(as) blob.in = (char *)&tsb; blob.out = (char *)&tsb2; blob.in_size = blob.out_size = sizeof(struct sbstruct); - bzero (&tsb2, sizeof(tsb2)); + memset(&tsb2, 0, sizeof(tsb2)); /* once per -file */ for (ti=as->parms[1].items; ti; ti=ti->next) { @@ -2822,7 +2822,7 @@ static afs_int32 GetCryptCmd(as) if (code) Die(errno, (char *) 0); else { tp = space; - bcopy(tp, &flag, sizeof(afs_int32)); + memcpy(&flag, tp, sizeof(afs_int32)); printf("Security level is currently "); if (flag == 1) printf("crypt (data security).\n"); @@ -3306,7 +3306,7 @@ FlushMountCmd(as) * name (we know there is one) and splice in the symlink value. */ if (true_name[0] != '/') { - last_component = (char *) rindex(orig_name, '/'); + last_component = (char *) strrchr(orig_name, '/'); strcpy(++last_component, true_name); strcpy(true_name, orig_name); } @@ -3317,7 +3317,7 @@ FlushMountCmd(as) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -3346,7 +3346,7 @@ FlushMountCmd(as) blob.in = last_component; blob.in_size = strlen(last_component)+1; blob.out_size = 0; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_FLUSHMOUNT, &blob, 1); diff --git a/src/venus/up.c b/src/venus/up.c index 64bf4be52..9649145bb 100644 --- a/src/venus/up.c +++ b/src/venus/up.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/venus/up.c,v 1.1.1.6 2001/07/14 22:24:37 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/venus/up.c,v 1.1.1.7 2001/09/11 14:35:26 hartmans Exp $"); /* missing type from C language */ #define Boolean short @@ -49,8 +49,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/venus/up.c,v 1.1.1.6 2001/07/14 22:24:3 #define MAXACL 400 -extern char *index (); -extern char *rindex (); #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) extern sys_nerr; extern char *sys_errlist[]; @@ -191,7 +189,7 @@ Boolean MakeParent(file, owner) strcpy(parent, file); - p = rindex(parent, '/'); + p = strrchr(parent, '/'); if (!p) { strcpy(parent, "."); } @@ -684,7 +682,7 @@ int isMountPoint( name, blob ) /* * Find rightmost slash, if any. */ - last_component = (char *) rindex(true_name, '/'); + last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* * Found it. Designate everything before it as the parent directory, @@ -713,7 +711,7 @@ int isMountPoint( name, blob ) blob->in_size = strlen(last_component)+1; blob->out_size = MAXSIZE; blob->out = space; - bzero(space, MAXSIZE); + memset(space, 0, MAXSIZE); code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, blob, 0); diff --git a/src/vfsck/dir.c b/src/vfsck/dir.c index f306cf612..d72c7b016 100644 --- a/src/vfsck/dir.c +++ b/src/vfsck/dir.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/dir.c,v 1.1.1.3 2001/07/14 22:24:40 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/dir.c,v 1.1.1.4 2001/09/11 14:35:27 hartmans Exp $"); #define VICE /* allow us to put our changes in at will */ #include @@ -116,7 +116,7 @@ descend(parentino, inumber) register struct dinode *dp; struct inodesc curino; - bzero((char *)&curino, sizeof(struct inodesc)); + memset((char *)&curino, 0, sizeof(struct inodesc)); if (statemap[inumber] != DSTATE) errexit("BAD INODE %d TO DESCEND", statemap[inumber]); #if defined(ACLS) && defined(AFS_HPUX_ENV) @@ -202,11 +202,11 @@ dirscan(idesc) idesc->id_loc = 0; for (dp = fsck_readdir(idesc); dp != NULL; dp = fsck_readdir(idesc)) { dsize = dp->d_reclen; - bcopy((char *)dp, dbuf, dsize); + memcpy(dbuf, (char *)dp, dsize); idesc->id_dirp = (struct direct *)dbuf; if ((n = (*idesc->id_func)(idesc)) & ALTERED) { bp = getdirblk(idesc->id_blkno, blksiz); - bcopy(dbuf, (char *)dp, dsize); + memcpy((char *)dp, dbuf, dsize); dirty(bp); sbdirty(); } @@ -378,7 +378,7 @@ mkentry(idesc) dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ dirp->d_reclen = newent.d_reclen; dirp->d_namlen = strlen(idesc->id_name); - bcopy(idesc->id_name, dirp->d_name, (int)dirp->d_namlen + 1); + memcpy(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1); return (ALTERED|STOP); } @@ -387,7 +387,7 @@ chgino(idesc) { register struct direct *dirp = idesc->id_dirp; - if (bcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1)) + if (memcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1)) return (KEEPON); dirp->d_ino = idesc->id_parent; return (ALTERED|STOP); @@ -404,7 +404,7 @@ linkup(orphan, parentdir) char tempname[BUFSIZ]; extern int pass4check(); - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); dp = ginode(orphan); lostdir = (dp->di_mode & IFMT) == IFDIR; pwarn("UNREF %s ", lostdir ? "DIR" : "FILE"); @@ -482,7 +482,7 @@ linkup(orphan, parentdir) return (0); } len = strlen(lfname); - bcopy(lfname, pathp, len + 1); + memcpy(pathp, lfname, len + 1); pathp += len; len = lftempname(tempname, orphan); if (makeentry(lfdir, orphan, tempname) == 0) { @@ -492,7 +492,7 @@ linkup(orphan, parentdir) } lncntp[orphan]--; *pathp++ = '/'; - bcopy(tempname, pathp, len + 1); + memcpy(pathp, tempname, len + 1); pathp += len; if (lostdir) { dp = ginode(orphan); @@ -528,7 +528,7 @@ makeentry(parent, ino, name) if (parent < ROOTINO || parent >= maxino || ino < ROOTINO || ino >= maxino) return (0); - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; idesc.id_func = mkentry; idesc.id_number = parent; @@ -570,21 +570,21 @@ expanddir(dp) dblksize(&sblock, dp, lastbn + 1)); if (bp->b_errs) goto bad; - bcopy(bp->b_un.b_buf, firstblk, DIRBLKSIZ); + memcpy(firstblk, bp->b_un.b_buf, DIRBLKSIZ); bp = getdirblk(newblk, sblock.fs_bsize); if (bp->b_errs) goto bad; - bcopy(firstblk, bp->b_un.b_buf, DIRBLKSIZ); + memcpy(bp->b_un.b_buf, firstblk, DIRBLKSIZ); for (cp = &bp->b_un.b_buf[DIRBLKSIZ]; cp < &bp->b_un.b_buf[sblock.fs_bsize]; cp += DIRBLKSIZ) - bcopy((char *)&emptydir, cp, sizeof emptydir); + memcpy(cp, (char *)&emptydir, sizeof emptydir); dirty(bp); bp = getdirblk(dp->di_db[lastbn + 1], dblksize(&sblock, dp, lastbn + 1)); if (bp->b_errs) goto bad; - bcopy((char *)&emptydir, bp->b_un.b_buf, sizeof emptydir); + memcpy(bp->b_un.b_buf, (char *)&emptydir, sizeof emptydir); pwarn("NO SPACE LEFT IN %s", pathname); if (preen) printf(" (EXPANDED)\n"); @@ -623,11 +623,11 @@ allocdir(parent, request, mode) freeino(ino); return (0); } - bcopy((char *)&dirhead, bp->b_un.b_buf, sizeof dirhead); + memcpy(bp->b_un.b_buf, (char *)&dirhead, sizeof dirhead); for (cp = &bp->b_un.b_buf[DIRBLKSIZ]; cp < &bp->b_un.b_buf[sblock.fs_fsize]; cp += DIRBLKSIZ) - bcopy((char *)&emptydir, cp, sizeof emptydir); + memcpy(cp, (char *)&emptydir, sizeof emptydir); dirty(bp); dp->di_nlink = 2; inodirty(); @@ -645,8 +645,7 @@ allocdir(parent, request, mode) inp->i_isize = dp->di_size; inp->i_numblks = dp->di_blocks * sizeof(daddr_t); inp->i_parent = parent; - bcopy((char *)&dp->di_db[0], (char *)&inp->i_blks[0], - (int)inp->i_numblks); + memcpy((char *)&inp->i_blks[0], (char *)&dp->di_db[0], (int)inp->i_numblks); } #endif if (ino == ROOTINO) { diff --git a/src/vfsck/inode.c b/src/vfsck/inode.c index 7a2caa7da..85d09d914 100644 --- a/src/vfsck/inode.c +++ b/src/vfsck/inode.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/inode.c,v 1.1.1.3 2001/07/14 22:24:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/inode.c,v 1.1.1.4 2001/09/11 14:35:27 hartmans Exp $"); #define VICE /* control whether AFS changes are present */ #include @@ -423,7 +423,7 @@ findname(idesc) if (dirp->d_ino != idesc->id_parent) return (KEEPON); - bcopy(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1); + memcpy(idesc->id_name, dirp->d_name, (int)dirp->d_namlen + 1); return (STOP|FOUND); } @@ -607,7 +607,7 @@ freeino(ino) extern int pass4check(); struct dinode *dp; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass4check; idesc.id_number = ino; diff --git a/src/vfsck/main.c b/src/vfsck/main.c index 17d8d960b..6d3a18b47 100644 --- a/src/vfsck/main.c +++ b/src/vfsck/main.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/main.c,v 1.1.1.4 2001/07/14 22:24:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/main.c,v 1.1.1.5 2001/09/11 14:35:28 hartmans Exp $"); #define VICE /* allow us to put our changes in at will */ #include @@ -1092,7 +1092,7 @@ n printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", msgprintf("%s: AFS file system partition was modified; forcing full salvage\n", devname); devname = unrawname(devname); - special = (char *) rindex(devname, '/'); + special = (char *) strrchr(devname, '/'); if (!special++) special = devname; strcpy(pname, "/etc/vfsck."); /* Using /etc, rather than /tmp, since /tmp is a link to /usr/tmp on some systems, and isn't mounted now */ diff --git a/src/vfsck/pass1.c b/src/vfsck/pass1.c index 231b813d5..0b0ddd679 100644 --- a/src/vfsck/pass1.c +++ b/src/vfsck/pass1.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass1.c,v 1.1.1.3 2001/07/14 22:24:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass1.c,v 1.1.1.4 2001/09/11 14:35:28 hartmans Exp $"); #define VICE #include @@ -96,7 +96,7 @@ pass1() /* * Find all allocated blocks. */ - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass1check; inumber = 0; @@ -110,10 +110,9 @@ pass1() continue; dp = ginode(inumber); if ((dp->di_mode & IFMT) == 0) { - if (bcmp((char *)dp->di_db, (char *)zino.di_db, + if (memcmp((char *)dp->di_db, (char *)zino.di_db, NDADDR * sizeof(daddr_t)) || - bcmp((char *)dp->di_ib, (char *)zino.di_ib, - NIADDR * sizeof(daddr_t)) || + memcmp((char *)dp->di_ib, (char *)zino.di_ib, NIADDR * sizeof(daddr_t)) || #if defined(ACLS) && defined(AFS_HPUX_ENV) dp->di_mode || dp->di_size || dp->di_contin) { if (dp->di_contin != 0) diff --git a/src/vfsck/pass1b.c b/src/vfsck/pass1b.c index 2127223b7..08a3e618a 100644 --- a/src/vfsck/pass1b.c +++ b/src/vfsck/pass1b.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass1b.c,v 1.1.1.3 2001/07/14 22:24:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass1b.c,v 1.1.1.4 2001/09/11 14:35:29 hartmans Exp $"); #define VICE #include @@ -74,7 +74,7 @@ pass1b() struct inodesc idesc; ino_t inumber; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass1bcheck; duphead = duplist; diff --git a/src/vfsck/pass2.c b/src/vfsck/pass2.c index 3536e58cf..e4e54246e 100644 --- a/src/vfsck/pass2.c +++ b/src/vfsck/pass2.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass2.c,v 1.1.1.3 2001/07/14 22:24:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass2.c,v 1.1.1.4 2001/09/11 14:35:30 hartmans Exp $"); #define VICE #include @@ -83,7 +83,7 @@ pass2() register struct dinode *dp; struct inodesc rootdesc; - bzero((char *)&rootdesc, sizeof(struct inodesc)); + memset((char *)&rootdesc, 0, sizeof(struct inodesc)); rootdesc.id_type = ADDR; rootdesc.id_func = pass2check; rootdesc.id_number = ROOTINO; @@ -207,17 +207,17 @@ pass2check(idesc) #endif } else if (dirp->d_reclen < 2 * entrysize) { proto.d_reclen = dirp->d_reclen; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); if (reply("FIX") == 1) ret |= ALTERED; } else { n = dirp->d_reclen - entrysize; proto.d_reclen = entrysize; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); idesc->id_entryno++; lncntp[dirp->d_ino]--; dirp = (struct direct *)((char *)(dirp) + entrysize); - bzero((char *)dirp, n); + memset((char *)dirp, 0, n); dirp->d_reclen = n; if (reply("FIX") == 1) ret |= ALTERED; @@ -238,7 +238,7 @@ chk1: idesc->id_entryno++; lncntp[dirp->d_ino]--; dirp = (struct direct *)((char *)(dirp) + n); - bzero((char *)dirp, n); + memset((char *)dirp, 0, n); dirp->d_reclen = n; } if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") == 0) { @@ -264,7 +264,7 @@ chk1: #endif } else { proto.d_reclen = dirp->d_reclen; - bcopy((char *)&proto, (char *)dirp, entrysize); + memcpy((char *)dirp, (char *)&proto, entrysize); if (reply("FIX") == 1) ret |= ALTERED; } @@ -295,7 +295,7 @@ chk2: *pathp = '\0'; errexit("NAME TOO LONG %s%s\n", pathname, dirp->d_name); } - bcopy(dirp->d_name, pathp, (int)dirp->d_namlen + 1); + memcpy(pathp, dirp->d_name, (int)dirp->d_namlen + 1); pathp += dirp->d_namlen; idesc->id_entryno++; n = 0; diff --git a/src/vfsck/pass3.c b/src/vfsck/pass3.c index 5ce1b0054..449e9e919 100644 --- a/src/vfsck/pass3.c +++ b/src/vfsck/pass3.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass3.c,v 1.1.1.3 2001/07/14 22:24:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass3.c,v 1.1.1.4 2001/09/11 14:35:30 hartmans Exp $"); #define VICE #include @@ -75,7 +75,7 @@ pass3() ino_t inumber, orphan; int loopcnt; - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; for (inumber = ROOTINO; inumber <= lastino; inumber++) { #if defined(ACLS) && defined(AFS_HPUX_ENV) diff --git a/src/vfsck/pass4.c b/src/vfsck/pass4.c index 101974475..bb9fb0169 100644 --- a/src/vfsck/pass4.c +++ b/src/vfsck/pass4.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass4.c,v 1.1.1.3 2001/07/14 22:24:42 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass4.c,v 1.1.1.4 2001/09/11 14:35:30 hartmans Exp $"); #define VICE #include @@ -78,7 +78,7 @@ pass4() #endif /* ACLS */ - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = ADDR; idesc.id_func = pass4check; for (inumber = ROOTINO; inumber <= lastino; inumber++) { diff --git a/src/vfsck/pass5.c b/src/vfsck/pass5.c index 9132d7103..426062770 100644 --- a/src/vfsck/pass5.c +++ b/src/vfsck/pass5.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass5.c,v 1.1.1.3 2001/07/14 22:24:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/pass5.c,v 1.1.1.4 2001/09/11 14:35:30 hartmans Exp $"); #define VICE #include @@ -101,7 +101,7 @@ pass5() struct cg *ocg = (struct cg *) buf; #endif /* AFS_NEWCG_ENV */ - bzero((char *)newcg, (int)fs->fs_cgsize); + memset((char *)newcg, 0, (int)fs->fs_cgsize); newcg->cg_niblk = fs->fs_ipg; #ifdef AFS_NEWCG_ENV postype = (int) fs->fs_postblformat; @@ -157,10 +157,10 @@ pass5() #endif /* AFS_NEWCG_ENV */ } - bzero((char *)&idesc[0], sizeof idesc); + memset((char *)&idesc[0], 0, sizeof idesc); for (i = 0; i < 3; i++) idesc[i].id_type = ADDR; - bzero((char *)&cstotal, sizeof(struct csum)); + memset((char *)&cstotal, 0, sizeof(struct csum)); (void)time(&now); #ifdef notdef /* this is the original from UCB/McKusick, but it is clearly wrong. It is @@ -216,14 +216,14 @@ pass5() newcg->cg_irotor = cg->cg_irotor; else newcg->cg_irotor = 0; - bzero((char *)&newcg->cg_frsum[0], sizeof newcg->cg_frsum); + memset((char *)&newcg->cg_frsum[0], 0, sizeof newcg->cg_frsum); #ifdef AFS_NEWCG_ENV - bzero((char *)&cg_blktot(newcg)[0], sumsize + mapsize); + memset((char *)&cg_blktot(newcg)[0], 0, sumsize + mapsize); #else /* AFS_NEWCG_ENV */ - bzero((char *)newcg->cg_btot, sizeof(newcg->cg_btot)); - bzero((char *)newcg->cg_b, sizeof(newcg->cg_b)); - bzero((char *)newcg->cg_iused, sizeof(newcg->cg_iused)); - bzero((char *)newcg->cg_free, howmany(fs->fs_fpg, NBBY)); + memset((char *)newcg->cg_btot, 0, sizeof(newcg->cg_btot)); + memset((char *)newcg->cg_b, 0, sizeof(newcg->cg_b)); + memset((char *)newcg->cg_iused, 0, sizeof(newcg->cg_iused)); + memset((char *)newcg->cg_free, 0, howmany(fs->fs_fpg, NBBY)); #endif /* AFS_NEWCG_ENV */ #ifdef AFS_NEWCG_ENV if (fs->fs_postblformat == FS_42POSTBLFMT) @@ -319,49 +319,46 @@ pass5() cstotal.cs_nifree += newcg->cg_cs.cs_nifree; cstotal.cs_ndir += newcg->cg_cs.cs_ndir; cs = &fs->fs_cs(fs, c); - if (bcmp((char *)&newcg->cg_cs, (char *)cs, sizeof *cs) != 0 && + if (memcmp((char *)&newcg->cg_cs, (char *)cs, sizeof *cs) != 0 && dofix(&idesc[0], "FREE BLK COUNT(S) WRONG IN CYL GROUP (SUPERBLK)")) { - bcopy((char *)&newcg->cg_cs, (char *)cs, sizeof *cs); + memcpy((char *)cs, (char *)&newcg->cg_cs, sizeof *cs); sbdirty(); } #ifdef AFS_NEWCG_ENV if (cvtflag) { - bcopy((char *)newcg, (char *)cg, (int)fs->fs_cgsize); + memcpy((char *)cg, (char *)newcg, (int)fs->fs_cgsize); cgdirty(); continue; } #endif /* AFS_NEWCG_ENV */ #ifdef AFS_NEWCG_ENV - if (bcmp(cg_inosused(newcg), + if (memcmp(cg_inosused(newcg), cg_inosused(cg), mapsize) != 0 && dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { - bcopy(cg_inosused(newcg), cg_inosused(cg), mapsize); + memcpy(cg_inosused(cg), cg_inosused(newcg), mapsize); cgdirty(); } #else /* AFS_NEWCG_ENV */ - if (bcmp(newcg->cg_iused, + if (memcmp(newcg->cg_iused, cg->cg_iused, mapsize) != 0 && dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { - bcopy(newcg->cg_iused, cg->cg_iused, mapsize); + memcpy(cg->cg_iused, newcg->cg_iused, mapsize); cgdirty(); } #endif /* AFS_NEWCG_ENV */ - if ((bcmp((char *)newcg, (char *)cg, basesize) != 0 || + if ((memcmp((char *)newcg, (char *)cg, basesize) != 0 || #ifdef AFS_NEWCG_ENV - bcmp((char *)&cg_blktot(newcg)[0], - (char *)&cg_blktot(cg)[0], sumsize) != 0) && + memcmp((char *)&cg_blktot(newcg)[0], (char *)&cg_blktot(cg)[0], sumsize) != 0) && #else /* AFS_NEWCG_ENV */ - bcmp((char *)newcg->cg_btot, - (char *)cg->cg_btot, sumsize) != 0) && + memcmp((char *)newcg->cg_btot, (char *)cg->cg_btot, sumsize) != 0) && #endif /* AFS_NEWCG_ENV */ dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { #ifdef AFS_NEWCG_ENV - bcopy((char *)newcg, (char *)cg, basesize); - bcopy((char *)&cg_blktot(newcg)[0], - (char *)&cg_blktot(cg)[0], sumsize); + memcpy((char *)cg, (char *)newcg, basesize); + memcpy((char *)&cg_blktot(cg)[0], (char *)&cg_blktot(newcg)[0], sumsize); #else /* AFS_NEWCG_ENV */ - bcopy((char *)newcg, (char *)cg, basesize); - bcopy((char *)newcg->cg_btot, (char *)cg->cg_btot, sumsize); + memcpy((char *)cg, (char *)newcg, basesize); + memcpy((char *)cg->cg_btot, (char *)newcg->cg_btot, sumsize); #endif /* AFS_NEWCG_ENV */ cgdirty(); } @@ -370,9 +367,9 @@ pass5() if (fs->fs_postblformat == FS_42POSTBLFMT) fs->fs_nrpos = savednrpos; #endif /* AFS_NEWCG_ENV */ - if (bcmp((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs) != 0 + if (memcmp((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs) != 0 && dofix(&idesc[0], "FREE BLK COUNT(S) WRONG IN SUPERBLK")) { - bcopy((char *)&cstotal, (char *)&fs->fs_cstotal, sizeof *cs); + memcpy((char *)&fs->fs_cstotal, (char *)&cstotal, sizeof *cs); fs->fs_ronly = 0; sbfine(fs); sbdirty(); diff --git a/src/vfsck/proplist.c b/src/vfsck/proplist.c index 86dd934d2..e64696d5b 100644 --- a/src/vfsck/proplist.c +++ b/src/vfsck/proplist.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/proplist.c,v 1.1.1.4 2001/07/14 22:24:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/proplist.c,v 1.1.1.5 2001/09/11 14:35:31 hartmans Exp $"); #define VICE /* control whether AFS changes are present */ @@ -173,8 +173,7 @@ int proplist_blkscan(dp, idesc, entry_list) return(SKIP); entry->next = NULL; entry->flags = 0; - bcopy((char *)&pl_descp[1], entry->name, - pl_descp->pl_namelen); + memcpy(entry->name, (char *)&pl_descp[1], pl_descp->pl_namelen); entry->blkno = idesc->id_blkno; entry->blksize = blksize; entry->offset = idesc->id_loc; diff --git a/src/vfsck/setup.c b/src/vfsck/setup.c index 8dd3666bd..98dd79dfe 100644 --- a/src/vfsck/setup.c +++ b/src/vfsck/setup.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/setup.c,v 1.1.1.3 2001/07/14 22:24:43 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/setup.c,v 1.1.1.4 2001/09/11 14:35:31 hartmans Exp $"); #include #define VICE @@ -109,7 +109,6 @@ struct bufarea *pbp; /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY)) char *malloc(), *calloc(); -char *index(); struct disklabel *getdisklabel(); setup(dev) @@ -485,8 +484,7 @@ restat: } #endif /* AFS_NEWCG_ENV */ if (asblk.b_dirty) { - bcopy((char *)&sblock, (char *)&altsblock, - (int)sblock.fs_sbsize); + memcpy((char *)&altsblock, (char *)&sblock, (int)sblock.fs_sbsize); flush(fswritefd, &asblk); } /* @@ -695,23 +693,18 @@ readsb(listerr) #if !defined(__alpha) && !defined(AFS_SUN56_ENV) #if !defined(AFS_HPUX110_ENV) /* HPUX110 will use UpdateAlternateSuper() below */ - bcopy((char *)sblock.fs_csp, (char *)altsblock.fs_csp, - sizeof sblock.fs_csp); + memcpy((char *)altsblock.fs_csp, (char *)sblock.fs_csp, sizeof sblock.fs_csp); #endif /* ! AFS_HPUX110_ENV */ #endif /* ! __alpha */ #if defined(AFS_SUN56_ENV) - bcopy((char *)sblock.fs_u.fs_csp_pad, (char *)altsblock.fs_u.fs_csp_pad, - sizeof (sblock.fs_u.fs_csp_pad)); + memcpy((char *)altsblock.fs_u.fs_csp_pad, (char *)sblock.fs_u.fs_csp_pad, sizeof (sblock.fs_u.fs_csp_pad)); #endif - bcopy((char *)sblock.fs_fsmnt, (char *)altsblock.fs_fsmnt, - sizeof sblock.fs_fsmnt); + memcpy((char *)altsblock.fs_fsmnt, (char *)sblock.fs_fsmnt, sizeof sblock.fs_fsmnt); #ifndef AFS_HPUX_ENV - bcopy((char *)sblock.fs_sparecon, (char *)altsblock.fs_sparecon, - sizeof sblock.fs_sparecon); + memcpy((char *)altsblock.fs_sparecon, (char *)sblock.fs_sparecon, sizeof sblock.fs_sparecon); #endif #if defined(AFS_DEC_ENV) - bcopy((char *)sblock.fs_extra, (char *)altsblock.fs_extra, - sizeof sblock.fs_extra); + memcpy((char *)altsblock.fs_extra, (char *)sblock.fs_extra, sizeof sblock.fs_extra); altsblock.fs_deftimer = sblock.fs_deftimer; altsblock.fs_lastfsck = sblock.fs_lastfsck; altsblock.fs_gennum = sblock.fs_gennum; @@ -728,13 +721,12 @@ readsb(listerr) #if defined(AFS_HPUX110_ENV) UpdateAlternateSuper(&sblock, &altsblock); #endif /* AFS_HPUX110_ENV */ - if (bcmp((char *)&sblock, (char *)&altsblock, (int)sblock.fs_sbsize)) { + if (memcmp((char *)&sblock, (char *)&altsblock, (int)sblock.fs_sbsize)) { #ifdef __alpha - if (bcmp((char *)&sblock.fs_blank[0], + if (memcmp((char *)&sblock.fs_blank[0], (char *)&altsblock.fs_blank[0], MAXCSBUFS*sizeof(int))) { - bzero((char *)sblock.fs_blank, - sizeof(sblock.fs_blank)); + memset((char *)sblock.fs_blank, 0, sizeof(sblock.fs_blank)); } else { #endif /* __alpha */ badsb(listerr, diff --git a/src/vfsck/utilities.c b/src/vfsck/utilities.c index f3246cafb..173652815 100644 --- a/src/vfsck/utilities.c +++ b/src/vfsck/utilities.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/utilities.c,v 1.1.1.3 2001/07/14 22:24:41 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/utilities.c,v 1.1.1.4 2001/09/11 14:35:32 hartmans Exp $"); #include #define VICE /* allow us to put our changes in at will */ @@ -419,7 +419,7 @@ bread(fd, buf, blk, size) #endif rwerror("SEEK", blk); errs = 0; - bzero(buf, (int)size); + memset(buf, 0, (int)size); printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:"); #ifdef AFS_SUN5_ENV for (cp = buf, i = 0; i < btodb(size); i++, cp += DEV_BSIZE) { @@ -578,7 +578,7 @@ getpathname(namebuf, curdir, ino) strcpy(namebuf, "?"); return; } - bzero((char *)&idesc, sizeof(struct inodesc)); + memset((char *)&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; cp = &namebuf[BUFSIZ - 1]; *cp = '\0'; @@ -609,7 +609,7 @@ getpathname(namebuf, curdir, ino) cp -= len; if (cp < &namebuf[MAXNAMLEN]) break; - bcopy(namebuf, cp, len); + memcpy(cp, namebuf, len); *--cp = '/'; ino = idesc.id_number; } @@ -617,7 +617,7 @@ getpathname(namebuf, curdir, ino) strcpy(namebuf, "?"); return; } - bcopy(cp, namebuf, &namebuf[BUFSIZ] - cp); + memcpy(namebuf, cp, &namebuf[BUFSIZ] - cp); } void diff --git a/src/viced/callback.c b/src/viced/callback.c index 8fc8b2aec..18ab3d4c8 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -82,7 +82,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/callback.c,v 1.1.1.5 2001/07/14 22:24:46 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/callback.c,v 1.1.1.6 2001/09/11 14:35:33 hartmans Exp $"); #include #include /* for malloc() */ @@ -1631,7 +1631,7 @@ main(argc, argv) register struct CallBack *cb; time_t now; - bzero(&fid, sizeof(fid)); + memset(&fid, 0, sizeof(fid)); argc--; argv++; while (argc && **argv == '-') { noptions++; diff --git a/src/viced/fsprobe.c b/src/viced/fsprobe.c index 1b5f10b8f..b45d2869e 100644 --- a/src/viced/fsprobe.c +++ b/src/viced/fsprobe.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/fsprobe.c,v 1.1.1.4 2001/07/14 22:24:46 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/fsprobe.c,v 1.1.1.5 2001/09/11 14:35:35 hartmans Exp $"); #include #include @@ -98,7 +98,7 @@ main(argc, argv) printf("usage: pxclient \n"); exit(1); } - bzero((char *)&host, sizeof(struct sockaddr_in)); + memset((char *)&host, 0, sizeof(struct sockaddr_in)); host.sin_family = AF_INET; host.sin_addr.s_addr = inet_addr(av[0]); if (host.sin_addr.s_addr != -1) { @@ -108,7 +108,7 @@ main(argc, argv) hp = gethostbyname(av[0]); if (hp) { host.sin_family = hp->h_addrtype; - bcopy(hp->h_addr, (caddr_t)&host.sin_addr, hp->h_length); + memcpy((caddr_t)&host.sin_addr, hp->h_addr, hp->h_length); hostname = hp->h_name; } else { printf("unknown server host %s\n", av[0]); @@ -272,7 +272,7 @@ FetchData(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -332,7 +332,7 @@ FetchStatus(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -357,7 +357,7 @@ FetchACL(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -384,7 +384,7 @@ StoreData(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -394,7 +394,7 @@ StoreData(argp) ++argp; sscanf(&(*argp)[0], "%d", &filelength); ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -462,11 +462,11 @@ StoreStatus(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -507,7 +507,7 @@ StoreACL(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -536,13 +536,13 @@ RemoveFile(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&nameFid, sizeof(struct afsFidName)); + memset(&nameFid, 0, sizeof(struct afsFidName)); strcpy(nameFid.name, name); code = ubik_Call(AFS_RemoveFile, cstruct, 0, &fid, &nameFid, &hyp0, 0, &OutDirStatus, &OutFidStatus, &outFid, &tsync); @@ -566,13 +566,13 @@ CreateFile(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -613,25 +613,25 @@ Rename(argp) ++argp; sscanf(&(*argp)[0], "%d", &ounique); ++argp; - bzero(&OldDirFid, sizeof(struct afsFid)); + memset(&OldDirFid, 0, sizeof(struct afsFid)); OldDirFid.Volume.low = 10; /* XXX */ OldDirFid.Vnode = ovnode; OldDirFid.Unique = ounique; oname = &argp[0][0]; ++argp; - bzero(&OldName, sizeof(struct afsFidName)); + memset(&OldName, 0, sizeof(struct afsFidName)); strcpy(OldName.name, oname); sscanf(&(*argp)[0], "%d", &nvnode); ++argp; sscanf(&(*argp)[0], "%d", &nunique); ++argp; - bzero(&NewDirFid, sizeof(struct afsFid)); + memset(&NewDirFid, 0, sizeof(struct afsFid)); NewDirFid.Volume.low = 10; /* XXX */ NewDirFid.Vnode = nvnode; NewDirFid.Unique = nunique; nname = &argp[0][0]; ++argp; - bzero(&NewName, sizeof(struct afsFidName)); + memset(&NewName, 0, sizeof(struct afsFidName)); strcpy(NewName.name, nname); code = ubik_Call(AFS_Rename, cstruct, 0, &OldDirFid, &OldName, &NewDirFid, &NewName, &hyp0, 0, &OutOldDirStatus, &OutNewDirStatus, @@ -657,7 +657,7 @@ Symlink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -665,7 +665,7 @@ Symlink(argp) ++argp; linkcontents = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -704,7 +704,7 @@ HardLink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -714,7 +714,7 @@ HardLink(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&existingFid, sizeof(struct afsFid)); + memset(&existingFid, 0, sizeof(struct afsFid)); existingFid.Volume.low = 10; /* XXX */ existingFid.Vnode = vnode; existingFid.Unique = unique; @@ -740,13 +740,13 @@ MakeDir(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&InStatus, sizeof(struct afsStoreStatus)); + memset(&InStatus, 0, sizeof(struct afsStoreStatus)); sscanf(&(*argp)[0], "%d", &mode); ++argp; sscanf(&(*argp)[0], "%d", &owner); @@ -786,13 +786,13 @@ RemoveDir(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; name = &argp[0][0]; ++argp; - bzero(&nameFid, sizeof(struct afsFidName)); + memset(&nameFid, 0, sizeof(struct afsFidName)); strcpy(nameFid.name, name); code = ubik_Call(AFS_RemoveDir, cstruct, 0, &fid, &nameFid, &hyp0, 0, &OutDirStatus, &outFid, &tsync); @@ -820,7 +820,7 @@ Readdir(argp) ++argp; sscanf(&(*argp)[0], "%d", &length); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -882,7 +882,7 @@ Lookup(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; @@ -908,13 +908,13 @@ GetToken(argp) ++argp; sscanf(&(*argp)[0], "%d", &unique); ++argp; - bzero(&fid, sizeof(struct afsFid)); + memset(&fid, 0, sizeof(struct afsFid)); fid.Volume.low = 10; /* XXX */ fid.Vnode = vnode; fid.Unique = unique; sscanf(&(*argp)[0], "%d", &tokenId); ++argp; - bzero(&MinToken, sizeof(struct afsToken)); + memset(&MinToken, 0, sizeof(struct afsToken)); MinToken.tokenID.low = tokenId; /* XXX */ code = ubik_Call(AFS_GetToken, cstruct, 0, &fid, &MinToken, &hyp0, 0, &RealToken, &OutStatus, &tsync); @@ -945,7 +945,7 @@ KeepAlive(argp) struct afsFidExp fx; int code; - bzero(&fx, sizeof(struct afsFidExp)); + memset(&fx, 0, sizeof(struct afsFidExp)); sscanf(&(*argp)[0], "%d", &fx.fid.Volume.low); ++argp; sscanf(&(*argp)[0], "%d", &fx.fid.Vnode); @@ -955,7 +955,7 @@ KeepAlive(argp) sscanf(&(*argp)[0], "%d", &numExec); ++argp; sscanf(&(*argp)[0], "%d", &fx.keepAliveTime); - bzero(&fex, sizeof(struct afsBulkFEX)); + memset(&fex, 0, sizeof(struct afsBulkFEX)); fex.afsBulkFEX_val = &fx; fex.afsBulkFEX_len = 1; code = ubik_Call(AFS_BulkKeepAlive, cstruct, 0, &fex, numExec, 0, 0, 0, &spare4); diff --git a/src/viced/host.c b/src/viced/host.c index 627ea478e..a320d72e9 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.5 2001/07/14 22:24:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.6 2001/09/11 14:35:35 hartmans Exp $"); #include #include @@ -143,7 +143,7 @@ static struct client *GetCE() entry = CEFree; CEFree = entry->next; CEs++; - bzero((char *)entry, CLIENT_TO_ZERO(entry)); + memset((char *)entry, 0, CLIENT_TO_ZERO(entry)); return(entry); } /*GetCE*/ @@ -225,7 +225,7 @@ static struct host *GetHT() entry = HTFree; HTFree = entry->next; HTs++; - bzero((char *)entry, HOST_TO_ZERO(entry)); + memset((char *)entry, 0, HOST_TO_ZERO(entry)); return(entry); } /*GetHT*/ @@ -1981,7 +1981,7 @@ h_CheckHosts() { afs_uint32 now = FT_ApproxTime(); - bzero((char *)&zerofid, sizeof(zerofid)); + memset((char *)&zerofid, 0, sizeof(zerofid)); /* * Send a probe to the workstation if it hasn't been heard from in * 15 minutes diff --git a/src/viced/physio.c b/src/viced/physio.c index 3b2071567..f878994fa 100644 --- a/src/viced/physio.c +++ b/src/viced/physio.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/physio.c,v 1.1.1.4 2001/07/14 22:24:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/physio.c,v 1.1.1.5 2001/09/11 14:35:35 hartmans Exp $"); #include #include @@ -154,14 +154,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero((char *)file, sizeof(DirHandle)); + memset((char *)file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero((char *)file, sizeof(DirHandle)); + memset((char *)file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/viced/profile.c b/src/viced/profile.c index 8347b4803..8690cbece 100644 --- a/src/viced/profile.c +++ b/src/viced/profile.c @@ -12,7 +12,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/profile.c,v 1.1.1.4 2001/07/14 22:24:47 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/profile.c,v 1.1.1.5 2001/09/11 14:35:36 hartmans Exp $"); #include #include @@ -58,7 +58,7 @@ void StartProfiling() #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) /* Soon should handle aix profiling */ AllocProfBuf(); - bzero (profBuf, profBufSize); + memset(profBuf, 0, profBufSize); /* the following code is to replace the monitor call below */ /* monitor (PROFSTART, &etext, profBuf, profBufSize, 0); */ profileHeader.startpc = PROFSTART; diff --git a/src/viced/viced.c b/src/viced/viced.c index 26b615d7b..e0d58e4d4 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -19,7 +19,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/viced.c,v 1.1.1.6 2001/07/14 22:24:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/viced.c,v 1.1.1.7 2001/09/11 14:35:36 hartmans Exp $"); #include #include @@ -256,7 +256,7 @@ static int get_key(arock, akvno, akey) code = afsconf_GetKey(confDir, akvno, tkey.key); if (code) return code; - bcopy(tkey.key, akey, sizeof(tkey.key)); + memcpy(akey, tkey.key, sizeof(tkey.key)); return 0; } /*get_key*/ @@ -604,7 +604,7 @@ main(argc, argv) } else { char hoststr[16]; - bcopy(he->h_addr, &FS_HostAddr_NBO, 4); + memcpy(&FS_HostAddr_NBO, he->h_addr, 4); afs_inet_ntoa_r(FS_HostAddr_NBO, hoststr); FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO); ViceLog(0,("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n", @@ -742,9 +742,9 @@ static void ClearXStatValues() /* * Zero all xstat-related structures. */ - bzero((char *)(&afs_perfstats), sizeof(struct afs_PerfStats)); + memset((char *)(&afs_perfstats), 0, sizeof(struct afs_PerfStats)); #if FS_STATS_DETAILED - bzero((char *)(&afs_FullPerfStats), sizeof(struct fs_stats_FullPerfStats)); + memset((char *)(&afs_FullPerfStats), 0, sizeof(struct fs_stats_FullPerfStats)); /* * That's not enough. We have to set reasonable minima for diff --git a/src/vlserver/cnvldb.c b/src/vlserver/cnvldb.c index 2ab35c5c2..392a14972 100644 --- a/src/vlserver/cnvldb.c +++ b/src/vlserver/cnvldb.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/cnvldb.c,v 1.1.1.4 2001/07/14 22:24:50 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/cnvldb.c,v 1.1.1.5 2001/09/11 14:35:37 hartmans Exp $"); #include #include @@ -48,7 +48,7 @@ static char *Parent(apath) char *apath; { register char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -584,7 +584,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) if (fromv == 1) { if (tov == 1) { - bcopy (fromaddr, toaddr, sizeof(struct vlheader_1)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_1)); tvp1 = (struct vlheader_1 *) toaddr; w = write (fd, tvp1, sizeof(struct vlheader_1)); @@ -600,7 +600,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) } else if (tov == 2 || tov == 3) { tvp1 = (struct vlheader_1 *) fromaddr; tvp2 = (struct vlheader_2 *) toaddr; - bzero(tvp2, sizeof(struct vlheader_2)); + memset(tvp2, 0, sizeof(struct vlheader_2)); tvp2->vital_header.vldbversion = htonl(tov); tvp2->vital_header.headersize = htonl(sizeof(struct vlheader_2)); diff = ntohl(tvp2->vital_header.headersize) - @@ -643,7 +643,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) return EINVAL; } else if (fromv == 2 || fromv == 3 || fromv == 4) { if (tov == 2 || tov == 3 || tov == 4) { - bcopy (fromaddr, toaddr, sizeof(struct vlheader_2)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_2)); tvp2 = (struct vlheader_2 *) toaddr; tvp2->vital_header.vldbversion = htonl(tov); w = write (fd, tvp2, sizeof(struct vlheader_2)); @@ -655,7 +655,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr) } else if (tov == 1) { tvp2 = (struct vlheader_2 *) fromaddr; tvp1 = (struct vlheader_1 *) toaddr; - bzero(tvp1, sizeof(struct vlheader_1)); + memset(tvp1, 0, sizeof(struct vlheader_1)); tvp1->vital_header.vldbversion = htonl(1); tvp1->vital_header.headersize = htonl(sizeof(struct vlheader_1)); diff = ntohl(tvp1->vital_header.headersize) - ntohl(tvp2->vital_header.headersize); @@ -771,7 +771,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) vl.nextIdHash[1] = vlentryp->nextIdHash[1]; vl.nextIdHash[2] = vlentryp->nextIdHash[2]; vl.nextNameHash = vlentryp->nextNameHash; - bcopy(vlentryp->name, vl.name, 65); + memcpy(vl.name, vlentryp->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = vlentryp->serverNumber[i]; vl.serverPartition[i] = vlentryp->serverPartition[i]; @@ -790,7 +790,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) struct vlentry_2 vl; struct vlentry_3 *xnvlentry = (struct vlentry_3 *) vlentryp; - bzero((char *)&vl, sizeof (struct vlentry_2)); + memset((char *)&vl, 0, sizeof (struct vlentry_2)); vl.volumeId[0] = xnvlentry->volumeId[0]; vl.volumeId[1] = xnvlentry->volumeId[1]; vl.volumeId[2] = xnvlentry->volumeId[2]; @@ -804,7 +804,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) } if (ntohl(xnvlentry->nextNameHash)) vl.nextNameHash = xnvlentry->nextNameHash; - bcopy(xnvlentry->name, vl.name, 65); + memcpy(vl.name, xnvlentry->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = xnvlentry->serverNumber[i]; vl.serverPartition[i] = xnvlentry->serverPartition[i]; @@ -822,7 +822,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) diff = (tovers == 1 ? sizeof(struct vlheader_1) : sizeof(struct vlheader_2)) - (fromvers == 1 ? sizeof(struct vlheader_1) : sizeof(struct vlheader_2)); - bzero((char *)&vl, sizeof (struct vlentry_1)); + memset((char *)&vl, 0, sizeof (struct vlentry_1)); vl.volumeId[0] = xnvlentry->volumeId[0]; vl.volumeId[1] = xnvlentry->volumeId[1]; vl.volumeId[2] = xnvlentry->volumeId[2]; @@ -837,7 +837,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) if (ntohl(xnvlentry->nextNameHash)) vl.nextNameHash = htonl(ntohl(xnvlentry->nextNameHash) + diff); - bcopy(xnvlentry->name, vl.name, 65); + memcpy(vl.name, xnvlentry->name, 65); for (i = 0; i < 8; i++) { vl.serverNumber[i] = xnvlentry->serverNumber[i]; vl.serverPartition[i] = xnvlentry->serverPartition[i]; @@ -865,7 +865,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp) * blocks go away and all vlentries after them move up in the vldb file. * When this happens, the linked list pointers need to be updated. */ - bcopy(vlentryp, &vl, sizeof(vl)); + memcpy(&vl, vlentryp, sizeof(vl)); for (i=0; i<3; i++) { vl.nextIdHash[i] = Conv4to3(vl.nextIdHash[i]); } diff --git a/src/vlserver/sascnvldb.c b/src/vlserver/sascnvldb.c index d90c517d4..69292c254 100644 --- a/src/vlserver/sascnvldb.c +++ b/src/vlserver/sascnvldb.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/sascnvldb.c,v 1.1.1.4 2001/07/14 22:24:48 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/sascnvldb.c,v 1.1.1.5 2001/09/11 14:35:37 hartmans Exp $"); #include #include @@ -95,7 +95,7 @@ static char *Parent(apath) char *apath; { register char *tp; strcpy(tspace, apath); - tp = rindex(tspace, '/'); + tp = strrchr(tspace, '/'); if (tp) { *tp = 0; } @@ -335,7 +335,7 @@ struct vlheader_2 *tvp1; struct vlheader_2 *tvp2; int i,j,diff; - bcopy (fromaddr, toaddr, sizeof(struct vlheader_2)); + memcpy(toaddr, fromaddr, sizeof(struct vlheader_2)); tvp2 = (struct vlheader_2 *) toaddr; tvp2->vital_header.vldbversion = htonl(2); diff --git a/src/vlserver/vlclient.c b/src/vlserver/vlclient.c index f3e17923d..94a97f00b 100644 --- a/src/vlserver/vlclient.c +++ b/src/vlserver/vlclient.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlclient.c,v 1.1.1.4 2001/07/14 22:24:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlclient.c,v 1.1.1.5 2001/09/11 14:35:38 hartmans Exp $"); #include #include @@ -243,7 +243,7 @@ char *aname; { } th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); return addr; } @@ -297,9 +297,9 @@ static handleit(as) while (1) { char line[500]; int nargs, releasetype; - bzero(&entry, sizeof(entry)); - bzero(&updateentry, sizeof(updateentry)); - bzero(&listbyattributes, sizeof(listbyattributes)); + memset(&entry, 0, sizeof(entry)); + memset(&updateentry, 0, sizeof(updateentry)); + memset(&listbyattributes, 0, sizeof(listbyattributes)); printf("vl> "); if (fgets(line, 499, stdin) == NULL) { printf("\n"); @@ -346,7 +346,7 @@ static handleit(as) } else if (!strcmp(oper,"ls")) { afs_int32 index, count, next_index; for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -366,7 +366,7 @@ static handleit(as) } printf("Enumerating all entries in vldb...\n"); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -404,7 +404,7 @@ static handleit(as) } printf("Volumes not found in main hash tables in vldb...\n"); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -456,10 +456,10 @@ static handleit(as) exit(1); } printf("Volumes not found in main hash tables in vldb will be fixed...\n"); - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); for (index = 0; 1; index = next_index) { int n1=0, n2=0, n3=0, n4=0; - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -531,7 +531,7 @@ static handleit(as) bulkentries entries; struct vldbentry *entry; - bzero(&entries,sizeof(entries)); + memset(&entries, 0, sizeof(entries)); fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); code = ubik_Call(VL_ListAttributes, cstruct, 0, &listbyattributes, &nentries, &entries); @@ -563,7 +563,7 @@ static handleit(as) for (si=0; si!=-1; si=nsi) { nentries = 0; - bzero(&entries,sizeof(entries)); + memset(&entries, 0, sizeof(entries)); code = ubik_Call(VL_ListAttributesN2, cstruct, 0, &listbyattributes, name, si, &nentries, &entries, &nsi); @@ -586,7 +586,7 @@ static handleit(as) fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); - bzero(&linkedvldbs, sizeof(vldb_list)); + memset(&linkedvldbs, 0, sizeof(vldb_list)); code = ubik_Call(VL_LinkedList, cstruct, 0, &listbyattributes, &netries, &linkedvldbs); if (code) { @@ -606,7 +606,7 @@ static handleit(as) fill_listattributes_entry(&listbyattributes, argp, nargs); display_listattributes_entry(&listbyattributes, 0); - bzero(&linkedvldbs, sizeof(vldb_list)); + memset(&linkedvldbs, 0, sizeof(vldb_list)); code = ubik_Call(VL_LinkedListN, cstruct, 0, &listbyattributes, &netries, &linkedvldbs); if (code) { @@ -632,7 +632,7 @@ static handleit(as) sscanf(&(*argp)[0], "%d", &voltype); code = ubik_Call(VL_GetEntryByID, cstruct, 0, id, voltype, &entry); display_entry(&entry, code); - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); updateentry.Mask = VLUPDATE_VOLNAMEHASH; printf("\tRehashing namehash table for %s (%d)\n", entry.name, entry.volumeId[RWVOL]); code = ubik_Call(VL_UpdateEntry, cstruct, 0, entry.volumeId[RWVOL], -1, &updateentry, 0); @@ -643,7 +643,7 @@ static handleit(as) } else if (!strcmp(oper,"undelete")) { afs_int32 index, count, next_index; - bzero(&updateentry, sizeof(updateentry)); + memset(&updateentry, 0, sizeof(updateentry)); sscanf(&(*argp)[0], "%d", &id); ++argp, --nargs; sscanf(&(*argp)[0], "%d", &voltype); @@ -653,7 +653,7 @@ static handleit(as) } printf("Searching vldb for volume %d...\n", id); for (index = 0; 1; index = next_index) { - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); code = ubik_Call(VL_ListEntry,cstruct,0,index,&count,&next_index,&entry); if (code) { printf("VL_ListEntry returned code = %d\n", code); @@ -873,10 +873,10 @@ static handleit(as) struct vldbentry *entry; afsUUID uuid; - bzero(&uuid,sizeof(uuid)); + memset(&uuid, 0, sizeof(uuid)); sscanf(&(*argp)[0], "%d", &i); ++argp, --nargs; - bcopy(&i, uuid.node, sizeof(i)); + memcpy(uuid.node, &i, sizeof(i)); if (nargs < 0 || nargs > 16) { printf("Illegal # entries = %d\n", nargs); @@ -907,7 +907,7 @@ static handleit(as) printf("cmdebug: can't resolve address for host %s"); continue; } - bcopy((afs_int32 *)h1->h_addr, &a1, sizeof(afs_uint32)); + memcpy(&a1, (afs_int32 *)h1->h_addr, sizeof(afs_uint32)); ++argp, --nargs; printf(" to %s\n", *argp); @@ -916,7 +916,7 @@ static handleit(as) printf("cmdebug: can't resolve address for host %s", *argp); continue; } - bcopy((afs_int32 *)h2->h_addr, &a2, sizeof(afs_uint32)); + memcpy(&a2, (afs_int32 *)h2->h_addr, sizeof(afs_uint32)); printf("changing 0x%x to 0x%x\n", ntohl(a1), ntohl(a2)); code = ubik_Call(VL_ChangeAddr, cstruct, 0, ntohl(a1), ntohl(a2)); diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index 5d76a9058..de9351541 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -24,7 +24,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vldb_check.c,v 1.1.1.4 2001/07/14 22:24:51 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vldb_check.c,v 1.1.1.5 2001/09/11 14:35:38 hartmans Exp $"); #include #include @@ -636,7 +636,7 @@ CheckIpAddrs(header) int ipindex, ipaddrs; afsUUID nulluuid; - bzero(&nulluuid, sizeof(nulluuid)); + memset(&nulluuid, 0, sizeof(nulluuid)); if (verbose) printf("Check Multihomed blocks\n"); @@ -828,8 +828,8 @@ WorkerBee(as, arock) maxentries = (header.vital_header.eofPtr / sizeof(vlentry)) + 1; record = (struct er *)malloc(maxentries * sizeof(struct er)); - bzero((char *)record, (maxentries * sizeof(struct er))); - bzero((char *)serveraddrs, sizeof(serveraddrs)); + memset((char *)record, 0, (maxentries * sizeof(struct er))); + memset((char *)serveraddrs, 0, sizeof(serveraddrs)); /* Will fill in the record array of entries it found */ ReadAllEntries(&header); diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 7c79dd69a..0f4d80a4e 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlprocs.c,v 1.1.1.4 2001/07/14 22:24:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlprocs.c,v 1.1.1.5 2001/09/11 14:35:39 hartmans Exp $"); #include #include @@ -192,7 +192,7 @@ VL_CreateEntry(rxcall, newentry) goto abort; } - bzero(&tentry, sizeof(struct nvlentry)); + memset(&tentry, 0, sizeof(struct nvlentry)); /* Convert to its internal representation; both in host byte order */ if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) { FreeBlock(trans, blockindex); @@ -265,7 +265,7 @@ VL_CreateEntryN(rxcall, newentry) goto abort; } - bzero(&tentry, sizeof(struct nvlentry)); + memset(&tentry, 0, sizeof(struct nvlentry)); /* Convert to its internal representation; both in host byte order */ if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) { FreeBlock(trans, blockindex); @@ -1701,8 +1701,8 @@ vital_vlheader *vital_header; if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)) return errorcode; VLog(5, ("GetStats %\n", rxinfo(rxcall))); - bcopy((char *)&cheader.vital_header, (char *) vital_header, sizeof(vital_vlheader)); - bcopy((char *)&dynamic_statistics, (char *) stats, sizeof(vldstats)); + memcpy((char *) vital_header, (char *)&cheader.vital_header, sizeof(vital_vlheader)); + memcpy((char *) stats, (char *)&dynamic_statistics, sizeof(vldstats)); return(ubik_EndTrans(trans)); } @@ -1724,7 +1724,7 @@ bulkaddrs *addrsp; COUNT_REQ(VLGETADDRS); addrsp->bulkaddrs_len = *nentries = 0; addrsp->bulkaddrs_val = 0; - bzero (spare3, sizeof (struct VLCallBack)); + memset(spare3, 0, sizeof (struct VLCallBack)); if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)) return errorcode; @@ -2579,7 +2579,7 @@ struct vldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < OMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2617,7 +2617,7 @@ struct nvldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < NMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2653,7 +2653,7 @@ struct uvldbentry *VldbEntry; { int i, j; - bzero(VldbEntry, sizeof(struct vldbentry)); + memset(VldbEntry, 0, sizeof(struct vldbentry)); strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name)); for (i=0; i < NMAXNSERVERS; i++) { if (VlEntry->serverNumber[i] == BADSERVERID) break; @@ -2889,7 +2889,7 @@ register afs_uint32 ipaddr1, ipaddr2; /* Change the registered uuuid addresses */ if (exp) { - bzero(&tuuid, sizeof(afsUUID)); + memset(&tuuid, 0, sizeof(afsUUID)); afs_htonuuid(&tuuid); exp->ex_hostuuid = tuuid; code = vlwrite(atrans, DOFFSET(ntohl(ex_addr[0]->ex_contaddrs[base]), diff --git a/src/vlserver/vlserver.c b/src/vlserver/vlserver.c index 5dd7cc488..79944f897 100644 --- a/src/vlserver/vlserver.c +++ b/src/vlserver/vlserver.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlserver.c,v 1.1.1.8 2001/07/14 22:24:52 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlserver.c,v 1.1.1.9 2001/09/11 14:35:40 hartmans Exp $"); #include #include @@ -229,7 +229,7 @@ char **argv; printf("vlserver: couldn't get address of this host (%s).\n", hostname); exit(1); } - bcopy(th->h_addr,&myHost,sizeof(afs_int32)); + memcpy(&myHost, th->h_addr, sizeof(afs_int32)); #if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV) signal(SIGXCPU, CheckSignal_Signal); @@ -244,7 +244,7 @@ char **argv; vldb_confdir = tdir; /* Preserve our configuration dir */ /* rxvab no longer supported */ - bzero(&tkey, sizeof(tkey)); + memset(&tkey, 0, sizeof(tkey)); if (noAuth) afsconf_SetNoAuthFlag(tdir, 1); @@ -267,7 +267,7 @@ char **argv; } rx_SetRxDeadTime(50); - bzero(HostAddress, sizeof(HostAddress)); + memset(HostAddress, 0, sizeof(HostAddress)); initialize_dstats(); sc[0] = rxnull_NewServerSecurityObject(); diff --git a/src/vlserver/vlutils.c b/src/vlserver/vlutils.c index ea6055cec..a0f1b181c 100644 --- a/src/vlserver/vlutils.c +++ b/src/vlserver/vlutils.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlutils.c,v 1.1.1.4 2001/07/14 22:24:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vlserver/vlutils.c,v 1.1.1.5 2001/09/11 14:35:40 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -106,13 +106,13 @@ afs_int32 length; { for (i=0;inextIdHash[i]); nentry.nextNameHash = htonl(nep->nextNameHash); - bcopy(nep->name, nentry.name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, nentry.serverNumber, NMAXNSERVERS); - bcopy(nep->serverPartition, nentry.serverPartition, NMAXNSERVERS); - bcopy(nep->serverFlags, nentry.serverFlags, NMAXNSERVERS); + memcpy(nentry.name, nep->name, VL_MAXNAMELEN); + memcpy(nentry.serverNumber, nep->serverNumber, NMAXNSERVERS); + memcpy(nentry.serverPartition, nep->serverPartition, NMAXNSERVERS); + memcpy(nentry.serverFlags, nep->serverFlags, NMAXNSERVERS); bufp = (char *)&nentry; } else { - bzero(&oentry, sizeof(struct vlentry)); + memset(&oentry, 0, sizeof(struct vlentry)); nep = (struct nvlentry *)buffer; for (i=0;ivolumeId[i]); @@ -123,10 +123,10 @@ afs_int32 length; { for (i=0;inextIdHash[i]); oentry.nextNameHash = htonl(nep->nextNameHash); - bcopy(nep->name, oentry.name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, oentry.serverNumber, OMAXNSERVERS); - bcopy(nep->serverPartition, oentry.serverPartition, OMAXNSERVERS); - bcopy(nep->serverFlags, oentry.serverFlags, OMAXNSERVERS); + memcpy(oentry.name, nep->name, VL_MAXNAMELEN); + memcpy(oentry.serverNumber, nep->serverNumber, OMAXNSERVERS); + memcpy(oentry.serverPartition, nep->serverPartition, OMAXNSERVERS); + memcpy(oentry.serverFlags, nep->serverFlags, OMAXNSERVERS); bufp = (char *)&oentry; } return vlwrite(trans, offset, bufp, length); @@ -158,14 +158,14 @@ afs_int32 length; { for(i=0;inextIdHash[i] = ntohl(nep->nextIdHash[i]); nbufp->nextNameHash = ntohl(nep->nextNameHash); - bcopy(nep->name, nbufp->name, VL_MAXNAMELEN); - bcopy(nep->serverNumber, nbufp->serverNumber, NMAXNSERVERS); - bcopy(nep->serverPartition, nbufp->serverPartition, NMAXNSERVERS); - bcopy(nep->serverFlags, nbufp->serverFlags, NMAXNSERVERS); + memcpy(nbufp->name, nep->name, VL_MAXNAMELEN); + memcpy(nbufp->serverNumber, nep->serverNumber, NMAXNSERVERS); + memcpy(nbufp->serverPartition, nep->serverPartition, NMAXNSERVERS); + memcpy(nbufp->serverFlags, nep->serverFlags, NMAXNSERVERS); } else { oep = (struct vlentry *)bufp; nbufp = (struct nvlentry *)buffer; - bzero(nbufp, sizeof (struct nvlentry)); + memset(nbufp, 0, sizeof (struct nvlentry)); for(i=0;ivolumeId[i] = ntohl(oep->volumeId[i]); nbufp->flags = ntohl(oep->flags); @@ -175,10 +175,10 @@ afs_int32 length; { for(i=0;inextIdHash[i] = ntohl(oep->nextIdHash[i]); nbufp->nextNameHash = ntohl(oep->nextNameHash); - bcopy(oep->name, nbufp->name, VL_MAXNAMELEN); - bcopy(oep->serverNumber, nbufp->serverNumber, NMAXNSERVERS); - bcopy(oep->serverPartition, nbufp->serverPartition, NMAXNSERVERS); - bcopy(oep->serverFlags, nbufp->serverFlags, NMAXNSERVERS); + memcpy(nbufp->name, oep->name, VL_MAXNAMELEN); + memcpy(nbufp->serverNumber, oep->serverNumber, NMAXNSERVERS); + memcpy(nbufp->serverPartition, oep->serverPartition, NMAXNSERVERS); + memcpy(nbufp->serverFlags, oep->serverFlags, NMAXNSERVERS); } return 0; } @@ -303,7 +303,7 @@ afs_int32 CheckInit (trans, builddb) vldbversion = ntohl(cheader.vital_header.vldbversion); if (!ubcode && (vldbversion != 0)) { - bcopy(cheader.IpMappedAddr, HostAddress, sizeof(cheader.IpMappedAddr)); + memcpy(HostAddress, cheader.IpMappedAddr, sizeof(cheader.IpMappedAddr)); for (i=0; iex_flags = htonl(VLCONTBLOCK); @@ -515,7 +515,7 @@ struct nvlentry *tentry; } cheader.vital_header.allocs++; if (write_vital_vlheader(trans)) return 0; - bzero (tentry, sizeof(nvlentry)); /* zero new entry */ + memset(tentry, 0, sizeof(nvlentry)); /* zero new entry */ return blockindex; } @@ -528,7 +528,7 @@ afs_int32 blockindex; /* check validity of blockindex just to be on the safe side */ if (!index_OK (trans, blockindex)) return VL_BADINDEX; - bzero (&tentry, sizeof(nvlentry)); + memset(&tentry, 0, sizeof(nvlentry)); tentry.nextIdHash[0] = cheader.vital_header.freePtr; /* already in network order */ tentry.flags = htonl(VLFREE); cheader.vital_header.freePtr = htonl(blockindex); diff --git a/src/vol/clone.c b/src/vol/clone.c index 59147f479..15975eb85 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -18,7 +18,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/clone.c,v 1.1.1.4 2001/07/14 22:24:54 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/clone.c,v 1.1.1.5 2001/09/11 14:35:41 hartmans Exp $"); #include #include @@ -107,7 +107,7 @@ struct clone_head *ah; { /* initialize a clone header */ int ci_InitHead(struct clone_head *ah) { - bzero(ah, sizeof(*ah)); + memset(ah, 0, sizeof(*ah)); return 0; } diff --git a/src/vol/devname.c b/src/vol/devname.c index 1954a44cb..68c473778 100644 --- a/src/vol/devname.c +++ b/src/vol/devname.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/devname.c,v 1.1.1.5 2001/07/11 03:12:18 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/devname.c,v 1.1.1.6 2001/09/11 14:35:41 hartmans Exp $"); #include #include @@ -201,14 +201,14 @@ dev_t adev; { #endif if (wpath) { strcpy(pbuf, pbuffer); - ptr = (char *)rindex(pbuf, '/'); + ptr = (char *)strrchr(pbuf, '/'); if (ptr) { *ptr = '\0'; strcpy(wpath, pbuf); } else return (char *)0; } - ptr = (char *)rindex(pbuffer, '/'); + ptr = (char *)strrchr(pbuffer, '/'); if (ptr) { strcpy(pbuffer, ptr+1); return pbuffer; diff --git a/src/vol/fs_conv_411.c b/src/vol/fs_conv_411.c index 1d4222d60..9108e0295 100644 --- a/src/vol/fs_conv_411.c +++ b/src/vol/fs_conv_411.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fs_conv_411.c,v 1.1.1.4 2001/07/14 22:24:53 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fs_conv_411.c,v 1.1.1.5 2001/09/11 14:35:41 hartmans Exp $"); #if defined(AFS_DUX40_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_SUN54_ENV) #if defined AFS_DUX40_ENV @@ -930,14 +930,13 @@ char *vol_DevName(adev) return (char *) 0; /* failed */ } -extern char *rindex(); char *unrawname(name) char *name; { char *dp; struct stat stb; - if ((dp = rindex(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == 0) return (name); if (stat(name, &stb) < 0) return (name); @@ -956,7 +955,7 @@ rawname(name) static char rawbuf[32]; char *dp; - if ((dp = rindex(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == 0) return (0); *dp = 0; (void)strcpy(rawbuf, name); diff --git a/src/vol/fssync.c b/src/vol/fssync.c index 844744297..9a79dbb4a 100644 --- a/src/vol/fssync.c +++ b/src/vol/fssync.c @@ -38,7 +38,7 @@ static int newVLDB = 1; #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fssync.c,v 1.1.1.4 2001/07/14 22:24:55 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fssync.c,v 1.1.1.5 2001/09/11 14:35:42 hartmans Exp $"); #include #include @@ -234,7 +234,7 @@ static int getport(addr) { int sd; - bzero(addr, sizeof(*addr)); + memset(addr, 0, sizeof(*addr)); assert((sd = socket(AF_INET, SOCK_STREAM, 0)) >= 0); addr->sin_addr.s_addr = htonl(0x7f000001); addr->sin_family = AF_INET; /* was localhost->h_addrtype */ diff --git a/src/vol/gi.c b/src/vol/gi.c index 7511a23ff..e3a66bb03 100644 --- a/src/vol/gi.c +++ b/src/vol/gi.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/gi.c,v 1.1.1.4 2001/07/14 22:24:56 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/gi.c,v 1.1.1.5 2001/09/11 14:35:42 hartmans Exp $"); #include #include @@ -26,6 +26,12 @@ char **argv; int error=0; struct stat status; int dev, fd, inode; + +#if defined(AFS_NT40_ENV) || defined(AFS_NAMEI_ENV) + fprintf(stderr, "gi not supported on NT or NAMEI systems.\n"); + exit(1); +#else + argc--; argv++; while (argc && **argv == '-') { if (strcmp(*argv, "-stat") == 0) @@ -65,6 +71,7 @@ char **argv; write(1, buf, n); } exit(0); +#endif /* AFS_NT40_ENV || AFS_NAMEI_ENV */ } Perror(err, a1, a2, a3) diff --git a/src/vol/nuke.c b/src/vol/nuke.c index ba7aa73f4..15454c993 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/nuke.c,v 1.1.1.4 2001/07/14 22:24:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/nuke.c,v 1.1.1.5 2001/09/11 14:35:44 hartmans Exp $"); #include #include @@ -77,7 +77,7 @@ afs_int32 avolid; { /* record the info */ if (!allInodes || allInodes->freePtr >= MAXATONCE) { ti = (struct ilist *) malloc(sizeof(struct ilist)); - bzero(ti, sizeof(*ti)); + memset(ti, 0, sizeof(*ti)); ti->next = allInodes; allInodes = ti; } diff --git a/src/vol/physio.c b/src/vol/physio.c index 3789cef38..18868e8d2 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/physio.c,v 1.1.1.4 2001/07/14 22:24:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/physio.c,v 1.1.1.5 2001/09/11 14:35:45 hartmans Exp $"); #include #include @@ -120,7 +120,7 @@ Inode inode; Device device; { static SalvageCacheCheck = 1; - bzero(dir, sizeof(DirHandle)); + memset(dir, 0, sizeof(DirHandle)); dir->dirh_device = device; dir->dirh_volume = volume; @@ -135,14 +135,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/vol/purge.c b/src/vol/purge.c index b63eb753c..25fe927f8 100644 --- a/src/vol/purge.c +++ b/src/vol/purge.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/purge.c,v 1.1.1.4 2001/07/14 22:24:58 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/purge.c,v 1.1.1.5 2001/09/11 14:35:46 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -129,7 +129,7 @@ Volume *avp; { /* next, obliterate the index and fflush (and fsync) it */ STREAM_SEEK(afile, *aoffset, 0); /* seek back to start of vnode index region */ - bzero(buf, sizeof(buf)); /* zero out our proto-vnode */ + memset(buf, 0, sizeof(buf)); /* zero out our proto-vnode */ for(i=0;idiskSize, 1, afile) != 1) goto fail; diff --git a/src/vol/test/listVicepx.c b/src/vol/test/listVicepx.c index ace9b209d..c6b1cc5bb 100644 --- a/src/vol/test/listVicepx.c +++ b/src/vol/test/listVicepx.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/test/listVicepx.c,v 1.1.1.4 2001/07/14 22:25:03 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/test/listVicepx.c,v 1.1.1.5 2001/09/11 14:35:52 hartmans Exp $"); #include #include @@ -124,7 +124,6 @@ char* orphan_NoUnique = "ORPHANED_NoUnique"; #define contentsDInode 0x08 /* list contents of dir inode */ #define volInfo 0x10 /* list info from vol header */ -extern char *rindex(); extern DirEnt *lookup(); extern char *getFileName(), *getDirName(), *printStack(); extern DirEnt* hash[]; diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 27e09398b..7890ae3ac 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vnode.c,v 1.1.1.4 2001/07/14 22:25:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vnode.c,v 1.1.1.5 2001/09/11 14:35:47 hartmans Exp $"); #include #include @@ -382,7 +382,7 @@ Vnode *VAllocVnode_r(ec,vp,type) } else { /* growing file - grow in a reasonable increment */ char *buf = (char *)malloc(16*1024); - bzero(buf, 16*1024); + memset(buf, 0, 16*1024); FDH_WRITE(fdP, buf, 16*1024); free(buf); } @@ -398,7 +398,7 @@ Vnode *VAllocVnode_r(ec,vp,type) #else /* AFS_PTHREAD_ENV */ LWP_CurrentProcess(&vnp->writer); #endif /* AFS_PTHREAD_ENV */ - bzero(&vnp->disk, sizeof(vnp->disk)); + memset(&vnp->disk, 0, sizeof(vnp->disk)); vnp->changed_newTime = 0; /* set this bit when vnode is updated */ vnp->changed_oldTime = 0; /* set this on CopyOnWrite. */ vnp->delete = 0; @@ -698,7 +698,7 @@ VPutVnode_r(ec,vnp) if (vnp->delete) { /* No longer any directory entries for this vnode. Free the Vnode */ - bzero(&vnp->disk, sizeof (vnp->disk)); + memset(&vnp->disk, 0, sizeof (vnp->disk)); mlkLastDelete = vnp->vnodeNumber; /* delete flag turned off further down */ VNLog(202, 2, vnp->vnodeNumber, (afs_int32) vnp); diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 44c9da77c..61af81b3b 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-info.c,v 1.1.1.5 2001/07/14 22:25:02 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-info.c,v 1.1.1.6 2001/09/11 14:35:47 hartmans Exp $"); #include #include @@ -403,7 +403,7 @@ void HandlePart(struct DiskPartition *partP) if (dsizeOnly && !saveinodes) printf("Volume-Id\t Volsize Auxsize Inodesize AVolsize SizeDiff (VolName)\n"); while (dp = readdir(dirp)) { - p = (char *)rindex(dp->d_name, '.'); + p = (char *)strrchr(dp->d_name, '.'); if (p != NULL && strcmp(p, VHDREXT) == 0) { HandleVolume(partP, dp->d_name); Totvolsize += totvolsize; diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 48921a12c..9d38efc09 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -91,7 +91,7 @@ Vnodes with 0 inode pointers in RW volumes are now deleted. #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-salvage.c,v 1.1.1.6 2001/07/14 22:25:01 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-salvage.c,v 1.1.1.7 2001/09/11 14:35:48 hartmans Exp $"); #include #include @@ -923,7 +923,7 @@ void SalvageFileSysParallel(struct DiskPartition *partP) Log("Can't salvage '%s'. Not enough memory\n", partP->name); return; } - bzero(thisjob, sizeof(struct job)); + memset(thisjob, 0, sizeof(struct job)); thisjob->partP = partP; thisjob->jobnumb = jobcount; jobcount++; @@ -2002,7 +2002,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, if (deleteMe) *deleteMe = 0; - bzero(&tempHeader, sizeof(tempHeader)); + memset(&tempHeader, 0, sizeof(tempHeader)); tempHeader.stamp.magic = VOLUMEHEADERMAGIC; tempHeader.stamp.version = VOLUMEHEADERVERSION; tempHeader.id = isp->volumeId; @@ -2083,7 +2083,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, isp->volSummary->header.volumeAcl = 0; isp->volSummary->header.volumeMountTable = 0; - if (bcmp(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader))) { + if (memcmp(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader))) { /* We often remove the name before calling us, so we make a fake one up */ if (isp->volSummary->fileName) { strcpy(name, isp->volSummary->fileName); @@ -2102,7 +2102,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp, } } if (headerFd) { - bcopy(&tempHeader,&isp->volSummary->header,sizeof(struct VolumeHeader)); + memcpy(&isp->volSummary->header, &tempHeader, sizeof(struct VolumeHeader)); if (Testing) { if (!Showmode) Log("It would have written a new header file for volume %u\n", isp->volumeId); } else { @@ -2203,7 +2203,7 @@ int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp, /* The following code should be moved into vutil.c */ if (sp->inodeType == VI_VOLINFO) { struct timeval tp; - bzero(&header.volumeInfo, sizeof (header.volumeInfo)); + memset(&header.volumeInfo, 0, sizeof (header.volumeInfo)); header.volumeInfo.stamp = sp->stamp; header.volumeInfo.id = isp->volumeId; header.volumeInfo.parentId = isp->RWvolumeId; @@ -2334,7 +2334,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, if (VNDISK_GET_INO(vnode) == 0) { if (RW) { /* Log("### DEBUG ### Deleted Vnode with 0 inode (vnode %d)\n", vnodeNumber); */ - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; } } @@ -2342,7 +2342,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, if (vcp->magic != vnode->vnodeMagic) { /* bad magic #, probably partially created vnode */ Log("Partially allocated vnode %d deleted.\n", vnodeNumber); - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; goto vnodeDone; } @@ -2512,7 +2512,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, } else { if (!Showmode) Log("Vnode %d (unique %d): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime((time_t *)&(vnode->serverModifyTime))); } - bzero(vnode, vcp->diskSize); + memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; } else { /* Should not reach here becuase we checked for @@ -2844,7 +2844,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber, assert(fdP != NULL); size = FDH_SIZE(fdP); assert(size != -1); - bzero(buf, 1024); + memset(buf, 0, 1024); if (size > 1024) size = 1024; code = FDH_READ(fdP, buf, size); assert(code == size); @@ -3087,7 +3087,7 @@ void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo, /* Remember rootdir DirSummary _after_ it has been judged */ if (dir.vnodeNumber == 1 && dir.unique == 1) { - bcopy(&dir, rootdir, sizeof(struct DirSummary)); + memcpy(rootdir, &dir, sizeof(struct DirSummary)); *rootdirfound = 1; } @@ -3299,7 +3299,7 @@ int SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t *alinkH) code = IH_DEC(alinkH, VNDISK_GET_INO(&vnode), vid); assert(code == 0); } - bzero(&vnode, sizeof(vnode)); + memset(&vnode, 0, sizeof(vnode)); } } else if (vnp->count) { if (!Showmode) { diff --git a/src/vol/volume.c b/src/vol/volume.c index 8ac243471..80b6df5a1 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -19,7 +19,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/volume.c,v 1.1.1.8 2001/07/14 22:25:02 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/volume.c,v 1.1.1.9 2001/09/11 14:35:50 hartmans Exp $"); #include #include @@ -423,7 +423,7 @@ static void ReadHeader(Error *ec, IHandle_t *h, char *to, int size, void VolumeHeaderToDisk(VolumeDiskHeader_t *dh, VolumeHeader_t *h) { - bzero((char*)dh, sizeof(VolumeDiskHeader_t)); + memset((char*)dh, 0, sizeof(VolumeDiskHeader_t)); dh->stamp = h->stamp; dh->id = h->id; dh->parent = h->parent; @@ -453,7 +453,7 @@ void VolumeHeaderToDisk(VolumeDiskHeader_t *dh, VolumeHeader_t *h) */ void DiskToVolumeHeader(VolumeHeader_t *h, VolumeDiskHeader_t *dh) { - bzero((char*)h, sizeof(VolumeHeader_t)); + memset((char*)h, 0, sizeof(VolumeHeader_t)); h->stamp = dh->stamp; h->id = dh->id; h->parent = dh->parent; @@ -721,7 +721,7 @@ private Volume *attach2(ec, path, header, partp, isbusy) * area and mark it as initialized. */ if (! (V_stat_initialized(vp))) { - bzero((char *)(V_stat_area(vp)), VOL_STATS_BYTES); + memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES); V_stat_initialized(vp) = 1; } #endif /* TRANSARC_VOL_STATS */ @@ -1299,7 +1299,7 @@ int VAllocBitmapEntry_r(ec,vp,index) assert(bp != NULL); index->bitmap = bp; bp += index->bitmapSize; - bzero(bp, VOLUME_BITMAP_GROWSIZE); + memset(bp, 0, VOLUME_BITMAP_GROWSIZE); index->bitmapOffset = index->bitmapSize; index->bitmapSize += VOLUME_BITMAP_GROWSIZE; *bp = 1; @@ -1594,7 +1594,7 @@ VAdjustVolumeStatistics_r(vp) * All we need to do is bzero the entire VOL_STATS_BYTES of * the detailed volume statistics area. */ - bzero((char *)(V_stat_area(vp)), VOL_STATS_BYTES); + memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES); #endif /* TRANSARC_VOL_STATS */ } /*It's been more than a day of collection*/ diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 87e4ba6a7..b3ec9b331 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vutil.c,v 1.1.1.5 2001/07/14 22:25:03 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vutil.c,v 1.1.1.6 2001/09/11 14:35:51 hartmans Exp $"); #include #include @@ -124,7 +124,7 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId) *ec = 0; - bzero(&vol, sizeof (vol)); + memset(&vol, 0, sizeof (vol)); vol.id = volumeId; vol.parentId = parentId; vol.copyDate = time(0); /* The only date which really means when this @@ -145,7 +145,7 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId) nearInode %= partition->f_files; #endif VLockPartition(partname); - bzero(&tempHeader, sizeof (tempHeader)); + memset(&tempHeader, 0, sizeof (tempHeader)); tempHeader.stamp.magic = VOLUMEHEADERMAGIC; tempHeader.stamp.version = VOLUMEHEADERVERSION; tempHeader.id = vol.id; @@ -317,7 +317,7 @@ afs_int32 CopyVolumeHeader_r(from, to) id = to->id; parent = to->parentId; copydate = to->copyDate; - bcopy(from, to, sizeof(*from)); + memcpy(to, from, sizeof(*from)); to->id = id; to->parentId = parent; to->copyDate = copydate; @@ -349,7 +349,7 @@ ClearVolumeStats(vol) ClearVolumeStats_r(vol) register VolumeDiskData *vol; { - bzero(vol->weekUse, sizeof(vol->weekUse)); + memset(vol->weekUse, 0, sizeof(vol->weekUse)); vol->dayUse = 0; vol->dayUseDate = 0; } diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 88f6edff0..89fe49f10 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/dumpstuff.c,v 1.1.1.5 2001/07/14 22:25:07 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/dumpstuff.c,v 1.1.1.6 2001/09/11 14:35:53 hartmans Exp $"); #include #include @@ -205,7 +205,7 @@ static int ReadVolumeHeader(register struct iod *iodp, VolumeDiskData *vol) { register tag; afs_uint32 trash; - bzero(vol, sizeof(*vol)); + memset(vol, 0, sizeof(*vol)); while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) { switch (tag) { case 'i': @@ -488,7 +488,7 @@ static int DumpFile(struct iod *iodp, char tag, int vnode, FdHandle_t *handleP) /* Pad the rest of the buffer with zeros. Remember offset we started * padding. Keep total tally of padding. */ - bzero(p+n, howMany-n); + memset(p+n, 0, howMany-n); if (!pad) offset = (status.st_size - nbytes) + n; pad += (howMany-n); @@ -737,7 +737,7 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep, char buf[SIZEOF_LARGEDISKVNODE], zero[SIZEOF_LARGEDISKVNODE]; register struct VnodeDiskObject *vnode = (struct VnodeDiskObject *) buf; - bzero(zero, sizeof(zero)); /* zero out our proto-vnode */ + memset(zero, 0, sizeof(zero)); /* zero out our proto-vnode */ fdP = IH_OPEN(vp->vnodeIndex[class].handle); if (fdP == NULL) return -1; @@ -782,7 +782,7 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep, if (nVnodes > 0) { Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32)); if (Buf == NULL) return 1; - bzero((char *)Buf, nVnodes * sizeof(afs_int32)); + memset((char *)Buf, 0, nVnodes * sizeof(afs_int32)); STREAM_SEEK(afile, offset = vcp->diskSize, 0); while (1) { code = STREAM_READ(vnode, vcp->diskSize, 1, afile); @@ -916,7 +916,7 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp, V_pref(vp, nearInode); while (tag == D_VNODE) { int haveStuff = 0; - bzero(buf, sizeof (buf)); + memset(buf, 0, sizeof (buf)); if (!ReadInt32(iodp, (afs_uint32 *)&vnodeNumber)) break; diff --git a/src/volser/physio.c b/src/volser/physio.c index 58173ce83..d4c70bcfd 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/physio.c,v 1.1.1.4 2001/07/14 22:25:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/physio.c,v 1.1.1.5 2001/09/11 14:35:54 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -113,7 +113,7 @@ Inode inode; afs_int32 device; { private SalvageCacheCheck = 1; - bzero(dir, sizeof(DirHandle)); + memset(dir, 0, sizeof(DirHandle)); dir->dirh_volume = volume; dir->dirh_device = device; @@ -129,14 +129,14 @@ DirHandle * file; { IH_RELEASE(file->dirh_handle); - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidZero (file) DirHandle * file; { - bzero(file, sizeof(DirHandle)); + memset(file, 0, sizeof(DirHandle)); } FidEq (afile, bfile) diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index 2905ac869..f6f1d9eb6 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -42,7 +42,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/restorevol.c,v 1.1.1.4 2001/07/14 22:25:08 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/restorevol.c,v 1.1.1.5 2001/09/11 14:35:54 hartmans Exp $"); #include #include @@ -146,7 +146,7 @@ afs_int32 ReadDumpHeader(dh) char tag, c; afs_int32 magic; -/* bzero(&dh, sizeof(dh)); */ +/* memset(&dh, 0, sizeof(dh)); */ magic = ntohl(readvalue(4)); dh->version = ntohl(readvalue(4)); @@ -219,7 +219,7 @@ afs_int32 ReadVolumeHeader(count) int code, i, done, entries; char tag, c; -/* bzero(&vh, sizeof(vh)); */ +/* memset(&vh, 0, sizeof(vh)); */ done = 0; while (!done) { @@ -393,7 +393,7 @@ afs_int32 ReadVNode(count) afs_int32 vnode; afs_int32 mode=0; -/* bzero(&vn, sizeof(vn)); */ +/* memset(&vn, 0, sizeof(vn)); */ vn.dataSize = 0; vn.vnode = 0; vn.parent = 0; diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 665273ffe..7e5b7cb1c 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/volprocs.c,v 1.1.1.5 2001/07/14 22:25:09 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/volprocs.c,v 1.1.1.6 2001/09/11 14:35:55 hartmans Exp $"); #include #include @@ -190,7 +190,7 @@ Volume * vp; int code; int length; - bzero(vnode, SIZEOF_LARGEDISKVNODE); + memset(vnode, 0, SIZEOF_LARGEDISKVNODE); V_pref(vp, nearInode); inodeNumber = IH_CREATE(V_linkHandle(vp), V_device(vp), @@ -1146,7 +1146,7 @@ afs_int32 SAFSVolForwardMultiple (acid, fromTrans, fromDate, destinations, int i, nconns, is_incremental; if (results) - bzero(results, sizeof(manyResults)); + memset(results, 0, sizeof(manyResults)); if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS;/*not a super user*/ @@ -1659,7 +1659,7 @@ struct partEntries *pEntries; partList.partId[j++] = i; } pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int)); - bcopy((char *)&partList, (char *)pEntries->partEntries_val, j * sizeof(int)); + memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int)); pEntries->partEntries_len = j; #else code = stat("/",&rbuf); /*interested in buf->st_dev*/ @@ -1680,7 +1680,7 @@ struct partEntries *pEntries; } } pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int)); - bcopy((char *)&partList, (char *)pEntries->partEntries_val, j * sizeof(int)); + memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int)); pEntries->partEntries_len = j; #endif return 0; @@ -2049,9 +2049,7 @@ afs_int32 VolXListOneVolume (a_rxCidP, a_partID, a_volID, a_volumeXInfoP) /* * Copy out the stat fields in a single operation. */ - bcopy((char *)&(volDiskDataP->stat_reads[0]), - (char *)&(xInfoP->stat_reads[0]), - numStatBytes); + memcpy((char *)&(xInfoP->stat_reads[0]), (char *)&(volDiskDataP->stat_reads[0]), numStatBytes); /* * We're done copying. Detach the volume and iterate (at this @@ -2445,9 +2443,7 @@ afs_int32 VolXListVolumes (a_rxCidP, a_partID, a_flags, a_volumeXInfoP) /* * Copy out the stat fields in a single operation. */ - bcopy((char *)&(volDiskDataP->stat_reads[0]), - (char *)&(xInfoP->stat_reads[0]), - numStatBytes); + memcpy((char *)&(xInfoP->stat_reads[0]), (char *)&(volDiskDataP->stat_reads[0]), numStatBytes); /* * We're done copying. Detach the volume and iterate. diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index c070473d5..fbfd72f03 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/voltrans.c,v 1.1.1.4 2001/07/14 22:25:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/voltrans.c,v 1.1.1.5 2001/09/11 14:35:56 hartmans Exp $"); #ifdef AFS_NT40_ENV #include @@ -46,7 +46,7 @@ afs_int32 apart; { } } tt = (struct volser_trans *) malloc(sizeof(struct volser_trans)); - bzero(tt, sizeof(struct volser_trans)); + memset(tt, 0, sizeof(struct volser_trans)); tt->volid = avol; tt->partition = apart; tt->next = allTrans; diff --git a/src/volser/vos.c b/src/volser/vos.c index 9c89ad674..e24a6cdd0 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vos.c,v 1.1.1.5 2001/07/14 22:25:10 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vos.c,v 1.1.1.6 2001/09/11 14:35:57 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -101,7 +101,7 @@ static struct tqHead busyHead, notokHead; static void qInit(ahead) struct tqHead *ahead; { - bzero((char *)ahead, sizeof(struct tqHead)); + memset((char *)ahead, 0, sizeof(struct tqHead)); return; } @@ -216,7 +216,7 @@ char *aname; { } else { th = gethostbyname(aname); if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); } if (addr == htonl(0x7f000001)) { /* local host */ @@ -224,7 +224,7 @@ char *aname; { if (code) return 0; th = gethostbyname(hostname); /* returns host byte order */ if (!th) return 0; - bcopy(th->h_addr, &addr, sizeof(addr)); + memcpy(&addr, th->h_addr, sizeof(addr)); } return (addr); @@ -764,6 +764,97 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, } /*Default listing*/ } /*XDisplayFormat*/ +#ifdef FULL_LISTVOL_SWITCH +static void DisplayFormat2(server, partition, pntr) + long server, partition; + volintInfo *pntr; +{ + static long server_cache = -1, partition_cache = -1; + static char hostname[256], + address[32], + pname[16]; + + if (server != server_cache) { + struct in_addr s; + + s.s_addr = server; + strcpy(hostname, hostutil_GetNameByINet(server)); + strcpy(address, inet_ntoa(s)); + server_cache = server; + } + if (partition != partition_cache) { + MapPartIdIntoName(partition, pname); + partition_cache = partition; + } + fprintf(STDOUT, "name\t\t%s\n", pntr->name); + fprintf(STDOUT, "id\t\t%lu\n", pntr->volid); + fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname); + fprintf(STDOUT, "part\t\t%s\n", pname); + switch (pntr->status) { + case VOK: + fprintf(STDOUT, "status\t\tOK\n"); + break; + case VBUSY: + fprintf(STDOUT, "status\t\tBUSY\n"); + return; + default: + fprintf(STDOUT, "status\t\tUNATTACHABLE\n"); + return; + } + fprintf(STDOUT, "backupID\t%lu\n", pntr->backupID); + fprintf(STDOUT, "parentID\t%lu\n", pntr->parentID); + fprintf(STDOUT, "cloneID\t\t%lu\n", pntr->cloneID); + fprintf(STDOUT, "inUse\t\t%s\n", pntr->inUse ? "Y" : "N"); + fprintf(STDOUT, "needsSalvaged\t%s\n", pntr->needsSalvaged ? "Y" : "N"); + /* 0xD3 is from afs/volume.h since I had trouble including the file */ + fprintf(STDOUT, "destroyMe\t%s\n", pntr->destroyMe == 0xD3 ? "Y" : "N"); + switch (pntr->type) { + case 0: + fprintf(STDOUT, "type\t\tRW\n"); + break; + case 1: + fprintf(STDOUT, "type\t\tRO\n"); + break; + case 2: + fprintf(STDOUT, "type\t\tBK\n"); + break; + default: + fprintf(STDOUT, "type\t\t?\n"); + break; + } + fprintf(STDOUT, "creationDate\t%-9lu\t%s", pntr->creationDate, ctime(&pntr->creationDate)); + fprintf(STDOUT, "accessDate\t%-9lu\t%s", pntr->accessDate, ctime(&pntr->accessDate)); + fprintf(STDOUT, "updateDate\t%-9lu\t%s", pntr->updateDate, ctime(&pntr->updateDate)); + fprintf(STDOUT, "backupDate\t%-9lu\t%s", pntr->backupDate, ctime(&pntr->backupDate)); + fprintf(STDOUT, "copyDate\t%-9lu\t%s", pntr->copyDate, ctime(&pntr->copyDate)); + fprintf(STDOUT, "flags\t\t%#lx\t(Optional)\n", pntr->flags); + fprintf(STDOUT, "diskused\t%u\n", pntr->size); + fprintf(STDOUT, "maxquota\t%u\n", pntr->maxquota); + fprintf(STDOUT, "minquota\t%lu\t(Optional)\n", pntr->spare0); + fprintf(STDOUT, "filecount\t%u\n", pntr->filecount); + fprintf(STDOUT, "dayUse\t\t%u\n", pntr->dayUse); + fprintf(STDOUT, "weekUse\t\t%lu\t(Optional)\n", pntr->spare1); + fprintf(STDOUT, "spare2\t\t%lu\t(Optional)\n", pntr->spare2); + fprintf(STDOUT, "spare3\t\t%lu\t(Optional)\n", pntr->spare3); + return; +} + +static void DisplayVolumes2(server, partition, pntr, count) + volintInfo *pntr; + long server, partition, count; +{ + long i; + + for (i = 0; i < count; i++) { + fprintf(STDOUT, "BEGIN_OF_ENTRY\n"); + DisplayFormat2(server, partition, pntr); + fprintf(STDOUT, "END_OF_ENTRY\n\n"); + pntr++; + } + return; +} +#endif /* FULL_LISTVOL_SWITCH */ + static void DisplayVolumes(server,part,pntr,count,longlist,fast,quiet) afs_int32 server,part; volintInfo *pntr; @@ -1155,6 +1246,12 @@ register struct cmd_syndesc *as; if (wantExtendedInfo) XVolumeStats(xInfoP, &entry, aserver, apart, voltype); else +#ifdef FULL_LISTVOL_SWITCH + if (as->parms[2].items) { + DisplayFormat2(aserver, apart, pntr); + EnumerateEntry(&entry); + } else +#endif /* FULL_LISTVOL_SWITCH */ VolumeStats(pntr, &entry, aserver, apart, voltype); if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) { @@ -2096,7 +2193,7 @@ register struct cmd_syndesc *as; fprintf(STDOUT,"The partitions on the server are:\n"); for(i = 0 ; i < cnt ; i++){ if(dummyPartList.partFlags[i] & PARTVALID){ - bzero(pname,sizeof(pname)); + memset(pname, 0, sizeof(pname)); MapPartIdIntoName(dummyPartList.partId[i],pname); fprintf(STDOUT," %10s ",pname); total++; @@ -2355,6 +2452,12 @@ register struct cmd_syndesc *as; xInfoP = (volintXInfo *)0; } else { +#ifdef FULL_LISTVOL_SWITCH + if (as->parms[6].items) + DisplayVolumes2(aserver, dummyPartList.partId[i], oldpntr, + count); + else +#endif /* FULL_LISTVOL_SWITCH */ DisplayVolumes(aserver, dummyPartList.partId[i], oldpntr, @@ -2377,7 +2480,7 @@ static SyncVldb(as) afs_int32 pname, code; /* part name */ char part[10]; int flags = 0; - char *volname; + char *volname = 0; tserver = 0; if (as->parms[0].items) { @@ -2811,7 +2914,7 @@ register struct cmd_syndesc *as; } /* Zero out search attributes */ - bzero(&attributes,sizeof(struct VldbListByAttributes)); + memset(&attributes, 0, sizeof(struct VldbListByAttributes)); if (as->parms[1].items) { /* -prefix */ strncpy(prefix, as->parms[1].items->data, VOLSER_MAXVOLNAME); @@ -2865,7 +2968,7 @@ register struct cmd_syndesc *as; fflush(STDOUT); /* Get all the VLDB entries on a server and/or partition */ - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); @@ -3041,7 +3144,7 @@ static ListVLDB(as) } for (thisindex = 0; (thisindex != -1); thisindex = nextindex) { - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); centries = 0; nextindex = -1; @@ -3091,8 +3194,7 @@ static ListVLDB(as) tarray = ttarray; /* Copy them in */ - bcopy((char *)arrayEntries.nbulkentries_val, - ((char *)tarray)+tarraysize, parraysize); + memcpy(((char *)tarray)+tarraysize, (char *)arrayEntries.nbulkentries_val, parraysize); tarraysize += parraysize; } } @@ -3144,7 +3246,7 @@ static BackSys(as) char *ccode; int match; - bzero(&attributes,sizeof(struct VldbListByAttributes)); + memset(&attributes, 0, sizeof(struct VldbListByAttributes)); attributes.Mask = 0; seenprefix = (as->parms[0].items ? 1 : 0); @@ -3198,7 +3300,7 @@ static BackSys(as) } } - bzero(&arrayEntries, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */ vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); @@ -3407,7 +3509,7 @@ register struct cmd_syndesc *as; } attributes.flag = VLOP_ALLOPERS; attributes.Mask |= VLLIST_FLAG; - bzero(&arrayEntries, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if(vcode) { fprintf(STDERR,"Could not access the VLDB for attributes\n"); @@ -3825,6 +3927,10 @@ char **argv; { cmd_AddParm(ts, "-quiet", CMD_FLAG, CMD_OPTIONAL, "generate minimal information"); cmd_AddParm(ts, "-extended", CMD_FLAG, CMD_OPTIONAL, "list extended volume fields"); +#ifdef FULL_LISTVOL_SWITCH + cmd_AddParm(ts, "-format", CMD_FLAG, CMD_OPTIONAL, + "machine readable format"); +#endif /* FULL_LISTVOL_SWITCH */ COMMONPARMS; ts = cmd_CreateSyntax("syncvldb", SyncVldb, 0, "synchronize VLDB with server"); @@ -3842,6 +3948,10 @@ char **argv; { cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID"); cmd_AddParm(ts, "-extended", CMD_FLAG, CMD_OPTIONAL, "list extended volume fields"); +#ifdef FULL_LISTVOL_SWITCH + cmd_AddParm(ts, "-format", CMD_FLAG, CMD_OPTIONAL, + "machine readable format"); +#endif /* FULL_LISTVOL_SWITCH */ COMMONPARMS; cmd_CreateAlias (ts, "volinfo"); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 4a666e8dd..2d3cbbb61 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vsprocs.c,v 1.1.1.5 2001/07/14 22:25:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vsprocs.c,v 1.1.1.6 2001/09/11 14:35:57 hartmans Exp $"); #include #include @@ -443,7 +443,7 @@ afs_int32 *anewid; tid = 0; aconn = (struct rx_connection *)0; error = 0; - bzero (&tstatus, sizeof(struct volintInfo)); + memset(&tstatus, 0, sizeof(struct volintInfo)); tstatus.dayUse = -1; tstatus.maxquota = aquota; @@ -1955,8 +1955,8 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) int releasecount = 0; struct volser_status volstatus; - bzero((char *)remembertime, sizeof(remembertime)); - bzero((char *)&results, sizeof(results)); + memset((char *)remembertime, 0, sizeof(remembertime)); + memset((char *)&results, 0, sizeof(results)); vcode = ubik_Call(VL_SetLock, cstruct, 0, afromvol, RWVOL, VLOP_RELEASE); if (vcode != VL_RERELEASE) @@ -2147,7 +2147,7 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) strcpy(vname, entry.name); strcat(vname, ".readonly"); - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); strncpy(cookie.name, vname, VOLSER_OLDMAXVOLNAME); cookie.type = ROVOL; cookie.parent = entry.volumeId[RWVOL]; @@ -2161,10 +2161,10 @@ UV_ReleaseVolume(afromvol, afromserver, afrompart, forceflag) if ( !replicas || !times || !! !results.manyResults_val || !toconns ) ONERROR(ENOMEM, 0, "Failed to create transaction on the release clone\n"); - bzero (replicas, (sizeof(struct replica)*nservers+1)); - bzero (times, (sizeof(struct release)*nservers+1)); - bzero (toconns, (sizeof(struct rx_connection *)*nservers+1)); - bzero (results.manyResults_val, (sizeof(afs_int32)*nservers+1)); + memset(replicas, 0, (sizeof(struct replica)*nservers+1)); + memset(times, 0, (sizeof(struct release)*nservers+1)); + memset(toconns, 0, (sizeof(struct rx_connection *)*nservers+1)); + memset(results.manyResults_val, 0, (sizeof(afs_int32)*nservers+1)); /* Create a transaction on the cloned volume */ code = AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid); @@ -2566,7 +2566,7 @@ UV_RestoreVolume(toserver, topart, tovolid, tovolname, flags, WriteData, rock) char apartName[10]; - bzero(&cookie,sizeof(cookie)); + memset(&cookie, 0, sizeof(cookie)); islocked = 0; success = 0; error = 0; @@ -3525,7 +3525,7 @@ static afs_int32 CheckVolume(volumeinfo, aserver, apart, modentry, maxvolid) ERROR_EXIT(code); } - bzero(&entry, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); vsu_ExtractName(entry.name, volumeinfo->name); /* Store name of RW */ createentry = 1; @@ -4553,7 +4553,7 @@ UV_SyncServer(aserver, apart, flags, force) /* While we need to collect more VLDB entries */ for (si=0; si != -1; si=nsi) { - bzero(&arrayEntries, sizeof(arrayEntries)); + memset(&arrayEntries, 0, sizeof(arrayEntries)); /* Collect set of VLDB entries */ code = VLDB_ListAttributesN2(&attributes, 0, si, diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index bb2628db3..367e5f797 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vsutils.c,v 1.1.1.6 2001/07/14 22:25:11 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/volser/vsutils.c,v 1.1.1.7 2001/09/11 14:35:58 hartmans Exp $"); #include #ifdef AFS_NT40_ENV @@ -57,7 +57,7 @@ static void ovlentry_to_nvlentry(oentryp, nentryp) { register int i; - bzero(nentryp, sizeof(struct nvldbentry)); + memset(nentryp, 0, sizeof(struct nvldbentry)); strncpy(nentryp->name, oentryp->name, sizeof(nentryp->name)); for (i=0; i < oentryp->nServers; i++) { nentryp->serverNumber[i] = oentryp->serverNumber[i]; @@ -77,7 +77,7 @@ static nvlentry_to_ovlentry(nentryp, oentryp) { register int i; - bzero(oentryp, sizeof(struct vldbentry)); + memset(oentryp, 0, sizeof(struct vldbentry)); strncpy(oentryp->name, nentryp->name, sizeof(oentryp->name)); if (nentryp->nServers > OMAXNSERVERS) { /* @@ -218,7 +218,7 @@ VLDB_ListAttributes(attrp, entriesp, blkentriesp) if (newvlserver == 1) { tryold: - bzero(&arrayEntries, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ + memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ code = ubik_Call(VL_ListAttributes, cstruct, 0, attrp, entriesp, &arrayEntries); if (!code) { blkentriesp->nbulkentries_val = (nvldbentry *)malloc(*entriesp * sizeof(struct nvldbentry)); @@ -306,11 +306,11 @@ VLDB_IsSameAddrs(serv1, serv2, errorp) return 0; } - bzero(&attrs, sizeof(attrs)); + memset(&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_IPADDR; attrs.ipaddr = serv1; - bzero(&addrs, sizeof(addrs)); - bzero(&uuid, sizeof(uuid)); + memset(&addrs, 0, sizeof(addrs)); + memset(&uuid, 0, sizeof(uuid)); code = ubik_Call(VL_GetAddrsU, cstruct, 0, &attrs, &uuid, &unique, &nentries, &addrs); if (vlserverv4 == -1) { if (code == RXGEN_OPCODE) { diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c index 48d9d21f0..9b59f9278 100644 --- a/src/xstat/xstat_cm.c +++ b/src/xstat/xstat_cm.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_cm.c,v 1.1.1.4 2001/07/14 22:25:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_cm.c,v 1.1.1.5 2001/09/11 14:36:03 hartmans Exp $"); #include "xstat_cm.h" /*Interface for this module*/ #include /*Lightweight process package*/ @@ -263,8 +263,7 @@ static void xstat_cm_LWP() xstat_cm_Results.collectionNumber = *currCollIDP; xstat_cm_Results.data.AFSCB_CollData_len = AFSCB_MAX_XSTAT_LONGS; - bzero(xstat_cm_Results.data.AFSCB_CollData_val, - AFSCB_MAX_XSTAT_LONGS * 4); + memset(xstat_cm_Results.data.AFSCB_CollData_val, 0, AFSCB_MAX_XSTAT_LONGS * 4); xstat_cm_Results.connP = curr_conn; @@ -474,7 +473,7 @@ int xstat_cm_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, xstat_cm_numCollections = a_numCollections; collIDBytes = xstat_cm_numCollections * sizeof(afs_int32); xstat_cm_collIDP = (afs_int32 *)(malloc(collIDBytes)); - bcopy(a_collIDP, xstat_cm_collIDP, collIDBytes); + memcpy(xstat_cm_collIDP, a_collIDP, collIDBytes); if (xstat_cm_debug) { printf("[%s] Asking for %d collection(s): ", rn, xstat_cm_numCollections); for (curr_srv = 0; curr_srv < xstat_cm_numCollections; curr_srv++) @@ -550,9 +549,7 @@ int xstat_cm_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index 51722f5bc..c483eee2f 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_cm_test.c,v 1.1.1.4 2001/07/14 22:25:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_cm_test.c,v 1.1.1.5 2001/09/11 14:36:04 hartmans Exp $"); #include "xstat_cm.h" /*Interface for xstat_cm module*/ #include /*Command line interpreter*/ @@ -1282,7 +1282,7 @@ int RunTheTest(a_s) rn, curr_item->data); exit(-1); } - bcopy(he->h_addr, &(CMSktArray[currCM].sin_addr.s_addr), 4); + memcpy(&(CMSktArray[currCM].sin_addr.s_addr), he->h_addr, 4); /* * Move to the next CM name. diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c index 1492bd457..1b5438f5d 100644 --- a/src/xstat/xstat_fs.c +++ b/src/xstat/xstat_fs.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs.c,v 1.1.1.4 2001/07/14 22:25:17 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs.c,v 1.1.1.5 2001/09/11 14:36:05 hartmans Exp $"); #include "xstat_fs.h" /*Interface for this module*/ #include /*Lightweight process package*/ @@ -299,8 +299,7 @@ static void xstat_fs_LWP() rn, *currCollIDP); xstat_fs_Results.collectionNumber = *currCollIDP; xstat_fs_Results.data.AFS_CollData_len = AFS_MAX_XSTAT_LONGS; - bzero(xstat_fs_Results.data.AFS_CollData_val, - AFS_MAX_XSTAT_LONGS * 4); + memset(xstat_fs_Results.data.AFS_CollData_val, 0, AFS_MAX_XSTAT_LONGS * 4); xstat_fs_Results.connP = curr_conn; @@ -514,7 +513,7 @@ int xstat_fs_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler xstat_fs_numCollections = a_numCollections; collIDBytes = xstat_fs_numCollections * sizeof(afs_int32); xstat_fs_collIDP = (afs_int32 *)(malloc(collIDBytes)); - bcopy(a_collIDP, xstat_fs_collIDP, collIDBytes); + memcpy(xstat_fs_collIDP, a_collIDP, collIDBytes); if (xstat_fs_debug) { printf("[%s] Asking for %d collection(s): ", rn, xstat_fs_numCollections); for (curr_srv = 0; curr_srv < xstat_fs_numCollections; curr_srv++) @@ -616,9 +615,7 @@ int xstat_fs_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } - bcopy(a_socketArray + curr_srv, - &(curr_conn->skt), - sizeof(struct sockaddr_in)); + memcpy(&(curr_conn->skt), a_socketArray + curr_srv, sizeof(struct sockaddr_in)); hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index 266b8a132..55d830906 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs_test.c,v 1.1.1.4 2001/07/14 22:25:16 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs_test.c,v 1.1.1.5 2001/09/11 14:36:05 hartmans Exp $"); #include "xstat_fs.h" /*Interface for xstat_fs module*/ #include /*Command line interpreter*/ @@ -709,7 +709,7 @@ int RunTheTest(a_s) rn, curr_item->data); exit(-1); } - bcopy(he->h_addr, &(FSSktArray[currFS].sin_addr.s_addr), 4); + memcpy(&(FSSktArray[currFS].sin_addr.s_addr), he->h_addr, 4); /* * Move to the next File Server name. -- 2.39.5