]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Merge to trunk rev 18278
authorSam Hartman <hartmans@mit.edu>
Fri, 30 Jun 2006 02:09:03 +0000 (02:09 +0000)
committerSam Hartman <hartmans@mit.edu>
Fri, 30 Jun 2006 02:09:03 +0000 (02:09 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ldap-integ@18279 dc483132-0cff-0310-8789-dd5450dbe970

257 files changed:
doc/.Sanitize [deleted file]
doc/api/.Sanitize [deleted file]
doc/implement/.Sanitize [deleted file]
doc/kadmin/.Sanitize [deleted file]
doc/krb5-protocol/.Sanitize [deleted file]
doc/old-V4-docs/.Sanitize [deleted file]
src/Makefile.in
src/appl/bsd/krlogin.c
src/appl/bsd/krlogind.c
src/appl/bsd/krsh.c
src/appl/bsd/krshd.c
src/appl/bsd/login.c
src/appl/gssftp/ftp/Makefile.in
src/appl/gssftp/ftp/cmds.c
src/appl/gssftp/ftpd/ftpcmd.y
src/appl/gssftp/ftpd/ftpd.c
src/appl/gssftp/ftpd/ftpd_var.h
src/appl/libpty/Makefile.in
src/appl/libpty/configure.in
src/appl/libpty/update_utmp.c
src/appl/telnet/libtelnet/Makefile.4.4 [deleted file]
src/appl/telnet/libtelnet/Makefile.generic [deleted file]
src/appl/telnet/libtelnet/Makefile.in
src/appl/telnet/libtelnet/kerberos5.c
src/appl/telnet/telnet/Makefile.4.4 [deleted file]
src/appl/telnet/telnet/Makefile.generic [deleted file]
src/appl/telnet/telnet/Makefile.in
src/appl/telnet/telnet/network.c
src/appl/telnet/telnet/telnet.c
src/appl/telnet/telnetd/Makefile.4.4 [deleted file]
src/appl/telnet/telnetd/Makefile.generic [deleted file]
src/appl/telnet/telnetd/Makefile.in
src/appl/telnet/telnetd/state.c
src/config/config.guess
src/config/config.sub
src/config/lib.in
src/config/post.in
src/config/pre.in
src/config/shlib.conf
src/configure.in
src/include/Makefile.in
src/include/k5-int.h
src/include/krb5/krb5.hin
src/kadmin/cli/kadmin.c
src/kadmin/dbutil/dump.c
src/kadmin/dbutil/kdb5_create.c
src/kadmin/dbutil/kdb5_util.c
src/kadmin/dbutil/kdb5_util.h
src/kdc/Makefile.in
src/kdc/kerberos_v4.c
src/kdc/network.c
src/krb5-config.in
src/lib/apputils/Makefile.in
src/lib/ccapi/NTMakefile [new file with mode: 0644]
src/lib/ccapi/client/NTMakefile
src/lib/ccapi/client/cacheapi.c
src/lib/ccapi/client/ccache.c
src/lib/ccapi/client/ccache.h
src/lib/ccapi/client/ccache_iterator.c
src/lib/ccapi/client/ccache_iterator.h
src/lib/ccapi/client/ccapiv2.c [new file with mode: 0644]
src/lib/ccapi/client/ccstring.c
src/lib/ccapi/client/ccstring.h
src/lib/ccapi/client/context.c
src/lib/ccapi/client/context.h
src/lib/ccapi/client/credentials.c
src/lib/ccapi/client/credentials.h
src/lib/ccapi/client/credentials_iterator.c
src/lib/ccapi/client/credentials_iterator.h
src/lib/ccapi/common/NTMakefile [new file with mode: 0644]
src/lib/ccapi/common/generic_lists.c [new file with mode: 0644]
src/lib/ccapi/common/mac/mig.defs [new file with mode: 0755]
src/lib/ccapi/common/mac/mig_types.h [new file with mode: 0644]
src/lib/ccapi/common/marshall.c [new file with mode: 0644]
src/lib/ccapi/common/msg.c [moved from src/lib/ccapi/msg.c with 79% similarity]
src/lib/ccapi/doc/implementation-notes.txt [new file with mode: 0644]
src/lib/ccapi/include/CredentialsCache.h
src/lib/ccapi/include/CredentialsCache2.h
src/lib/ccapi/include/cc_rpc.h [new file with mode: 0644]
src/lib/ccapi/include/datastore.h [moved from src/lib/ccapi/server/datastore.h with 52% similarity]
src/lib/ccapi/include/generic_lists.h [new file with mode: 0644]
src/lib/ccapi/include/marshall.h
src/lib/ccapi/include/msg.h
src/lib/ccapi/include/msg_headers.h
src/lib/ccapi/include/rpc_auth.h [moved from src/lib/ccapi/server/rpc_auth.h with 95% similarity]
src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.pbxuser [new file with mode: 0644]
src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.perspective [new file with mode: 0644]
src/lib/ccapi/mac/CCAPI.xcodeproj/project.pbxproj [new file with mode: 0644]
src/lib/ccapi/marshall.c [deleted file]
src/lib/ccapi/server/NTMakefile
src/lib/ccapi/server/ccs_ccache.c [moved from src/lib/ccapi/server/ccache.c with 83% similarity]
src/lib/ccapi/server/ccs_context.c [moved from src/lib/ccapi/server/context.c with 76% similarity]
src/lib/ccapi/server/ccs_lists.c [moved from src/lib/ccapi/server/lists.c with 56% similarity]
src/lib/ccapi/server/mac/CCacheServer.plist [new file with mode: 0644]
src/lib/ccapi/server/mac/CCacheServerInfo.plist [new file with mode: 0644]
src/lib/ccapi/server/mac/main.c [new file with mode: 0644]
src/lib/ccapi/server/rpc_auth.c
src/lib/ccapi/server/serv_ops.c
src/lib/ccapi/server/serv_ops.h [deleted file]
src/lib/ccapi/unit-test/NTMakefile [new file with mode: 0644]
src/lib/ccapi/unit-test/t_ccache.c
src/lib/ccapi/unit-test/t_context.c
src/lib/ccapi/unit-test/t_server.c
src/lib/ccapi/windows/NTMakefile [new file with mode: 0644]
src/lib/ccapi/windows/cacheapi.def [new file with mode: 0644]
src/lib/ccapi/windows/client.c [new file with mode: 0644]
src/lib/ccapi/windows/dllmain.c [new file with mode: 0644]
src/lib/ccapi/windows/ntccrpc.acf [new file with mode: 0644]
src/lib/ccapi/windows/ntccrpc.idl [new file with mode: 0644]
src/lib/ccapi/windows/rpcsstest/NTMakefile [new file with mode: 0644]
src/lib/ccapi/windows/rpcsstest/client.c [new file with mode: 0644]
src/lib/ccapi/windows/rpcsstest/cstest.acf [new file with mode: 0644]
src/lib/ccapi/windows/rpcsstest/cstest.idl [new file with mode: 0644]
src/lib/ccapi/windows/rpcsstest/server.c [new file with mode: 0644]
src/lib/ccapi/windows/server.c [new file with mode: 0644]
src/lib/crypto/Makefile.in
src/lib/crypto/aes/Makefile.in
src/lib/crypto/arcfour/Makefile.in
src/lib/crypto/crc32/Makefile.in
src/lib/crypto/des/Makefile.in
src/lib/crypto/dk/Makefile.in
src/lib/crypto/enc_provider/Makefile.in
src/lib/crypto/hash_provider/Makefile.in
src/lib/crypto/keyhash_provider/Makefile.in
src/lib/crypto/md4/Makefile.in
src/lib/crypto/md5/Makefile.in
src/lib/crypto/old/Makefile.in
src/lib/crypto/raw/Makefile.in
src/lib/crypto/sha1/Makefile.in
src/lib/crypto/yarrow/Makefile.in
src/lib/des425/Makefile.in
src/lib/gssapi/Makefile.in
src/lib/gssapi/generic/Makefile.in
src/lib/gssapi/gss_libinit.c
src/lib/gssapi/krb5/Makefile.in
src/lib/gssapi/krb5/init_sec_context.c
src/lib/gssapi/krb5/krb5_gss_glue.c
src/lib/gssapi/libgssapi_krb5.exports
src/lib/gssapi/mechglue/Makefile.in
src/lib/gssapi/mechglue/g_indicate_mechs.c [deleted file]
src/lib/gssapi/mechglue/g_initialize.c
src/lib/gssapi/mechglue/g_userok.c [deleted file]
src/lib/gssapi/mechglue/g_utils.c [deleted file]
src/lib/gssapi/mechglue/gen_oids.c [deleted file]
src/lib/gssapi/mechglue/gssd_pname_to_uid.c [deleted file]
src/lib/gssapi/mechglue/mechglue.h
src/lib/gssapi/mechglue/mglueP.h
src/lib/gssapi/spnego/Makefile.in
src/lib/gssapi/spnego/gssapiP_spnego.h
src/lib/gssapi/spnego/spnego_mech.c
src/lib/gssapi32.def
src/lib/kadm5/Makefile.in
src/lib/kadm5/clnt/Makefile.in
src/lib/kadm5/logger.c
src/lib/kadm5/ovsec_glue.c
src/lib/kadm5/srv/Makefile.in
src/lib/kadm5/srv/server_acl.c
src/lib/kadm5/srv/server_misc.c
src/lib/kadm5/unit-test/init-test.c
src/lib/kadm5/unit-test/iter-test.c
src/lib/kadm5/unit-test/lock-test.c
src/lib/kdb/Makefile.in
src/lib/krb4/Makefile.in
src/lib/krb4/kparse.c
src/lib/krb5/Makefile.in
src/lib/krb5/asn.1/Makefile.in
src/lib/krb5/ccache/Makefile.in
src/lib/krb5/ccache/cc_mslsa.c
src/lib/krb5/ccache/ccapi/stdcc.c
src/lib/krb5/ccache/ccapi/stdcc.h
src/lib/krb5/ccache/ccapi/stdcc_util.c
src/lib/krb5/ccache/ccapi/stdcc_util.h
src/lib/krb5/ccache/ccapi/winccld.h
src/lib/krb5/ccache/ccbase.c
src/lib/krb5/error_tables/Makefile.in
src/lib/krb5/keytab/Makefile.in
src/lib/krb5/keytab/ktbase.c
src/lib/krb5/krb/Makefile.in
src/lib/krb5/krb/conv_princ.c
src/lib/krb5/krb/init_ctx.c
src/lib/krb5/krb/kerrs.c
src/lib/krb5/krb/srv_rcache.c
src/lib/krb5/libkrb5.exports
src/lib/krb5/os/Makefile.in
src/lib/krb5/os/hst_realm.c
src/lib/krb5/os/init_os_ctx.c
src/lib/krb5/os/sn2princ.c
src/lib/krb5/posix/Makefile.in
src/lib/krb5/rcache/Makefile.in
src/lib/krb5_32.def
src/lib/rpc/Makefile.in
src/patchlevel.h
src/plugins/kdb/db2/Makefile.in
src/plugins/kdb/db2/libdb2/Makefile.in
src/plugins/kdb/db2/libdb2/btree/Makefile.in
src/plugins/kdb/db2/libdb2/clib/Makefile.in
src/plugins/kdb/db2/libdb2/db/Makefile.in
src/plugins/kdb/db2/libdb2/hash/Makefile.in
src/plugins/kdb/db2/libdb2/mpool/Makefile.in
src/plugins/kdb/db2/libdb2/recno/Makefile.in
src/plugins/locate/python/Makefile.in
src/slave/kpropd.M
src/slave/kpropd.c
src/tests/asn.1/utility.c
src/tests/dejagnu/krb-standalone/gssftp.exp
src/tests/dejagnu/krb-standalone/standalone.exp
src/util/def-check.pl
src/util/et/Makefile.in
src/util/mkrel
src/util/profile/Makefile.in
src/util/profile/prof_init.c
src/util/profile/prof_int.h
src/util/ss/Makefile.in
src/util/support/Makefile.in
src/util/support/errors.c
src/util/support/fake-addrinfo.c
src/util/support/plugins.c
src/windows/identity/apiversion.txt
src/windows/identity/config/Makefile.w2k
src/windows/identity/config/Makefile.w32
src/windows/identity/include/khmsgtypes.h
src/windows/identity/kconfig/api.c
src/windows/identity/kcreddb/credential.c
src/windows/identity/kcreddb/credtype.c
src/windows/identity/kcreddb/type.c
src/windows/identity/nidmgrdll/Makefile
src/windows/identity/plugins/common/krb5common.c
src/windows/identity/plugins/common/krb5common.h
src/windows/identity/plugins/krb4/Makefile
src/windows/identity/plugins/krb4/errorfuncs.c
src/windows/identity/plugins/krb4/krb4funcs.c
src/windows/identity/plugins/krb4/krb4newcreds.c
src/windows/identity/plugins/krb5/Makefile
src/windows/identity/plugins/krb5/datarep.c
src/windows/identity/plugins/krb5/datarep.h
src/windows/identity/plugins/krb5/krb5configcc.c
src/windows/identity/plugins/krb5/krb5configdlg.c
src/windows/identity/plugins/krb5/krb5configid.c
src/windows/identity/plugins/krb5/krb5configids.c
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/krb5identpro.c
src/windows/identity/plugins/krb5/krb5main.c
src/windows/identity/plugins/krb5/krbcred.h
src/windows/identity/plugins/krb5/lang/en_us/langres.rc
src/windows/identity/plugins/krb5/langres.h
src/windows/identity/ui/Makefile
src/windows/identity/ui/credwnd.c
src/windows/identity/ui/debugfuncs.c
src/windows/identity/ui/htwnd.c
src/windows/identity/ui/htwnd.h
src/windows/identity/ui/newcredwnd.c
src/windows/identity/uilib/action.c
src/windows/identity/uilib/alert.c
src/windows/identity/uilib/configui.c
src/windows/identity/uilib/creddlg.c
src/windows/identity/uilib/khnewcred.h
src/windows/identity/util/perfstat.c

diff --git a/doc/.Sanitize b/doc/.Sanitize
deleted file mode 100644 (file)
index 89b4413..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-ChangeLog
-HOW_TO_BUILD
-INCOMPATIBILITY
-Makefile
-OS-notes
-SOURCE-TREE
-TREE-GRAPH
-api
-implement
-install.texi
-install.ps
-kadmin
-krb5-protocol
-old-V4-docs
-texinfo.tex
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
diff --git a/doc/api/.Sanitize b/doc/api/.Sanitize
deleted file mode 100644 (file)
index e778459..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-ChangeLog
-Makefile
-ccache.tex
-changebar.sty
-errors.tex
-fancyheadings.sty
-fixunder.sty
-free.tex
-functions.sty
-intro.tex
-keytab.tex
-krb5.tex
-libdes.tex
-libos.tex
-library.tex
-rcache.tex
-tables.tex
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
diff --git a/doc/implement/.Sanitize b/doc/implement/.Sanitize
deleted file mode 100644 (file)
index 1847a88..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-ChangeLog
-Makefile
-ccache-i.tex
-changebar.sty
-cksum-i.tex
-crc-32-i.tex
-encrypt-i.tex
-fancyheadings.sty
-fixunder.sty
-functions.sty
-implement.tex
-kdb-i.tex
-keytab-i.tex
-libos-i.tex
-rcache-i.tex
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
diff --git a/doc/kadmin/.Sanitize b/doc/kadmin/.Sanitize
deleted file mode 100644 (file)
index 148fae1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-kpasswd.protocol
-kadmin.protocol
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
diff --git a/doc/krb5-protocol/.Sanitize b/doc/krb5-protocol/.Sanitize
deleted file mode 100644 (file)
index d37d1b7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-krb5.constants
-rfc1510.errata
-rfc1510.txt
-3-des.txt
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
diff --git a/doc/old-V4-docs/.Sanitize b/doc/old-V4-docs/.Sanitize
deleted file mode 100644 (file)
index d36248c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Sanitize.in for Kerberos V5
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize".  All keyword lines must exist,
-# and must exist in the order specified by this file.  Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done.  Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this 
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept.  All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called.  Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-README
-installation.PS
-installation.mss
-operation.PS
-operation.mss
-
-Things-to-lose:
-
-Do-last:
-
-# End of file.
index 01c6928d16d44fade594461195a57838270d3285..423cca4c5f5d0ed108cf983ae1f29241ebc41a5a 100644 (file)
@@ -183,6 +183,7 @@ WINMAKEFILES=Makefile \
        lib\des425\Makefile \
        lib\gssapi\Makefile lib\gssapi\generic\Makefile \
        lib\gssapi\krb5\Makefile lib\gssapi\mechglue\Makefile \
+       lib\gssapi\spnego\Makefile \
        lib\krb4\Makefile lib\krb5\Makefile \
        lib\krb5\asn.1\Makefile lib\krb5\ccache\Makefile \
        lib\krb5\ccache\ccapi\Makefile \
@@ -268,6 +269,8 @@ WINMAKEFILES=Makefile \
 ##DOS##        $(WCONFIG) config < $@.in > $@
 ##DOS##lib\gssapi\mechglue\Makefile: lib\gssapi\mechglue\Makefile.in $(MKFDEP)
 ##DOS##        $(WCONFIG) config < $@.in > $@
+##DOS##lib\gssapi\spnego\Makefile: lib\gssapi\spnego\Makefile.in $(MKFDEP)
+##DOS##        $(WCONFIG) config < $@.in > $@
 ##DOS##lib\gssapi\krb5\Makefile: lib\gssapi\krb5\Makefile.in $(MKFDEP)
 ##DOS##        $(WCONFIG) config < $@.in > $@
 ##DOS##lib\krb4\Makefile: lib\krb4\Makefile.in $(MKFDEP)
@@ -366,7 +369,7 @@ FILES= ./* \
        lib/crypto/sha1/* lib/crypto/arcfour/* lib/crypto/md4/* \
        lib/crypto/md5/* lib/crypto/yarrow/* \
        lib/des425/* lib/gssapi/* lib/gssapi/generic/* lib/gssapi/krb5/* \
-       lib/gssapi/mechglue/* lib/krb4/* \
+       lib/gssapi/mechglue/* lib/gssapi/spnego/* lib/krb4/* \
        lib/krb5/* lib/krb5/asn.1/* lib/krb5/krb/* \
        lib/krb5/ccache/* lib/krb5/ccache/ccapi/* \
        lib/krb5/error_tables/* \
@@ -408,7 +411,7 @@ ETOUT =     \
        $(GK)gssapi_err_krb5.h $(GK)gssapi_err_krb5.c \
        lib/krb4/krb_err_txt.c
 
-HOUT = $(INC)krb5.h $(GG)gssapi.h $(PR)profile.h
+HOUT = $(INC)krb5\krb5.h $(GG)gssapi.h $(PR)profile.h
 
 CLEANUP= Makefile $(ETOUT) $(HOUT) \
        include/profile.h include/osconf.h \
@@ -546,10 +549,12 @@ install-windows::
        @if not exist "$(KRB_INSTALL_DIR)\$(NULL)" @echo The directory $(KRB_INSTALL_DIR) does not exist.  Please create it.
        @if not exist "$(KRB_INSTALL_DIR)\$(NULL)" @dir /b $(KRB_INSTALL_DIR)\nul
        @if not exist "$(KRB_INSTALL_DIR)\include\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include"
+       @if not exist "$(KRB_INSTALL_DIR)\include\krb5\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include\krb5"
        @if not exist "$(KRB_INSTALL_DIR)\include\gssapi\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include\gssapi"
        @if not exist "$(KRB_INSTALL_DIR)\lib\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\lib"
        @if not exist "$(KRB_INSTALL_DIR)\bin\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\bin"
        $(CP) include\krb5.h "$(KRB_INSTALL_DIR)\include\."
+       $(CP) include\krb5\krb5.h "$(KRB_INSTALL_DIR)\include\krb5\."
        $(CP) include\win-mac.h "$(KRB_INSTALL_DIR)\include\."
        $(CP) include\profile.h "$(KRB_INSTALL_DIR)\include\."
        $(CP) include\com_err.h "$(KRB_INSTALL_DIR)\include\."
index a1e63a64502bc9ae5fdf9e6b2dcc515e6df1a32b..05913f60750d9e8fbb5039d3360ddb2b35447d46 100644 (file)
@@ -1101,7 +1101,7 @@ static void writer()
     for (;;) {
        FD_ZERO(&waitread);
        FD_SET(0, &waitread);
-       n = select(8*sizeof(waitread), &waitread, 0, 0, 0, 0);
+       n = select(1, &waitread, 0, 0, 0, 0);
        if (n < 0 && errno == EINTR)
          continue;
        if (n > 0)
index 02bed8e370f137d5f3643d1b1d8f49f564975df0..8387f18dbfcd22063fab538dd037b964c1529875 100644 (file)
@@ -1045,7 +1045,7 @@ void protocol(f, p)
            }
        }
 
-       if (select(8*sizeof(ibits), &ibits, &obits, &ebits, 0) < 0) {
+       if (select(((p > f) ? p : f) + 1, &ibits, &obits, &ebits, 0) < 0) {
            if (errno == EINTR)
              continue;
            fatalperror(f, "select");
index 08b68fef11863a70d8e8e4e61a978a57bc8ced0f..155223fab848ec2c5c80605ab3c3aaf07f8ee39f 100644 (file)
@@ -512,7 +512,7 @@ main(argc, argv0)
       rewrite:
        FD_ZERO(&rembits);
        FD_SET(rem, &rembits);
-       if (select(8*sizeof(rembits), 0, &rembits, 0, 0) < 0) {
+       if (select(rem + 1, 0, &rembits, 0, 0) < 0) {
            if (errno != EINTR) {
                perror("select");
                exit(1);
@@ -550,7 +550,7 @@ main(argc, argv0)
     FD_SET(rem, &readfrom);
     do {
        ready = readfrom;
-       if (select(8*sizeof(ready), &ready, 0, 0, 0) < 0) {
+       if (select(((rfd2 > rem) ? rfd2 : rem) + 1, &ready, 0, 0, 0) < 0) {
            if (errno != EINTR) {
                perror("select");
                exit(1);
index 808adf5d538006db9453c842cdd75b88c2f16024..02ab13235438172300284d5ae2759101c084bf2f 100644 (file)
@@ -440,6 +440,22 @@ int main(argc, argv)
        fd = 0;
     }
 
+/*
+ * AIX passes an IPv4-mapped IPv6 address back from getpeername, but if
+ * that address is later used in connect(), it returns an error.  Convert
+ * IPv4-mapped IPv6 addresses to simple IPv4 addresses on AIX (but don't
+ * do this everywhere since it isn't always the right thing to do, just
+ * the least wrong on AIX).
+ */
+#if defined(_AIX) && defined(KRB5_USE_INET6)
+    if (((struct sockaddr*)&from)->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa2sin6(&from)->sin6_addr)) {
+       sa2sin(&from)->sin_len = sizeof(struct sockaddr_in);
+       sa2sin(&from)->sin_family = AF_INET;
+       sa2sin(&from)->sin_port = sa2sin6(&from)->sin6_port;
+       memmove(&(sa2sin(&from)->sin_addr.s_addr), &(sa2sin6(&from)->sin6_addr.u6_addr.u6_addr8[12]), 4);
+    }
+#endif
+
     if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *)&on,
                   sizeof (on)) < 0)
        syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
@@ -1198,6 +1214,7 @@ void doit(f, fromp)
            goto signout_please;
        }
        if (pid) {
+           int maxfd;
 #ifdef POSIX_SIGNALS
            sa.sa_handler = cleanup;
            (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
@@ -1231,11 +1248,18 @@ void doit(f, fromp)
            
            FD_ZERO(&readfrom);
            FD_SET(f, &readfrom);
+           maxfd = f;
            if(port) {
                FD_SET(s, &readfrom);
+               if (s > maxfd)
+                   maxfd = s;
                FD_SET(pv[0], &readfrom);
+               if (pv[0] > maxfd)
+                   maxfd = pv[0];
            }
            FD_SET(pw[0], &readfrom);
+           if (pw[0] > maxfd)
+               maxfd = pw[0];
            
            /* read from f, write to px[1] -- child stdin */
            /* read from s, signal child */
@@ -1244,7 +1268,7 @@ void doit(f, fromp)
 
            do {
                ready = readfrom;
-               if (select(8*sizeof(ready), &ready, (fd_set *)0,
+               if (select(maxfd + 1, &ready, (fd_set *)0,
                           (fd_set *)0, (struct timeval *)0) < 0) {
                    if (errno == EINTR) {
                        continue;
index b49bababb7262f144a7eeeebfbb367c174dc40a9..a3cdef797c4ef7b834e57adf8624398a1818e722 100644 (file)
@@ -786,7 +786,7 @@ static int verify_krb_v4_tgt (realm)
     struct hostent *hp;
     KTEXT_ST ticket;
     AUTH_DAT authdata;
-    unsigned long addr;
+    unsigned KRB4_32 addr;
     static /*const*/ char rcmd_str[] = "rcmd";
 #if 0
     char key[8];
index 5124834699711624a9b7ead642642458a367f377..ded4c95dad5bfce234529518ef2d6d3708b407cf 100644 (file)
@@ -5,7 +5,7 @@ BUILDTOP=$(REL)..$(S)..$(S)..
 #
 # appl/gssftp/ftp/Makefile.in
 #
-DEFINES = -DGSSAPI -DFTP_BUFSIZ=10240
+DEFINES = -DGSSAPI -DFTP_BUFSIZ=65535
 PROG_LIBPATH=-L$(TOPLIBD)
 PROG_RPATH=$(KRB5_LIBDIR)
 
index b9cb2a2a2cb8016daefe9476f558182b95c31ce7..3d851937b9031c27ef518bc16c79911fa9efa5b2 100644 (file)
@@ -725,14 +725,14 @@ void mput(argc, argv)
                        if (mflag && confirm(argv[0], cp)) {
                                tp = cp;
                                if (mcase) {
-                                       while (*tp && !islower((int) (*tp))) {
+                                       while (*tp && !islower((unsigned char) (*tp))) {
                                                tp++;
                                        }
                                        if (!*tp) {
                                                tp = cp;
                                                tp2 = tmpbuf;
                                                while ((*tp2 = *tp) != 0) {
-                                                    if (isupper((int) *tp2)) {
+                                                    if (isupper((unsigned char) *tp2)) {
                                                        *tp2 = 'a' + *tp2 - 'A';
                                                     }
                                                     tp++;
@@ -864,14 +864,14 @@ usage:
        if (loc && mcase) {
                char *tp = argv[1], *tp2, tmpbuf[MAXPATHLEN];
 
-               while (*tp && !islower((int) *tp)) {
+               while (*tp && !islower((unsigned char) *tp)) {
                        tp++;
                }
                if (!*tp) {
                        tp = argv[2];
                        tp2 = tmpbuf;
                        while ((*tp2 = *tp) != 0) {
-                               if (isupper((int) *tp2)) {
+                               if (isupper((unsigned char) *tp2)) {
                                        *tp2 = 'a' + *tp2 - 'A';
                                }
                                tp++;
@@ -994,14 +994,14 @@ void mget(argc, argv)
                if (mflag && confirm(argv[0], cp)) {
                        tp = cp;
                        if (mcase) {
-                               while (*tp && !islower((int) *tp)) {
+                               while (*tp && !islower((unsigned char) *tp)) {
                                        tp++;
                                }
                                if (!*tp) {
                                        tp = cp;
                                        tp2 = tmpbuf;
                                        while ((*tp2 = *tp) != 0) {
-                                               if (isupper((int) *tp2)) {
+                                               if (isupper((unsigned char) *tp2)) {
                                                        *tp2 = 'a' + *tp2 - 'A';
                                                }
                                                tp++;
index 096014bd22e66a865a5df978dc3bd23d25b35709..30bced06a80e4e3875a6ef9bfef9ffebd0685fe8 100644 (file)
@@ -971,7 +971,7 @@ urgsafe_getc(f)
  * getline - a hacked up version of fgets to ignore TELNET escape codes.
  */
 char *
-getline(s, n, iop)
+ftpd_getline(s, n, iop)
        char *s;
        int n;
        register FILE *iop;
@@ -1213,7 +1213,7 @@ yylex()
                case CMD:
                        (void) signal(SIGALRM, toolong);
                        (void) alarm((unsigned) timeout);
-                       if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) {
+                       if (ftpd_getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) {
                                reply(221, "You could at least say goodbye.");
                                dologout(0);
                        }
index 6655e0d62a7bbdc6812a86535b5b2a72129a489c..71744a57f8b13b5f0c25960a0d5ad08826294fd5 100644 (file)
@@ -176,7 +176,6 @@ extern      char version[];
 extern char *home;             /* pointer to home directory for glob */
 extern FILE *ftpd_popen(), *fopen(), *freopen();
 extern int  ftpd_pclose(), fclose();
-extern char *getline();
 extern char cbuf[];
 extern off_t restart_point;
 
@@ -2139,7 +2138,7 @@ myoob(sig)
        if (!transflag)
                return;
        cp = tmpline;
-       if (getline(cp, sizeof(tmpline), stdin) == NULL) {
+       if (ftpd_getline(cp, sizeof(tmpline), stdin) == NULL) {
                reply(221, "You could at least say goodbye.");
                dologout(0);
        }
index 07fb14a637aae4c8a455070a072ebda1e7326787..8d833e4ec9d136dfcad58ace0f29e7eaf08ed10d 100644 (file)
@@ -89,7 +89,7 @@ extern void lreply(int, char *, ...)
 
 /* ftpcmd.y */
 void upper(char *);
-char *getline(char *, int, FILE *);
+char *ftpd_getline(char *, int, FILE *);
 #endif /* FTPD_VAR_H__ */
 
 /* popen.c */
index 3c3ca3828df1a98fa02f64e2322229fc0a2625c5..2e8c8dad7f72e59dcfae40e1781c1607b9a4449b 100644 (file)
@@ -107,8 +107,8 @@ $(BUILDTOP)/include/autoconf.h: $(SRCTOP)/include/autoconf.h.in
        (cd $(BUILDTOP)/include; $(MAKE) autoconf.h)
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index f8930d0e2702f69a39abf20f025a8de9aa5ccde5..cb5fe7e71830ca8d52ba9fffa450200d9cd19ff0 100644 (file)
@@ -63,7 +63,7 @@ AC_CHECK_HEADER(sys/ptyvar.h, [], [],
 #
 
 AC_CHECK_HEADERS(utmp.h utmpx.h)
-AC_CHECK_FUNCS(setutent setutxent updwtmp updwtmpx logwtmp getutmp getutmpx)
+AC_CHECK_FUNCS(setutent setutxent setutsent updwtmp updwtmpx logwtmp getutmp getutmpx)
 AC_CHECK_FUNCS(utmpname utmpxname)
 
 AC_DEFUN(K5_CHECK_UT_MEMBER,
index 004582650a64da33354c116a558657f3802bef5b..d2de6428f6be7c1c6ca927b304e5b63f80452cfe 100644 (file)
  *
  * There is no wtmpx file, despite there being utmp and utmpx files.
  *
+ * HP-UX 11.23:
+ *
+ * In addition to other HP-UX issues, 11.23 includes yet another utmp
+ * management interface in utmps.h.  This interface updates a umtpd
+ * daemon which then manages local files.  Directly accessing the files
+ * through the existing, yet deprecated, utmp.h interface results in 
+ * nothing.
+ *
  * Irix 6.x:
  *
  * In utmpx, ut_exit contains __e_termination and __e_exit, which get
 /*
  * The following grossness exists to avoid duplicating lots of code
  * between the cases where we have an old-style sysV utmp and where we
- * have a modern (Unix98 or XPG4) utmpx.  See the above history rant
- * for further explanation.
+ * have a modern (Unix98 or XPG4) utmpx, or the new (hp-ux 11.23) utmps.  
+ * See the above history rant for further explanation.
  */
-#if defined(HAVE_SETUTXENT) || defined(HAVE_SETUTENT)
+#if defined(HAVE_SETUTXENT) || defined(HAVE_SETUTENT) || defined(HAVE_SETUTSENT)
+#ifdef HAVE_SETUTSENT
+#include <utmps.h>
+#define PTY_STRUCT_UTMPX struct utmps
+#define PTY_SETUTXENT setutsent
+#define PTY_GETUTXENT GETUTSENT
+#define PTY_GETUTXLINE GETUTSLINE
+#define PTY_PUTUTXLINE PUTUTSLINE
+#define PTY_ENDUTXENT endutsent
+#else
 #ifdef HAVE_SETUTXENT
 #define PTY_STRUCT_UTMPX struct utmpx
 #define PTY_SETUTXENT setutxent
 #define PTY_PUTUTXLINE pututline
 #define PTY_ENDUTXENT endutent
 #endif
-
+#endif
 static int better(const PTY_STRUCT_UTMPX *, const PTY_STRUCT_UTMPX *,
                  const PTY_STRUCT_UTMPX *);
 static int match_pid(const PTY_STRUCT_UTMPX *,
diff --git a/src/appl/telnet/libtelnet/Makefile.4.4 b/src/appl/telnet/libtelnet/Makefile.4.4
deleted file mode 100644 (file)
index 495dd73..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#      @(#)Makefile    8.2 (Berkeley) 12/15/93
-
-LIB=   telnet
-SRCS=  auth.c encrypt.c genget.c getent.c misc.c
-SRCS+= kerberos.c enc_des.c
-#SRCS+=        kerberos5.c
-CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DHAS_CGETENT
-CFLAGS+= -DKRB4 -DDES_ENCRYPTION -I/usr/include/kerberosIV
-
-# These are the sources that have encryption stuff in them.
-CRYPT_SRC= auth.c enc-proto.h enc_des.c encrypt.c
-CRYPT_SRC+= encrypt.h kerberos.c kerberos5.c krb4encpwd.c
-CRYPT_SRC+= misc.c spx.c Makefile
-NOCRYPT_DIR=${.CURDIR}/Nocrypt
-
-.include <bsd.lib.mk>
-
-nocrypt:
-#ifdef ENCRYPTION
-       @for i in ${CRYPT_SRC}; do \
-           if [ ! -d ${NOCRYPT_DIR} ]; then \
-               echo Creating subdirectory ${NOCRYPT_DIR}; \
-               mkdir ${NOCRYPT_DIR}; \
-           fi; \
-           echo ${NOCRYPT_DIR}/$$i; \
-           unifdef -UENCRYPTION ${.CURDIR}/$$i | \
-               sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \
-       done
-
-placeholder:
-#else  /* ENCRYPTION */
-       @echo "Encryption code already removed."
-#endif /* ENCRYPTION */
diff --git a/src/appl/telnet/libtelnet/Makefile.generic b/src/appl/telnet/libtelnet/Makefile.generic
deleted file mode 100644 (file)
index 760417f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Copyright (c) 1991 The Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms are permitted provided
-# that: (1) source distributions retain this entire copyright notice and
-# comment, and (2) distributions including binaries display the following
-# acknowledgement:  ``This product includes software developed by the
-# University of California, Berkeley and its contributors'' in the
-# documentation or other materials provided with the distribution and in
-# all advertising materials mentioning features or use of this software.
-# Neither the name of the University nor the names of its contributors may
-# be used to endorse or promote products derived from this software without
-# specific prior written permission.
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-#      @(#)Makefile.generic    5.5 (Berkeley) 3/1/91
-#
-
-LIB=    libtelnet.a
-SRCS=   auth.c encrypt.c genget.c \
-       misc.c kerberos.c kerberos5.c forward.c spx.c enc_des.c \
-       rsaencpwd.c krb4encpwd.c read_password.c \
-       setenv.c getent.c strdup.c strcasecmp.c \
-       strchr.c strrchr.c strftime.c strerror.c \
-       ${LIB_SRC}
-
-OBJS=   auth.o encrypt.o genget.o \
-       misc.o kerberos.o kerberos5.o forward.o spx.o enc_des.o \
-       rsaencpwd.o krb4encpwd.o read_password.o \
-       ${LIB_OBJ}
-
-TELNET_H= ../arpa/telnet.h
-
-CFLAGS= ${LCCFLAGS} ${DEFINES} ${INCLUDES}
-
-${LIB}: ${OBJS}
-       rm -f ${LIB}
-       ${AR} ${ARFLAGS} ${LIB} `lorder ${OBJS} | tsort`
-       @if [ ${RANLIB} != NONE ]; \
-               then echo ${RANLIB} ${LIB}; ${RANLIB} ${LIB}; fi
-
-clean cleandir:
-       rm -f *.o ${LIB} core a.out
-
-auth.o: ${TELNET_H}
-auth.o: encrypt.h
-auth.o: auth.h
-auth.o: misc-proto.h
-encrypt.o: ${TELNET_H}
-encrypt.o: encrypt.h
-encrypt.o: misc.h
-kerberos.o: ${TELNET_H}
-kerberos.o: encrypt.h
-kerberos.o: auth.h
-kerberos.o: misc.h
-kerberos5.o: ${TELNET_H}
-kerberos5.o: encrypt.h
-kerberos5.o: auth.h
-kerberos5.o: misc.h
-misc.o: misc.h
-enc_des.o: ${TELNET_H}
-enc_des.o: encrypt.h
-enc_des.o: key-proto.h
-enc_des.o: misc-proto.h
index aec819d7323c9f7c055e9ed75274a2bdc40d0b90..2a6c7dc51771a5d0f10970c64f819f59984d1464 100644 (file)
@@ -26,7 +26,7 @@ BUILDTOP=$(REL)..$(S)..$(S)..
 AUTH_DEF=-DAUTHENTICATION -DENCRYPTION -DDES_ENCRYPTION -DKRB5 -DFORWARD \
        -UNO_LOGIN_F -DLOGIN_CAP_F -DLOGIN_PROGRAM=KRB5_PATH_LOGIN
 LOCALINCLUDES=-I.. -I$(srcdir)/.. @KRB4_INCLUDES@
-DEFINES = $(AUTH_DEF)
+DEFINES = -DTELNET_BUFSIZE=65535 $(AUTH_DEF)
 LIBOBJS=@LIBOBJS@
 
 SETENVSRC=@SETENVSRC@
@@ -89,8 +89,8 @@ enc_des.o: key-proto.h
 enc_des.o: misc-proto.h
 install::
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index ad36aedda24a8658f2469cfdedf3ffbbd593f02b..ab8e04d3c47c62a8563052e3c0e2e9ee73ed4846 100644 (file)
@@ -99,7 +99,7 @@ static void kerberos5_forward(Authenticator *);
 
 #endif /* FORWARD */
 
-static unsigned char str_data[8192] = {IAC, SB, TELOPT_AUTHENTICATION, 0,
+static unsigned char str_data[TELNET_BUFSIZE] = {IAC, SB, TELOPT_AUTHENTICATION, 0,
                                        AUTHTYPE_KERBEROS_V5, };
 /*static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
                                        TELQUAL_NAME, };*/
diff --git a/src/appl/telnet/telnet/Makefile.4.4 b/src/appl/telnet/telnet/Makefile.4.4
deleted file mode 100644 (file)
index 2e38a28..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Copyright (c) 1990 The Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-#    must display the following acknowledgement:
-#      This product includes software developed by the University of
-#      California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#      @(#)Makefile    8.1 (Berkeley) 6/6/93
-#
-
-PROG=  telnet
-
-CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DAUTHENTICATION -DENCRYPTION
-CFLAGS+=-DENV_HACK
-CFLAGS+=-I${.CURDIR}/../../lib
-
-CFLAGS+= -DKRB4
-
-LDADD= -ltermcap -ltelnet
-LDADD+=        -lkrb -ldes
-DPADD= ${LIBTERMCAP}
-
-SRCS=  authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
-       terminal.c tn3270.c utilities.c
-
-# These are the sources that have encryption stuff in them.
-CRYPT_SRC= authenc.c commands.c externs.h main.c network.c
-CRYPT_SRC+= ring.c ring.h telnet.c terminal.c utilities.c Makefile
-NOCRYPT_DIR=${.CURDIR}/Nocrypt
-
-.include <bsd.prog.mk>
-
-nocrypt:
-#ifdef ENCRYPTION
-       @for i in ${CRYPT_SRC}; do \
-           if [ ! -d ${NOCRYPT_DIR} ]; then \
-               echo Creating subdirectory ${NOCRYPT_DIR}; \
-               mkdir ${NOCRYPT_DIR}; \
-           fi; \
-           echo ${NOCRYPT_DIR}/$$i; \
-           unifdef -UENCRYPTION ${.CURDIR}/$$i | \
-               sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \
-       done
-
-placeholder:
-#else  /* ENCRYPTION */
-       @echo "Encryption code already removed."
-#endif /* ENCRYPTION */
diff --git a/src/appl/telnet/telnet/Makefile.generic b/src/appl/telnet/telnet/Makefile.generic
deleted file mode 100644 (file)
index 5b6ea26..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Copyright (c) 1991 The Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms are permitted provided
-# that: (1) source distributions retain this entire copyright notice and
-# comment, and (2) distributions including binaries display the following
-# acknowledgement:  ``This product includes software developed by the
-# University of California, Berkeley and its contributors'' in the
-# documentation or other materials provided with the distribution and in
-# all advertising materials mentioning features or use of this software.
-# Neither the name of the University nor the names of its contributors may
-# be used to endorse or promote products derived from this software without
-# specific prior written permission.
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-#      @(#)Makefile.generic    5.5 (Berkeley) 3/1/91
-#
-
-INCLUDES= -I..
-ARPA_TELNET= ../arpa/telnet.h
-
-SRCS=  commands.c main.c network.c ring.c \
-       sys_bsd.c telnet.c terminal.c \
-       utilities.c ${GETOPT_SRC}
-
-CFLAGS=        ${LCCFLAGS} ${INCLUDES} ${DEFINES}
-
-ALLHC= ${SRCS} \
-       defines.h externs.h fdset.h general.h \
-       ring.h types.h
-
-OBJS=  authenc.o commands.o main.o network.o ring.o sys_bsd.o \
-       telnet.o terminal.o utilities.o ${GETOPT_OBJ}
-MAN=   telnet.0
-
-#
-# These next three lines are not needed in 4.4BSD
-#
-.SUFFIXES: .0 .1
-.1.0:
-       nroff -man -h $< > $@
-
-all: telnet
-
-telnet:        ${OBJS} ${LIBPATH}
-       ${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS}
-
-clean: FRC
-       rm -f ${OBJS} core errs l.errs telnet
-
-cleandir: clean
-       rm -f ${MAN} tags .depend
-
-clist: FRC ${SRCS}
-       @for i in ${SRCS} ; \
-               do (echo ${DIRPATH}$$i); done
-
-hclist:        FRC ${ALLHC}
-       @for i in ${ALLHC} ; \
-               do (echo ${DIRPATH}$$i); done
-
-depend: FRC ${SRCS}
-       mkdep ${CFLAGS} `make clist`
-
-install: ${MAN} FRC
-       install -s -o bin -g bin -m 755 telnet ${DEST}
-       install -c -o bin -g bin -m 444 telnet.0 ${DESTDIR}/usr/man/cat1
-
-lint: FRC ${SRCS}
-       lint ${CFLAGS} `make clist`
-
-tags: FRC ${SRCS}
-       ctags `make hclist`
-
-FRC:
-
-authenc.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET}
-commands.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET}
-main.o: defines.h externs.h ring.h
-network.o: defines.h externs.h fdset.h ring.h ${ARPA_TELNET}
-ring.o: general.h ring.h
-sys_bsd.o: defines.h externs.h fdset.h ring.h types.h ${ARPA_TELNET}
-telnet.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET}
-terminal.o: externs.h ring.h types.h ${ARPA_TELNET}
-tn3270.o: defines.h externs.h fdset.h general.h ring.h ${ARPA_TELNET}
-utilities.o: defines.h externs.h fdset.h general.h ring.h ${ARPA_TELNET}
index 5e7b6c028d92bdf068924ad95322aba45ba256ca..42a0578999b016fbf66ccb1841b75a49cbcab8eb 100644 (file)
@@ -27,7 +27,7 @@ BUILDTOP=$(REL)..$(S)..$(S)..
 AUTH_DEF=-DAUTHENTICATION -DENCRYPTION -DKRB5 -DFORWARD -UNO_LOGIN_F -DLOGIN_CAP_F -DLOGIN_PROGRAM=KRB5_PATH_LOGIN
 OTHERDEFS=-DLINEMODE -DKLUDGELINEMODE -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON
 LOCALINCLUDES=-I.. -I$(srcdir)/..
-DEFINES = $(AUTH_DEF) $(OTHERDEFS)
+DEFINES = -DTELNET_BUFSIZE=65535 $(AUTH_DEF) $(OTHERDEFS)
 ARPA_TELNET= $(srcdir)/../arpa/telnet.h
 
 PROG_LIBPATH=-L$(TOPLIBD)
index 1282bdb7eee57ae215b46c8c8f7d5239dd3dc91f..60dc3bdcf6221f0cc12cfba8ecbb0995873f48ce 100644 (file)
@@ -52,7 +52,7 @@
 #include "fdset.h"
 
 Ring           netoring, netiring;
-unsigned char  netobuf[2*BUFSIZ], netibuf[BUFSIZ];
+unsigned char  netobuf[2*TELNET_BUFSIZE], netibuf[TELNET_BUFSIZE];
 
 /*
  * Initialize internal network data structures.
index 6215fc1e9bd26dce1c4a4952af656024050d2351..a44df7ab53e0a1dbefbc1cfdc30d51e1206cb204 100644 (file)
@@ -717,8 +717,8 @@ mklist(buf, name)
                 */
                if ((c == ' ') || !isascii(c))
                        n = 1;
-               else if (islower((int) c))
-                       *cp = toupper((int) c);
+               else if (islower((unsigned char) c))
+                       *cp = toupper((unsigned char) c);
        }
        
        /*
diff --git a/src/appl/telnet/telnetd/Makefile.4.4 b/src/appl/telnet/telnetd/Makefile.4.4
deleted file mode 100644 (file)
index 4b1d530..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#      @(#)Makefile    8.2 (Berkeley) 12/15/93
-
-PROG=  telnetd
-CFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS
-CFLAGS+=-DOLD_ENVIRON -DENV_HACK
-CFLAGS+=-DAUTHENTICATION -DENCRYPTION -I${.CURDIR}/../../lib
-SRCS=  authenc.c global.c slc.c state.c sys_term.c telnetd.c \
-       termstat.c utility.c
-DPADD= ${LIBUTIL} ${LIBTERM}
-LDADD= -lutil -ltermcap -ltelnet
-LDADD+=        -lkrb -ldes
-MAN8=  telnetd.0
-
-# These are the sources that have encryption stuff in them.
-CRYPT_SRC= authenc.c ext.h state.c telnetd.c termstat.c
-CRYPT_SRC+= utility.c Makefile
-NOCRYPT_DIR=${.CURDIR}/Nocrypt
-
-.include <bsd.prog.mk>
-
-nocrypt:
-#ifdef ENCRYPTION
-       @for i in ${CRYPT_SRC}; do \
-           if [ ! -d ${NOCRYPT_DIR} ]; then \
-               echo Creating subdirectory ${NOCRYPT_DIR}; \
-               mkdir ${NOCRYPT_DIR}; \
-           fi; \
-           echo ${NOCRYPT_DIR}/$$i; \
-           unifdef -UENCRYPTION ${.CURDIR}/$$i | \
-               sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \
-       done
-
-placeholder:
-#else  /* ENCRYPTION */
-       @echo "Encryption code already removed."
-#endif /* ENCRYPTION */
diff --git a/src/appl/telnet/telnetd/Makefile.generic b/src/appl/telnet/telnetd/Makefile.generic
deleted file mode 100644 (file)
index 8920429..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 1991 The Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms are permitted provided
-# that: (1) source distributions retain this entire copyright notice and
-# comment, and (2) distributions including binaries display the following
-# acknowledgement:  ``This product includes software developed by the
-# University of California, Berkeley and its contributors'' in the
-# documentation or other materials provided with the distribution and in
-# all advertising materials mentioning features or use of this software.
-# Neither the name of the University nor the names of its contributors may
-# be used to endorse or promote products derived from this software without
-# specific prior written permission.
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-#      @(#)Makefile.generic    5.5 (Berkeley) 3/1/91
-#
-
-SRC1=  telnetd.c state.c termstat.c slc.c sys_term.c utility.c global.c authenc.c
-OBJ1=  telnetd.o state.o termstat.o slc.o sys_term.o utility.o global.o authenc.o
-
-OBJS=  ${OBJ1} ${GETTYOBJ}
-SRCS=  ${SRC1} ${GETTYSRC}
-
-MAN=   telnetd.0
-CFLAGS=        ${LCCFLAGS} ${INCLUDES} ${DEFINES}
-ARPA_TELNET = ../arpa/telnet.h
-
-#
-# These next three lines are not needed in 4.4BSD
-#
-.SUFFIXES: .0 .8
-.8.0:
-       nroff -man -h $< > $@
-
-
-all: telnetd
-
-telnetd: ${OBJS} ${LIBPATH}
-       ${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS}
-
-clean:
-       rm -f ${OBJS} core telnetd
-
-cleandir: clean
-       rm -f ${MAN} tags .depend
-
-depend: ${SRCS}
-       mkdep ${CFLAGS} ${SRCS}
-
-install: ${MAN}
-       install -s -o bin -g bin -m 755 telnetd ${LIBEXEC}
-       install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat8
-
-lint: ${SRCS}
-       lint ${CFLAGS} ${SRCS}
-
-tags: ${SRCS}
-       ctags ${SRCS}
-
-authenc.o: telnetd.h
-global.o: defs.h ext.h ${ARPA_TELNET}
-slc.o: telnetd.h defs.h ext.h ${ARPA_TELNET}
-state.o: telnetd.h defs.h ext.h ${ARPA_TELNET}
-sys_term.o: telnetd.h pathnames.h defs.h ext.h ${ARPA_TELNET}
-telnetd.o: telnetd.h defs.h ext.h ${ARPA_TELNET}
-termstat.o: telnetd.h defs.h ext.h ${ARPA_TELNET}
-utility.o: telnetd.h defs.h ext.h ${ARPA_TELNET}
index c1368629bd799582958677202d0b29b43829c040..0b19dd3698e4e16d5544d099f94accc3d881c54a 100644 (file)
@@ -27,7 +27,7 @@ BUILDTOP=$(REL)..$(S)..$(S)..
 AUTH_DEF=-DAUTHENTICATION -DENCRYPTION -DKRB5 -DFORWARD -UNO_LOGIN_F -ULOGIN_CAP_F -DLOGIN_PROGRAM=KRB5_PATH_LOGIN
 OTHERDEFS=-DKLUDGELINEMODE -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON
 LOCALINCLUDES=-I.. -I$(srcdir)/..
-DEFINES = $(AUTH_DEF) $(OTHERDEFS)
+DEFINES = -DTELNET_BUFSIZE=65535 $(AUTH_DEF) $(OTHERDEFS)
 ARPA_TELNET= $(srcdir)/../arpa/telnet.h
 
 PROG_LIBPATH=-L$(TOPLIBD) $(KRB4_LIBPATH)
index b01842f006fb1151c6c306a859f4361b80511c64..e08c5bb13ad035348085b06c88c8f21afe2ee2ac 100644 (file)
@@ -53,7 +53,7 @@ static int envvarok (char *);
  * Buffer for sub-options, and macros
  * for suboptions buffer manipulations
  */
-unsigned char subbuffer[4096], *subpointer= subbuffer, *subend= subbuffer;
+unsigned char subbuffer[TELNET_BUFSIZE], *subpointer= subbuffer, *subend= subbuffer;
 
 #define        SB_CLEAR()      subpointer = subbuffer
 #define        SB_TERM()       { subend = subpointer; SB_CLEAR(); }
index 500ee74b047e6c6ea95e13d9786e01defba86328..7924ac077df5bfda101688d959031c3b1762030b 100755 (executable)
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2003-10-03'
+timestamp='2006-06-06'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,13 +18,15 @@ timestamp='2003-10-03'
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+
 # Originally written by Per Bothner <per@bothner.com>.
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
@@ -53,7 +56,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -66,11 +69,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -104,7 +107,7 @@ set_cc_for_build='
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 : ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -123,7 +126,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
        ;;
  ,,*)   CC_FOR_BUILD=$CC ;;
  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+esac ; set_cc_for_build= ;'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
@@ -196,50 +199,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # contains redundant information, the shorter form:
        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
        echo "${machine}-${os}${release}"
-       exit 0 ;;
-    amiga:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    arc:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    hp300:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mac68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    macppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-       echo m88k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvmeppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    pmax:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sgi:OpenBSD:*:*)
-       echo mipseb-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sun3:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
     *:OpenBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
     alpha:OSF1:*:*)
-       if test $UNAME_RELEASE = "V4.0"; then
+       case $UNAME_RELEASE in
+       *4.0)
                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-       fi
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
        # According to Compaq, /usr/sbin/psrinfo has been available on
        # OSF/1 and Tru64 systems produced since 1995.  I hope that
        # covers most systems running today.  This code pipes the CPU
@@ -277,42 +262,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
            "EV7.9 (21364A)")
                UNAME_MACHINE="alphaev79" ;;
        esac
+       # A Pn.n version is a patched version.
        # A Vn.n version is a released version.
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit 0 ;;
-    Alpha*:OpenVMS:*:*)
-       echo alpha-hp-vms
-       exit 0 ;;
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
     Alpha\ *:Windows_NT*:*)
        # How do we know it's Interix rather than the generic POSIX subsystem?
        # Should we change UNAME_MACHINE based on the output of uname instead
        # of the specific Alpha model?
        echo alpha-pc-interix
-       exit ;;
+       exit ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
-       exit ;;
+       exit ;;
     Amiga*:UNIX_System_V:4.0:*)
        echo m68k-unknown-sysv4
-       exit 0;;
+       exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-amigaos
-       exit ;;
+       exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-morphos
-       exit ;;
+       exit ;;
     *:OS/390:*:*)
        echo i370-ibm-openedition
-       exit 0 ;;
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
-       exit 0;;
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
        echo hppa1.1-hitachi-hiuxmpp
-       exit 0;;
+       exit ;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
        # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
        if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -320,32 +312,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        else
                echo pyramid-pyramid-bsd
        fi
-       exit ;;
+       exit ;;
     NILE*:*:*:dcosx)
        echo pyramid-pyramid-svr4
-       exit ;;
+       exit ;;
     DRS?6000:unix:4.0:6*)
        echo sparc-icl-nx6
-       exit ;;
-    DRS?6000:UNIX_SV:4.2*:7*)
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
        case `/usr/bin/uname -p` in
-           sparc) echo sparc-icl-nx7 && exit 0 ;;
+           sparc) echo sparc-icl-nx7; exit ;;
        esac ;;
     sun4H:SunOS:5.*:*)
        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     i86pc:SunOS:5.*:*)
        echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
        # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
        # it's likely to be more like Solaris than SunOS4.
        echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     sun4*:SunOS:*:*)
        case "`/usr/bin/arch -k`" in
            Series*|S4*)
@@ -354,10 +346,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
        echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit ;;
+       exit ;;
     sun3*:SunOS:*:*)
        echo m68k-sun-sunos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     sun*:*:4.2BSD:*)
        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
        test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -369,10 +361,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                echo sparc-sun-sunos${UNAME_RELEASE}
                ;;
        esac
-       exit ;;
+       exit ;;
     aushp:SunOS:*:*)
        echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -383,37 +375,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
         echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
         echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
     powerpc:machten:*:*)
        echo powerpc-apple-machten${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RISC*:Mach:*:*)
        echo mips-dec-mach_bsd4.3
-       exit ;;
+       exit ;;
     RISC*:ULTRIX:*:*)
        echo mips-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     VAX*:ULTRIX*:*:*)
        echo vax-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
        echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -437,32 +432,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
          exit (-1);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c \
-         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-         && exit 0
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
        echo mips-mips-riscos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     Motorola:PowerMAX_OS:*:*)
        echo powerpc-motorola-powermax
-       exit ;;
+       exit ;;
     Motorola:*:4.3:PL8-*)
        echo powerpc-harris-powermax
-       exit ;;
+       exit ;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
        echo powerpc-harris-powermax
-       exit ;;
+       exit ;;
     Night_Hawk:Power_UNIX:*:*)
        echo powerpc-harris-powerunix
-       exit ;;
+       exit ;;
     m88k:CX/UX:7*:*)
        echo m88k-harris-cxux7
-       exit ;;
+       exit ;;
     m88k:*:4*:R4*)
        echo m88k-motorola-sysv4
-       exit ;;
+       exit ;;
     m88k:*:3*:R3*)
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -478,29 +474,29 @@ EOF
        else
            echo i586-dg-dgux${UNAME_RELEASE}
        fi
-       exit ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
-       exit ;;
+       exit ;;
     M88*:*:R3*:*)
        # Delta 88k system running SVR3
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
        echo m88k-tektronix-sysv3
-       exit ;;
+       exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
        echo m68k-tektronix-bsd
-       exit ;;
+       exit ;;
     *:IRIX*:*:*)
        echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit ;;
+       exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
     i*86:AIX:*:*)
        echo i386-ibm-aix
-       exit ;;
+       exit ;;
     ia64:AIX:*:*)
        if [ -x /usr/bin/oslevel ] ; then
                IBM_REV=`/usr/bin/oslevel`
@@ -508,7 +504,7 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
                eval $set_cc_for_build
@@ -523,14 +519,18 @@ EOF
                        exit(0);
                        }
 EOF
-               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
-               echo rs6000-ibm-aix3.2.5
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
        elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
                echo rs6000-ibm-aix3.2.4
        else
                echo rs6000-ibm-aix3.2
        fi
-       exit ;;
+       exit ;;
     *:AIX:*:[45])
        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -544,28 +544,28 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
-       exit ;;
+       exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
        echo romp-ibm-bsd4.4
-       exit ;;
+       exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
        echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit 0 ;;                           # report: romp-ibm BSD 4.3
+       exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
-       exit ;;
+       exit ;;
     DPX/2?00:B.O.S.:*:*)
        echo m68k-bull-sysv3
-       exit ;;
+       exit ;;
     9000/[34]??:4.3bsd:1.*:*)
        echo m68k-hp-bsd
-       exit ;;
+       exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
        echo m68k-hp-bsd4.4
-       exit ;;
+       exit ;;
     9000/[34678]??:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        case "${UNAME_MACHINE}" in
@@ -627,9 +627,19 @@ EOF
        esac
        if [ ${HP_ARCH} = "hppa2.0w" ]
        then
-           # avoid double evaluation of $set_cc_for_build
-           test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
            then
                HP_ARCH="hppa2.0w"
            else
@@ -637,11 +647,11 @@ EOF
            fi
        fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     ia64:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        echo ia64-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     3050*:HI-UX:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -669,153 +679,179 @@ EOF
          exit (0);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
        echo unknown-hitachi-hiuxwe2
-       exit ;;
+       exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
        echo hppa1.1-hp-bsd
-       exit ;;
+       exit ;;
     9000/8??:4.3bsd:*:*)
        echo hppa1.0-hp-bsd
-       exit ;;
+       exit ;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
        echo hppa1.0-hp-mpeix
-       exit ;;
+       exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
        echo hppa1.1-hp-osf
-       exit ;;
+       exit ;;
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
-       exit ;;
+       exit ;;
     i*86:OSF1:*:*)
        if [ -x /usr/sbin/sysversion ] ; then
            echo ${UNAME_MACHINE}-unknown-osf1mk
        else
            echo ${UNAME_MACHINE}-unknown-osf1
        fi
-       exit ;;
+       exit ;;
     parisc*:Lites*:*:*)
        echo hppa1.1-hp-lites
-       exit ;;
+       exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*[A-Z]90:*:*:*)
        echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
        | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
              -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
              -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*TS:*:*:*)
        echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*T3E:*:*:*)
        echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*SV1:*:*:*)
        echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     *:UNICOS/mp:*:*)
-       echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
        FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     sparc*:BSD/OS:*:*)
        echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:BSD/OS:*:*)
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
-       # Determine whether the default compiler uses glibc.
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <features.h>
-       #if __GLIBC__ >= 2
-       LIBC=gnu
-       #else
-       LIBC=
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-       # GNU/FreeBSD systems have a "k" prefix to indicate we are using
-       # FreeBSD's kernel, but not the complete OS.
-       case ${LIBC} in gnu) kernel_only='k' ;; esac
-       echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
-       exit 0 ;;
+       exit ;;
+    *:FreeBSD:*:*)
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
     i*:CYGWIN*:*)
        echo ${UNAME_MACHINE}-pc-cygwin
-       exit ;;
+       exit ;;
     i*:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
-       exit 0 ;;
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
-       exit 0 ;;
-    x86:Interix*:[34]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-       exit 0 ;;
+       exit ;;
+    x86:Interix*:[345]*)
+       echo i586-pc-interix${UNAME_RELEASE}
+       exit ;;
+    EM64T:Interix*:[345]*)
+       echo x86_64-unknown-interix${UNAME_RELEASE}
+       exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
-       exit ;;
+       exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
        # How do we know it's Interix rather than the generic POSIX subsystem?
        # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
        # UNAME_MACHINE based on the output of uname instead of i386?
        echo i586-pc-interix
-       exit ;;
+       exit ;;
     i*:UWIN*:*)
        echo ${UNAME_MACHINE}-pc-uwin
-       exit 0 ;;
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
     p*:CYGWIN*:*)
        echo powerpcle-unknown-cygwin
-       exit ;;
+       exit ;;
     prep*:SunOS:5.*:*)
        echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     *:GNU:*:*)
+       # the GNU system
        echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit 0 ;;
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
-       exit ;;
+       exit ;;
     arm*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
     cris:Linux:*:*)
        echo cris-axis-linux-gnu
-       exit 0 ;;
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
     ia64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
     m68*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     mips:Linux:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -832,8 +868,12 @@ EOF
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
        ;;
     mips64:Linux:*:*)
        eval $set_cc_for_build
@@ -851,15 +891,22 @@ EOF
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
        ;;
+    or32:Linux:*:*)
+       echo or32-unknown-linux-gnu
+       exit ;;
     ppc:Linux:*:*)
        echo powerpc-unknown-linux-gnu
-       exit ;;
+       exit ;;
     ppc64:Linux:*:*)
        echo powerpc64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     alpha:Linux:*:*)
        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
          EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -873,7 +920,7 @@ EOF
        objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
        if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
        echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-       exit ;;
+       exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -881,25 +928,28 @@ EOF
          PA8*) echo hppa2.0-unknown-linux-gnu ;;
          *)    echo hppa-unknown-linux-gnu ;;
        esac
-       exit ;;
+       exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
        echo hppa64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux
-       exit ;;
+       exit ;;
     sh64*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     sh*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     i*86:Linux:*:*)
        # The BFD linker knows what the default object file format is, so
        # first see if it will tell us. cd to the root directory to prevent
@@ -917,15 +967,15 @@ EOF
                ;;
          a.out-i386-linux)
                echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-               exit ;;
+               exit ;;
          coff-i386)
                echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit ;;
+               exit ;;
          "")
                # Either a pre-BFD a.out linker (linux-gnuoldld) or
                # one that does not give us useful --help.
                echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-               exit ;;
+               exit ;;
        esac
        # Determine whether the default compiler is a.out or elf
        eval $set_cc_for_build
@@ -942,7 +992,7 @@ EOF
        LIBC=gnulibc1
        # endif
        #else
-       #ifdef __INTEL_COMPILER
+       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
        LIBC=gnu
        #else
        LIBC=gnuaout
@@ -952,16 +1002,23 @@ EOF
        LIBC=dietlibc
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
-       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^LIBC/{
+               s: ::g
+               p
+           }'`"
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
        ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
        # earlier versions are messed up and put the nodename in both
        # sysname and nodename.
        echo i386-sequent-sysv4
-       exit ;;
+       exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
@@ -969,24 +1026,27 @@ EOF
        # I just have to hope.  -- rms.
         # Use sysv4.2uw... so that sysv4* matches it.
        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit ;;
+       exit ;;
     i*86:OS/2:*:*)
        # If we were able to find `uname', then EMX Unix compatibility
        # is probably installed.
        echo ${UNAME_MACHINE}-pc-os2-emx
-       exit ;;
+       exit ;;
     i*86:XTS-300:*:STOP)
        echo ${UNAME_MACHINE}-unknown-stop
-       exit ;;
+       exit ;;
     i*86:atheos:*:*)
        echo ${UNAME_MACHINE}-unknown-atheos
-       exit 0 ;;
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
        echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     i*86:*DOS:*:*)
        echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit ;;
+       exit ;;
     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
        UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -994,15 +1054,16 @@ EOF
        else
                echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
        fi
-       exit 0 ;;
-    i*86:*:5:[78]*)
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
        case `/bin/uname -X | grep "^Machine"` in
            *486*)           UNAME_MACHINE=i486 ;;
            *Pentium)        UNAME_MACHINE=i586 ;;
            *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
        esac
        echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-       exit ;;
+       exit ;;
     i*86:*:3.2:*)
        if test -f /usr/options/cb.name; then
                UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1020,73 +1081,73 @@ EOF
        else
                echo ${UNAME_MACHINE}-pc-sysv32
        fi
-       exit ;;
+       exit ;;
     pc:*:*:*)
        # Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
        echo i386-pc-msdosdjgpp
-        exit ;;
+        exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
-       exit ;;
+       exit ;;
     paragon:*:*:*)
        echo i860-intel-osf1
-       exit ;;
+       exit ;;
     i860:*:4.*:*) # i860-SVR4
        if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
          echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
        else # Add other i860-SVR4 vendors below as they are discovered.
          echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
        fi
-       exit ;;
+       exit ;;
     mini*:CTIX:SYS*5:*)
        # "miniframe"
        echo m68010-convergent-sysv
-       exit ;;
+       exit ;;
     mc68k:UNIX:SYSTEM5:3.51m)
        echo m68k-convergent-sysv
-       exit ;;
+       exit ;;
     M680?0:D-NIX:5.3:*)
        echo m68k-diab-dnix
-       exit ;;
-    M68*:*:R3V[567]*:*)
-       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
        OS_REL=''
        test -r /etc/.relid \
        && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
+          && { echo i486-ncr-sysv4; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mc68030:UNIX_System_V:4.*:*)
        echo m68k-atari-sysv4
-       exit ;;
+       exit ;;
     TSUNAMI:LynxOS:2.*:*)
        echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
        echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SM[BE]S:UNIX_SV:*:*)
        echo mips-dde-sysv${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RM*:ReliantUNIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     RM*:SINIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
                UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1094,68 +1155,72 @@ EOF
        else
                echo ns32k-sni-sysv
        fi
-       exit ;;
+       exit ;;
     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                       # says <Richard.M.Bartel@ccMail.Census.GOV>
         echo i586-unisys-sysv4
-        exit ;;
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
        # From Gerald Hewes <hewes@openmarket.com>.
        # How about differentiating between stratus architectures? -djm
        echo hppa1.1-stratus-sysv4
-       exit ;;
+       exit ;;
     *:*:*:FTX*)
        # From seanf@swdc.stratus.com.
        echo i860-stratus-sysv4
-       exit 0 ;;
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
     *:VOS:*:*)
        # From Paul.Green@stratus.com.
        echo hppa1.1-stratus-vos
-       exit ;;
+       exit ;;
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     news*:NEWS-OS:6*:*)
        echo mips-sony-newsos6
-       exit ;;
+       exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
        if [ -d /usr/nec ]; then
                echo mips-nec-sysv${UNAME_RELEASE}
        else
                echo mips-unknown-sysv${UNAME_RELEASE}
        fi
-        exit ;;
+        exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
        echo powerpc-be-beos
-       exit ;;
+       exit ;;
     BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
        echo powerpc-apple-beos
-       exit ;;
+       exit ;;
     BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
        echo i586-pc-beos
-       exit ;;
+       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SX-5:SUPER-UX:*:*)
        echo sx5-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SX-6:SUPER-UX:*:*)
        echo sx6-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Rhapsody:*:*)
        echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Darwin:*:*)
-       case `uname -p` in
-           *86) UNAME_PROCESSOR=i686 ;;
-           powerpc) UNAME_PROCESSOR=powerpc ;;
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           unknown) UNAME_PROCESSOR=powerpc ;;
        esac
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
        if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1163,22 +1228,25 @@ EOF
                UNAME_MACHINE=pc
        fi
        echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:QNX:*:4*)
        echo i386-pc-qnx
-       exit 0 ;;
-    NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:NonStop-UX:*:*)
        echo mips-compaq-nonstopux
-       exit ;;
+       exit ;;
     BS2000:POSIX*:*:*)
        echo bs2000-siemens-sysv
-       exit ;;
+       exit ;;
     DS/*:UNIX_System_V:*:*)
        echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Plan9:*:*)
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
@@ -1189,28 +1257,47 @@ EOF
            UNAME_MACHINE="$cputype"
        fi
        echo ${UNAME_MACHINE}-unknown-plan9
-       exit ;;
+       exit ;;
     *:TOPS-10:*:*)
        echo pdp10-unknown-tops10
-       exit ;;
+       exit ;;
     *:TENEX:*:*)
        echo pdp10-unknown-tenex
-       exit ;;
+       exit ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
        echo pdp10-dec-tops20
-       exit ;;
+       exit ;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
        echo pdp10-xkl-tops20
-       exit ;;
+       exit ;;
     *:TOPS-20:*:*)
        echo pdp10-unknown-tops20
-       exit ;;
+       exit ;;
     *:ITS:*:*)
        echo pdp10-unknown-its
-       exit ;;
+       exit ;;
     SEI:*:*:SEIUX)
         echo mips-sei-seiux${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1242,7 +1329,7 @@ main ()
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
+  printf ("arm-acorn-riscix\n"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -1331,11 +1418,12 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1344,22 +1432,22 @@ then
     case `getsysinfo -f cpu_type` in
     c1*)
        echo c1-convex-bsd
-       exit ;;
+       exit ;;
     c2*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-       exit ;;
+       exit ;;
     c34*)
        echo c34-convex-bsd
-       exit ;;
+       exit ;;
     c38*)
        echo c38-convex-bsd
-       exit ;;
+       exit ;;
     c4*)
        echo c4-convex-bsd
-       exit ;;
+       exit ;;
     esac
 fi
 
@@ -1370,7 +1458,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-    ftp://ftp.gnu.org/pub/gnu/config/
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
index 1f31816b97a13e14c63f276bea226a8dde6887b5..70584b007e2bf2d71a9bfce59815174f56653dc0 100755 (executable)
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2003-08-18'
+timestamp='2006-06-06'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,14 +22,15 @@ timestamp='2003-08-18'
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
 #
@@ -70,7 +72,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -83,11 +85,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -99,7 +101,7 @@ while test $# -gt 0 ; do
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit 0;;
+       exit ;;
 
     * )
        break ;;
@@ -118,7 +120,9 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -144,7 +148,7 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis)
+       -apple | -axis | -knuth | -cray)
                os=
                basic_machine=$1
                ;;
@@ -169,6 +173,10 @@ case $os in
        -hiux*)
                os=-hiuxwe2
                ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco5)
                os=-sco3.2v5
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -185,6 +193,10 @@ case $os in
                # Don't forget version if it is 3.2v4 or newer.
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco*)
                os=-sco3.2v2
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -229,14 +241,16 @@ case $basic_machine in
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
        | am33_2.0 \
-       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | bfin \
        | c4x | clipper \
        | d10v | d30v | dlx | dsp16xx \
        | fr30 | frv \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
-       | m32r | m68000 | m68k | m88k | mcore \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
@@ -245,6 +259,7 @@ case $basic_machine in
        | mips64vr4100 | mips64vr4100el \
        | mips64vr4300 | mips64vr4300el \
        | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
        | mipsisa32 | mipsisa32el \
        | mipsisa32r2 | mipsisa32r2el \
        | mipsisa64 | mipsisa64el \
@@ -253,20 +268,23 @@ case $basic_machine in
        | mipsisa64sr71k | mipsisa64sr71kel \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
+       | mt \
        | msp430 \
+       | nios | nios2 \
        | ns16k | ns32k \
-       | openrisc | or32 \
+       | or32 \
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
-       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
-       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
-       | strongarm \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu | strongarm \
        | tahoe | thumb | tic4x | tic80 | tron \
        | v850 | v850e \
        | we32k \
-       | x86 | xscale | xstormy16 | xtensa \
+       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
        | z8k)
                basic_machine=$basic_machine-unknown
                ;;
@@ -277,6 +295,9 @@ case $basic_machine in
                ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
                ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
 
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
@@ -296,10 +317,10 @@ case $basic_machine in
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-       | avr-* \
-       | bs2000-* \
+       | avr-* | avr32-* \
+       | bfin-* | bs2000-* \
        | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-       | clipper-* | cydra-* \
+       | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
        | elxsi-* \
        | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
@@ -307,9 +328,9 @@ case $basic_machine in
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
-       | m32r-* \
+       | m32c-* | m32r-* | m32rle-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | mcore-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
        | mips64-* | mips64el-* \
@@ -318,6 +339,7 @@ case $basic_machine in
        | mips64vr4100-* | mips64vr4100el-* \
        | mips64vr4300-* | mips64vr4300el-* \
        | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
        | mipsisa32-* | mipsisa32el-* \
        | mipsisa32r2-* | mipsisa32r2el-* \
        | mipsisa64-* | mipsisa64el-* \
@@ -325,24 +347,28 @@ case $basic_machine in
        | mipsisa64sb1-* | mipsisa64sb1el-* \
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
        | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
        | msp430-* \
-       | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
        | pyramid-* \
        | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
-       | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
        | tahoe-* | thumb-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
        | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
-       | xtensa-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa-* \
        | ymp-* \
        | z8k-*)
                ;;
@@ -362,6 +388,9 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
        adobe68k)
                basic_machine=m68010-adobe
                os=-scout
@@ -379,6 +408,9 @@ case $basic_machine in
        amd64)
                basic_machine=x86_64-pc
                ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        amdahl)
                basic_machine=580-amdahl
                os=-sysv
@@ -438,12 +470,27 @@ case $basic_machine in
                basic_machine=j90-cray
                os=-unicos
                ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
        crds | unos)
                basic_machine=m68k-crds
                ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
        cris | cris-* | etrax*)
                basic_machine=cris-axis
                ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
        da30 | da30-*)
                basic_machine=m68k-da30
                ;;
@@ -466,6 +513,10 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
        dpx20 | dpx20-*)
                basic_machine=rs6000-bull
                os=-bosx
@@ -644,10 +695,6 @@ case $basic_machine in
        mips3*)
                basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
                ;;
-       mmix*)
-               basic_machine=mmix-knuth
-               os=-mmixware
-               ;;
        monitor)
                basic_machine=m68k-rom68k
                os=-coff
@@ -660,6 +707,9 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-msdos
                ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
        mvs)
                basic_machine=i370-ibm
                os=-mvs
@@ -728,10 +778,6 @@ case $basic_machine in
        np1)
                basic_machine=np1-gould
                ;;
-       nv1)
-               basic_machine=nv1-cray
-               os=-unicosmp
-               ;;
        nsr-tandem)
                basic_machine=nsr-tandem
                ;;
@@ -739,9 +785,12 @@ case $basic_machine in
                basic_machine=hppa1.1-oki
                os=-proelf
                ;;
-       or32 | or32-*)
+       openrisc | openrisc-*)
                basic_machine=or32-unknown
-               os=-coff
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
                ;;
        OSE68000 | ose68000)
                basic_machine=m68000-ericsson
@@ -768,6 +817,12 @@ case $basic_machine in
        pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        pentium | p5 | k5 | k6 | nexgen | viac3)
                basic_machine=i586-pc
                ;;
@@ -824,6 +879,10 @@ case $basic_machine in
                basic_machine=i586-unknown
                os=-pw32
                ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
        rom68k)
                basic_machine=m68k-rom68k
                os=-coff
@@ -963,6 +1022,10 @@ case $basic_machine in
        tower | tower-32)
                basic_machine=m68k-ncr
                ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
        udi29k)
                basic_machine=a29k-amd
                os=-udi
@@ -1006,6 +1069,10 @@ case $basic_machine in
                basic_machine=hppa1.1-winbond
                os=-proelf
                ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
        xps | xps100)
                basic_machine=xps100-honeywell
                ;;
@@ -1036,6 +1103,9 @@ case $basic_machine in
        romp)
                basic_machine=romp-ibm
                ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
        rs6000)
                basic_machine=rs6000-ibm
                ;;
@@ -1052,13 +1122,10 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparc | sparcv9 | sparcv9b)
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
                basic_machine=sparc-sun
                ;;
        cydra)
@@ -1131,19 +1198,23 @@ case $os in
              | -aos* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
-             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -chorusos* | -chorusrdb* \
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-             | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1161,7 +1232,7 @@ case $os in
                os=`echo $os | sed -e 's|nto|nto-qnx|'`
                ;;
        -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
              | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
                ;;
        -mac*)
@@ -1182,6 +1253,9 @@ case $os in
        -opened*)
                os=-openedition
                ;;
+        -os400*)
+               os=-os400
+               ;;
        -wince*)
                os=-wince
                ;;
@@ -1203,6 +1277,9 @@ case $os in
        -atheos*)
                os=-atheos
                ;;
+       -syllable*)
+               os=-syllable
+               ;;
        -386bsd)
                os=-bsd
                ;;
@@ -1225,6 +1302,9 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
+        -tpf*)
+               os=-tpf
+               ;;
        -triton*)
                os=-sysv3
                ;;
@@ -1261,6 +1341,9 @@ case $os in
        -kaos*)
                os=-kaos
                ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
        -none)
                ;;
        *)
@@ -1283,6 +1366,9 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        spu-*)
+               os=-elf
+               ;;
        *-acorn)
                os=-riscix1.2
                ;;
@@ -1292,9 +1378,9 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+        c4x-* | tic4x-*)
+               os=-coff
+               ;;
        # This must come before the *-dec entry.
        pdp10-*)
                os=-tops20
@@ -1338,9 +1424,15 @@ case $basic_machine in
        *-be)
                os=-beos
                ;;
+       *-haiku)
+               os=-haiku
+               ;;
        *-ibm)
                os=-aix
                ;;
+       *-knuth)
+               os=-mmixware
+               ;;
        *-wec)
                os=-proelf
                ;;
@@ -1473,9 +1565,15 @@ case $basic_machine in
                        -mvs* | -opened*)
                                vendor=ibm
                                ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
                        -ptx*)
                                vendor=sequent
                                ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
                        -vxsim* | -vxworks* | -windiss*)
                                vendor=wrs
                                ;;
@@ -1500,7 +1598,7 @@ case $basic_machine in
 esac
 
 echo $basic_machine$os
-exit 0
+exit
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
index 40c245b083d4686efa2f54d949292c43ef05a51d..5d362743daa2f77a7bd561825b3e32a3527f2383 100644 (file)
@@ -89,6 +89,8 @@ hpux10.exports: $(SHLIB_EXPORT_FILE) Makefile
          else :; fi; \
        done; echo "$$a" >> hpux10.tmp
        echo "+e errno" >> hpux10.tmp
+       echo "+e _GLOBAL__FD_lib$(LIBBASE)_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp
+       echo "+e _GLOBAL__FI_lib$(LIBBASE)_$(LIBMAJOR)_$(LIBMINOR)" >> hpux10.tmp
        mv -f hpux10.tmp hpux10.exports
 
 lib$(LIBBASE)$(PFLIBEXT): $(PFOBJLISTS)
index e960a455d4806205aff45442f08a107c8fdf5e9c..a20edf93473ce7c1f21926b8f849c2c173e9680b 100644 (file)
@@ -97,6 +97,8 @@ depend-update-makefile: .depend depend-recurse
        else :; fi
 
 DEPTARGETS = .depend .d .dtmp $(DEP_VERIFY)
+DEPTARGETS_CLEAN = .depend .d .dtmp $(DEPTARGETS_@srcdir@_@CONFIG_RELTOPDIR@)
+DEPTARGETS_@top_srcdir@_. = $(DEP_VERIFY)
 
 #
 # end dependency generation
@@ -105,7 +107,7 @@ DEPTARGETS = .depend .d .dtmp $(DEP_VERIFY)
 clean:: clean-$(WHAT)
 
 clean-unix::
-       $(RM) $(OBJS) $(DEPTARGETS) $(EXTRA_FILES)
+       $(RM) $(OBJS) $(DEPTARGETS_CLEAN) $(EXTRA_FILES)
        -$(RM) -r $(srcdir)/$(thisconfigdir)/autom4te.cache
 
 clean-windows::
index d05e06b6769044ce5e197d25aa00c5a4052b440a..cb7ac0cb1f68cc99766e5c908808325157acd4e7 100644 (file)
@@ -388,7 +388,7 @@ DES425_LIB  = @DES425_LIB@
 # HESIOD_LIBS is -lhesiod...
 HESIOD_LIBS    = @HESIOD_LIBS@
 
-KRB5_BASE_LIBS = $(KRB5_LIB) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(GEN_LIB) $(LIBS)
+KRB5_BASE_LIBS = $(KRB5_LIB) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(GEN_LIB) $(LIBS) $(DL_LIB)
 KRB4COMPAT_LIBS        = $(KRB4_LIB) $(DES425_LIB) $(KRB5_BASE_LIBS)
 KDB5_LIBS      = $(KDB5_LIB)
 GSS_LIBS       = $(GSS_KRB5_LIB)
index 1a1caad78b1768ad65b15359be2f51681909c726..fbd93393aa763f60c72e1891ce18310d28d7da95 100644 (file)
@@ -287,7 +287,7 @@ mips-*-netbsd*)
        # libraries, without adding them to the dependency list.  We need this because
        # the direct dependent libraries contain the pathname where the indirect
        # dependent libraries will be installed (but haven't been yet).
-       LDCOMBINE_TAIL='-dylib_file "$(KRB5_LIBDIR)/libkrb5support.1.0.dylib":$(TOPLIBD)/libkrb5support.1.0.dylib'
+       LDCOMBINE_TAIL='-dylib_file "$(KRB5_LIBDIR)/libkrb5support.1.1.dylib":$(TOPLIBD)/libkrb5support.1.1.dylib'
        CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -dynamic $(CFLAGS) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)'
        RUN_ENV='DYLD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export DYLD_LIBRARY_PATH;'
index b770fab99882958638d360c5e8f614b9744a8833..cf93187ce8fb6d6ffc339266e48a7b33c67facfd 100644 (file)
@@ -878,6 +878,17 @@ dnl
 HOST_TYPE=$krb5_cv_host
 AC_SUBST(HOST_TYPE)
 dnl
+dnl Sadly, we seem to have accidentally committed ourselves in 1.4 to
+dnl an ABI that includes the existence of libkrb5support.0 even
+dnl though random apps should never use anything from it.  And on
+dnl the Mac, to which that didn't apply, we can't use major version 0.
+dnl
+case $krb5_cv_host in
+*-*-darwin* | *-*-rhapsody*) SUPPORTLIB_MAJOR=1 ;;
+*)                          SUPPORTLIB_MAJOR=0 ;;
+esac
+AC_SUBST(SUPPORTLIB_MAJOR)
+dnl
 dnl
 if test "$COM_ERR_VERSION" = k5 ; then
 dnl  AC_CONFIG_SUBDIRS(util/et)
index 313a01782176a3be9de50efd1a7e72d9521df254..d1c6b4251d3d9feb1c7eb2ccbb440cc6b92ac914 100644 (file)
@@ -26,6 +26,8 @@ BUILT_HEADERS = osconf.h
 all-unix:: autoconf.h $(BUILT_HEADERS)
 all-windows:: autoconf.h $(BUILT_HEADERS)
 
+all-unix:: @MAINT@ verify-calling-conventions-krb5
+
 $(srcdir)/autoconf.h.in: @MAINT@ $(srcdir)/autoconf.stmp
 $(srcdir)/autoconf.stmp: $(srcdir)/$(thisconfigdir)/configure.in $(SRCTOP)/aclocal.m4
        $(RM) -r $(srcdir)/$(thisconfigdir)/autom4te.cache
@@ -80,6 +82,9 @@ krb5/krb5.h: $(srcdir)/krb5/krb5.hin krb5_err.h kdb5_err.h kv5m_err.h krb524_err
        cat $(srcdir)/krb5/krb5.hin krb5_err.h kdb5_err.h kv5m_err.h krb524_err.h \
                asn1_err.h >> krb5/krb5.h
 
+verify-calling-conventions-krb5: krb5/krb5.h
+       $(PERL) -w $(SRCTOP)/util/def-check.pl krb5/krb5.h $(SRCTOP)/lib/krb5_32.def
+
 #
 # Build the error table include files:
 # asn1_err.h kdb5_err.h krb5_err.h kv5m_err.h krb524_err.h
index 1bc3ed2d7c8148e63aee96aa5175e9f9ffe2cd4d..a8b9e5d99a9fb94b77b0f840d4b3b664be33d825 100644 (file)
@@ -1885,4 +1885,7 @@ krb5int_c_mandatory_cksumtype (krb5_context, krb5_enctype, krb5_cksumtype *);
 extern int krb5int_crypto_init (void);
 extern int krb5int_prng_init(void);
 
+#define krb5_copy_error_state(CTX, OCTX) \
+       krb5int_set_error(&(CTX)->errinfo, (OCTX)->errinfo.code, "%s", (OCTX)->errinfo.msg)
+
 #endif /* _KRB5_INT_H */
index d786e6770c3a7e1b23e445b4d7bd001b20d4b6dd..603ed802835f3ea07234c9afcbf0a3d162ec429c 100644 (file)
@@ -1343,6 +1343,8 @@ krb5_error_code KRB5_CALLCONV krb5_init_secure_context
        (krb5_context *);
 void KRB5_CALLCONV krb5_free_context
        (krb5_context);
+krb5_error_code KRB5_CALLCONV krb5_copy_context
+       (krb5_context, krb5_context *);
 
 #if KRB5_PRIVATE
 krb5_error_code krb5_set_default_in_tkt_ktypes
@@ -2537,17 +2539,27 @@ krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types
        (krb5_context context);
 
 /* Error reporting */
-void
+void KRB5_CALLCONV_C
 krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...);
 #ifdef va_start
-void
+void KRB5_CALLCONV
 krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list);
 #endif
-char *
+/*
+ * The behavior of krb5_get_error_message is only defined the first
+ * time it is called after a failed call to a krb5 function using the
+ * same context, and only when the error code passed in is the same as
+ * that returned by the krb5 function.  Future versions may return the
+ * same string for the second and following calls.
+ *
+ * The string returned by this function must be freed using
+ * krb5_free_error_message.
+ */
+char * KRB5_CALLCONV
 krb5_get_error_message (krb5_context, krb5_error_code);
-void
+void KRB5_CALLCONV
 krb5_free_error_message (krb5_context, char *);
-void
+void KRB5_CALLCONV
 krb5_clear_error_message (krb5_context);
 
 
index 0b134201560e08df473fde66bfc15c3516968980..64b4c3f1c0cb3f9f2bb1b63e3658c2f6af28470c 100644 (file)
@@ -176,10 +176,14 @@ kadmin_parse_name(name, principal)
 static void extended_com_err_fn (const char *myprog, errcode_t code,
                                 const char *fmt, va_list args)
 {
-    const char *emsg;
-    emsg = krb5_get_error_message (context, code);
-    fprintf (stderr, "%s: %s ", myprog, emsg);
-    krb5_free_error_message (context, emsg);
+    if (code) {
+       const char *emsg;
+       emsg = krb5_get_error_message (context, code);
+       fprintf (stderr, "%s: %s ", myprog, emsg);
+       krb5_free_error_message (context, emsg);
+    } else {
+       fprintf (stderr, "%s: ", myprog);
+    }
     vfprintf (stderr, fmt, args);
     fprintf (stderr, "\n");
 }
@@ -404,7 +408,7 @@ char *kadmin_startup(argc, argv)
                if (realm - canon && *(realm - 1) != '\\')
                    break;
                else
-                   realm = strchr(realm, '@');
+                   realm = strchr(realm+1, '@');
            }
            if (realm)
                *realm++ = '\0';
@@ -413,7 +417,7 @@ char *kadmin_startup(argc, argv)
                if (cp - canon && *(cp - 1) != '\\')
                    break;
                else
-                   cp = strchr(cp, '/');
+                   cp = strchr(cp+1, '/');
            }
            if (cp != NULL)
                *cp = '\0';
@@ -725,6 +729,10 @@ void kadmin_cpw(argc, argv)
        }
        goto usage;
     }
+    if (*argv == NULL) {
+       com_err("change_password", 0, "missing principal name");
+       goto usage;
+    }
     retval = kadmin_parse_name(*argv, &princ);
     if (retval) {
        com_err("change_password", retval, "while parsing principal name");
index 2ce811d0b5a9e053968044938e51a3c521e23e4d..f0d277c12280e25fe4b842914431b7c1bc1ecf5e 100644 (file)
@@ -2121,23 +2121,12 @@ load_db(argc, argv)
            verbose = 1;
        else if (!strcmp(argv[aindex], updateoption))
            update = 1;
-       else if (!strcmp(argv[aindex], hashoption))
-       {
-           db5util_db_args_size++;
-           {
-               char **temp = realloc( db5util_db_args, sizeof(char*) * (db5util_db_args_size+1)); /* one for NULL */
-               if( temp == NULL )
-               {
-                   com_err(progname, ENOMEM, "while parsing command arguments\n");
-                   exit(1);
-               }
-
-               db5util_db_args = temp;
+       else if (!strcmp(argv[aindex], hashoption)) {
+           if (!add_db_arg("hash=true")) {
+               com_err(progname, ENOMEM, "while parsing command arguments\n");
+               exit(1);
            }
-           db5util_db_args[db5util_db_args_size-1] = "hash=true";
-           db5util_db_args[db5util_db_args_size]   = NULL;
-       }
-       else
+       } else
            break;
     }
     if ((argc - aindex) != 1) {
index b04595d65c64e22068b7f56a550063adc84f4f8d..46bccce4304ac221ba9469b182a793d65c3fa9ee 100644 (file)
@@ -171,19 +171,11 @@ void kdb5_create(argc, argv)
            do_stash++;
            break;
        case 'h':
-           db5util_db_args_size++;
-           {
-               char **temp = realloc( db5util_db_args, sizeof(char*) * (db5util_db_args_size+1)); /* one for NULL */
-               if( temp == NULL )
-               {
-                   com_err(progname, ENOMEM, "while parsing command arguments\n");
-                   exit(1);
-               }
-
-               db5util_db_args = temp;
+           if (!add_db_arg("hash=true")) {
+               com_err(progname, ENOMEM, "while parsing command arguments\n");
+               exit(1);
            }
-           db5util_db_args[db5util_db_args_size-1] = "hash=true";
-           db5util_db_args[db5util_db_args_size]   = NULL;
+           break;
        case '?':
        default:
            usage();
index 0e308e54ecb9e310f47a500b3e3911cdc2925538..00c87a225636864053df51cb1ec4ce33e104a10b 100644 (file)
@@ -149,13 +149,31 @@ static void extended_com_err_fn (const char *myprog, errcode_t code,
                                 const char *fmt, va_list args)
 {
     const char *emsg;
-    emsg = krb5_get_error_message (util_context, code);
-    fprintf (stderr, "%s: %s ", myprog, emsg);
-    krb5_free_error_message (util_context, emsg);
+    if (code) {
+       emsg = krb5_get_error_message (util_context, code);
+       fprintf (stderr, "%s: %s ", myprog, emsg);
+       krb5_free_error_message (util_context, emsg);
+    } else {
+       fprintf (stderr, "%s: ", myprog);
+    }
     vfprintf (stderr, fmt, args);
     fprintf (stderr, "\n");
 }
 
+int add_db_arg(char *arg)
+{
+    char **temp;
+    db5util_db_args_size++;
+    temp = realloc(db5util_db_args,
+                  sizeof(char *) * (db5util_db_args_size + 1));
+    if (temp == NULL)
+       return 0;
+    db5util_db_args = temp;
+    db5util_db_args[db5util_db_args_size-1] = arg;
+    db5util_db_args[db5util_db_args_size]   = NULL;
+    return 1;
+}
+
 int main(argc, argv)
     int argc;
     char *argv[];
@@ -205,35 +223,18 @@ int main(argc, argv)
            strcpy( db_name_tmp, "dbname=");
            strcat( db_name_tmp, global_params.dbname );
 
-           db5util_db_args_size++;
-           {
-               char **temp = realloc( db5util_db_args, sizeof(char*) * (db5util_db_args_size+1)); /* one for NULL */
-               if( temp == NULL )
-               {
-                   com_err(progname, ENOMEM, "while parsing command arguments\n");
-                   exit(1);
-               }
-
-               db5util_db_args = temp;
+           if (!add_db_arg(db_name_tmp)) {
+               com_err(progname, ENOMEM, "while parsing command arguments\n");
+               exit(1);
            }
-           db5util_db_args[db5util_db_args_size-1] = db_name_tmp;
-           db5util_db_args[db5util_db_args_size]   = NULL;
 
        } else if (strcmp(*argv, "-x") == 0 && ARG_VAL) {
           db5util_db_args_size++;
-          {
-              char **temp = realloc( db5util_db_args, sizeof(char*) * (db5util_db_args_size+1)); /* one for NULL */
-              if( temp == NULL )
-              {
-                  fprintf(stderr,"%s: Cannot initialize. Not enough memory\n",
-                          argv[0]);
-                  exit(1);
-              }
-
-              db5util_db_args = temp;
+          if (!add_db_arg(koptarg)) {
+              fprintf(stderr,"%s: Cannot initialize. Not enough memory\n",
+                      argv[0]);
+              exit(1);
           }
-          db5util_db_args[db5util_db_args_size-1] = koptarg;
-          db5util_db_args[db5util_db_args_size]   = NULL;
 
        } else if (strcmp(*argv, "-r") == 0 && ARG_VAL) {
            global_params.realm = koptarg;
index bb6b0ac64ae9ef97720b3be90be58d4a336615c6..90b7b43ef35c364d2b77e09f2aeab09f63874735 100644 (file)
@@ -42,6 +42,7 @@ extern int valid_master_key;
 extern krb5_db_entry master_db;
 extern char **db5util_db_args;
 extern int    db5util_db_args_size;
+extern int add_db_arg(char *arg);
 
 extern void usage(void);
 
index 5ea5ea39228113f9c57736dee5ed1af7de54bce3..0a932518aeb90adb4dd0f689939f17d97f9ab272 100644 (file)
@@ -193,9 +193,9 @@ $(OUTPRE)kerberos_v4.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
   $(SRCTOP)/include/k5-err.h $(SRCTOP)/include/k5-int.h \
   $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \
   $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \
-  $(SRCTOP)/include/kerberosIV/des.h $(SRCTOP)/include/kerberosIV/kdc.h \
-  $(SRCTOP)/include/kerberosIV/klog.h $(SRCTOP)/include/kerberosIV/krb.h \
-  $(SRCTOP)/include/kerberosIV/krb_db.h $(SRCTOP)/include/kerberosIV/prot.h \
-  $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \
-  $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \
-  $(SRCTOP)/include/syslog.h extern.h kdc_util.h kerberos_v4.c
+  $(SRCTOP)/include/kerberosIV/des.h $(SRCTOP)/include/kerberosIV/klog.h \
+  $(SRCTOP)/include/kerberosIV/krb.h $(SRCTOP)/include/kerberosIV/krb_db.h \
+  $(SRCTOP)/include/kerberosIV/prot.h $(SRCTOP)/include/krb5.h \
+  $(SRCTOP)/include/krb5/locate_plugin.h $(SRCTOP)/include/port-sockets.h \
+  $(SRCTOP)/include/socket-utils.h $(SRCTOP)/include/syslog.h \
+  extern.h kdc_util.h kerberos_v4.c
index a11e6225acb2af96e160b5994ab0a60ce9bbb0ca..9f93e451e2366acab06a8a976de52ce9430f41ee 100644 (file)
@@ -62,7 +62,6 @@
 #include <klog.h>
 #include <prot.h>
 #include <krb_db.h>
-#include <kdc.h>
 
 #ifdef NEED_SWAB_PROTO
 extern void swab(const void *, void *, size_t );
@@ -70,7 +69,7 @@ extern void swab(const void *, void *, size_t );
 
 static int compat_decrypt_key (krb5_key_data *, C_Block,
                                         krb5_keyblock *, int);
-static int kerb_get_principal (char *, char *, Principal *, int,
+static int kerb_get_principal (char *, char *, Principal *,
                                         int *, krb5_keyblock *, krb5_kvno,
                                         int, krb5_deltat *);
 static int check_princ (char *, char *, int, Principal *,
@@ -401,7 +400,6 @@ compat_decrypt_key (krb5_key_data *in5, unsigned char *out4,
 static int
 kerb_get_principal(char *name, char *inst, /* could have wild cards */
                   Principal *principal,
-                  int maxn,    /* max # name structs to return */
                   int *more,   /* more tuples than room for */
                   krb5_keyblock *k5key, krb5_kvno kvno,
                   int issrv,   /* true if retrieving a service key */
@@ -424,10 +422,6 @@ kerb_get_principal(char *name, char *inst, /* could have wild cards */
     krb5_error_code retval;
 
     *more = 0;
-    if ( maxn > 1) {
-       lt = klog(L_DEATH_REQ, "KDC V4 is requesting too many principals");
-       return( 0);
-    }
     /* begin setting up the principal structure
      * with the first info we have:
      */
@@ -453,7 +447,7 @@ kerb_get_principal(char *name, char *inst, /* could have wild cards */
     krb5_free_principal(kdc_context, search);
 
     if (nprinc < 1) {
-        *more = (int)more5 || (nprinc > maxn);
+        *more = (int)more5 || (nprinc > 1);
         return(nprinc);
     } 
 
@@ -576,7 +570,7 @@ kerb_get_principal(char *name, char *inst, /* could have wild cards */
      * this routine clears the keyblock's contents for us.
      */
     krb5_db_free_principal(kdc_context, &entries, nprinc);
-    *more = (int) more5 || (nprinc > maxn);
+    *more = (int) more5 || (nprinc > 1);
     return( nprinc);
 }
 
@@ -804,7 +798,7 @@ kerberos_v4(struct sockaddr_in *client, KTEXT pkt)
                req_realm_ptr, req_time_ws, 0, a_name_data.exp_date,
                a_name_data.key_version, ciph);
            krb4_sendto(f, (char *) rpkt->dat, rpkt->length, 0,
-                  (struct sockaddr *) client, S_AD_SZ);
+                  (struct sockaddr *) client, sizeof (struct sockaddr_in));
            memset(&a_name_data, 0, sizeof(a_name_data));
            memset(&s_name_data, 0, sizeof(s_name_data));
            break;
@@ -982,7 +976,7 @@ kerberos_v4(struct sockaddr_in *client, KTEXT pkt)
                                     ad->prealm, time_ws,
                                     0, 0, 0, ciph);
            krb4_sendto(f, (char *) rpkt->dat, rpkt->length, 0,
-                  (struct sockaddr *) client, S_AD_SZ);
+                  (struct sockaddr *) client, sizeof (struct sockaddr_in));
            memset(&s_name_data, 0, sizeof(s_name_data));
            break;
        }
@@ -1028,7 +1022,7 @@ kerb_err_reply(struct sockaddr_in *client, KTEXT pkt, long int err, char *string
     cr_err_reply(e_pkt, req_name_ptr, req_inst_ptr, req_realm_ptr,
                 req_time_ws, err, e_msg);
     krb4_sendto(f, (char *) e_pkt->dat, e_pkt->length, 0,
-          (struct sockaddr *) client, S_AD_SZ);
+          (struct sockaddr *) client, sizeof (struct sockaddr_in));
 
 }
 
@@ -1040,7 +1034,7 @@ check_princ(char *p_name, char *instance, int lifetime, Principal *p,
     static int more;
  /* long trans; */
 
-    n = kerb_get_principal(p_name, instance, p, 1, &more, k5key, 0,
+    n = kerb_get_principal(p_name, instance, p, &more, k5key, 0,
                           issrv, k5life);
     klog(L_ALL_REQ,
         "Principal: \"%s\", Instance: \"%s\" Lifetime = %d n = %d",
@@ -1161,7 +1155,7 @@ set_tgtkey(char *r, krb5_kvno kvno, krb5_boolean use_3des)
 
 /*  log("Getting key for %s", r); */
 
-    n = kerb_get_principal("krbtgt", r, p, 1, &more, &k5key, kvno, 1, NULL);
+    n = kerb_get_principal("krbtgt", r, p, &more, &k5key, kvno, 1, NULL);
     if (n == 0)
        return (KFAILURE);
 
index af5e7d036260fd91d9149f5c023d6b390f0762cf..42c487a2c8951de69bfd5d005d46b32ee3740e2e 100644 (file)
@@ -891,6 +891,36 @@ kill_tcp_connection(struct connection *conn)
     tcp_data_counter--;
 }
 
+static krb5_error_code
+make_toolong_error (krb5_data **out)
+{
+    krb5_error errpkt;
+    krb5_error_code retval;
+    krb5_data *scratch;
+
+    retval = krb5_us_timeofday(kdc_context, &errpkt.stime, &errpkt.susec);
+    if (retval)
+       return retval;
+    errpkt.error = KRB_ERR_FIELD_TOOLONG;
+    errpkt.server = tgs_server;
+    errpkt.client = NULL;
+    errpkt.text.length = 0;
+    errpkt.text.data = 0;
+    errpkt.e_data.length = 0;
+    errpkt.e_data.data = 0;
+    scratch = malloc(sizeof(*scratch));
+    if (scratch == NULL)
+       return ENOMEM;
+    retval = krb5_mk_error(kdc_context, &errpkt, scratch);
+    if (retval) {
+       free(scratch);
+       return retval;
+    }
+
+    *out = scratch;
+    return 0;
+}
+
 static void
 process_tcp_connection(struct connection *conn, const char *prog, int selflags)
 {
@@ -921,7 +951,10 @@ process_tcp_connection(struct connection *conn, const char *prog, int selflags)
        }
        if (conn->u.tcp.sgnum == 0) {
            /* finished sending */
-           /* should go back to reading */
+           /* We should go back to reading, though if we sent a
+              FIELD_TOOLONG error in reply to a length with the high
+              bit set, RFC 4120 says we have to close the TCP
+              stream.  */
            goto kill_tcp_connection;
        }
     } else if (selflags & SSF_READ) {
@@ -953,12 +986,20 @@ process_tcp_connection(struct connection *conn, const char *prog, int selflags)
                                      | (p[2] <<  8)
                                      | p[3]);
                if (conn->u.tcp.msglen > conn->u.tcp.bufsiz - 4) {
+                   krb5_error_code err;
                    /* message too big */
                    krb5_klog_syslog(LOG_ERR, "TCP client %s wants %lu bytes, cap is %lu",
                                     conn->u.tcp.addrbuf, (unsigned long) conn->u.tcp.msglen,
                                     (unsigned long) conn->u.tcp.bufsiz - 4);
                    /* XXX Should return an error.  */
-                   goto kill_tcp_connection;
+                   err = make_toolong_error (&conn->u.tcp.response);
+                   if (err) {
+                       krb5_klog_syslog(LOG_ERR,
+                                        "error constructing KRB_ERR_FIELD_TOOLONG error! %s",
+                                        error_message(err));
+                       goto kill_tcp_connection;
+                   }
+                   goto have_response;
                }
            }
        } else {
@@ -987,6 +1028,7 @@ process_tcp_connection(struct connection *conn, const char *prog, int selflags)
                com_err(prog, err, "while dispatching (tcp)");
                goto kill_tcp_connection;
            }
+       have_response:
            conn->u.tcp.lenbuf[0] = 0xff & (conn->u.tcp.response->length >> 24);
            conn->u.tcp.lenbuf[1] = 0xff & (conn->u.tcp.response->length >> 16);
            conn->u.tcp.lenbuf[2] = 0xff & (conn->u.tcp.response->length >> 8);
index cf2be4947de9e0a2ddc9c163d98bf9494d4f922f..341450cd282f0f5e6d5a8e035d1373e8b6c240df 100755 (executable)
@@ -38,6 +38,7 @@ KDB5_DB_LIB=@KDB5_DB_LIB@
 LDFLAGS='@LDFLAGS@'
 RPATH_FLAG='@RPATH_FLAG@'
 PTHREAD_CFLAGS='@PTHREAD_CFLAGS@'
+DL_LIB='@DL_LIB@'
 
 LIBS='@LIBS@'
 GEN_LIB=@GEN_LIB@
@@ -216,7 +217,7 @@ if test -n "$do_libs"; then
     fi
 
     if test $library = 'krb5'; then
-       lib_flags="$lib_flags -lkrb5 -lk5crypto -lcom_err -lkrb5support $GEN_LIB $LIBS"
+       lib_flags="$lib_flags -lkrb5 -lk5crypto -lcom_err $GEN_LIB $LIBS $DL_LIB"
     fi
 
     echo $lib_flags
index 9393f56bf23272757ed9195e0ce4b6f88e511c99..554abad8b251448ebb9b9cd97a6529725db87329 100644 (file)
@@ -32,8 +32,8 @@ LIBOBJS=$(OUTPRE)daemon.$(OBJEXT)
 SRCS=  $(srcdir)/daemon.c \
        $(srcdir)/dummy.c
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
diff --git a/src/lib/ccapi/NTMakefile b/src/lib/ccapi/NTMakefile
new file mode 100644 (file)
index 0000000..57c42e3
--- /dev/null
@@ -0,0 +1,25 @@
+CD = cd\r
+\r
+all:\r
+       $(CD) common\r
+       $(MAKE) -f NTMakefile all\r
+       $(CD) ../client\r
+       $(MAKE) -f NTMakefile all\r
+       $(CD) ../server\r
+       $(MAKE) -f NTMakefile all\r
+       $(CD) ../windows\r
+       $(MAKE) -f NTMakefile all\r
+       $(CD) ..\r
+\r
+clean:\r
+       $(CD) common\r
+       $(MAKE) -f NTMakefile clean\r
+       $(CD) ../client\r
+       $(MAKE) -f NTMakefile clean\r
+       $(CD) ../server\r
+       $(MAKE) -f NTMakefile clean\r
+       $(CD) ../windows\r
+       $(MAKE) -f NTMakefile clean\r
+       $(CD) ..\r
+\r
+\r
index 09ef9df38b88792a9bd5ae59d716e336ab2007d6..2ce87c35076b335157d943c82dbce69ed490727f 100644 (file)
@@ -1,22 +1,18 @@
 !INCLUDE <WIN32.MAK>
 
-CFLAGS = -I../include
+CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)
 
-CCAPI_OBJS = cacheapi.obj context.obj ccache.obj credentials.obj ccache_iterator.obj \
-             credentials_iterator.obj ccstring.obj marshall.obj msg.obj 
+CC_CLIENT_OBJS = cacheapi.obj context.obj ccache.obj credentials.obj ccache_iterator.obj \
+             credentials_iterator.obj ccstring.obj ccapiv2.obj
 
-CCAPI_LIB = ccapi.lib
-
-$(CCAPI_LIB): $(CCAPI_OBJS)
-        $(implib) /NOLOGO /OUT:$@ $**
-
-CCAPI_DLLFILE = krbcc32.dll
+CC_CLIENT_LIB = cc_client.lib
 
+CC_COMMON_LIB = ..\common\cc_common.lib
 
+$(CC_CLIENT_LIB): $(CC_CLIENT_OBJS)
+        $(implib) /NOLOGO /OUT:$@ $**
 
-$(CCAPI_DLLFILE): $(CCAPI_LIB)
-        $(DLLGUILINK) -def:windows\krbcc32.def
-        $(DLLPREP)
+all: $(CC_CLIENT_LIB)
 
 clean:
         del *.obj *.lib
index 2c874bec0fd70a542a72e8763daa17654d46b37b..89c5e63d1b9cadba729df7829fb9164cb83b1e84 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <CredentialsCache.h>
 #include "ccache.h"
 #include "ccache_iterator.h"
 #include "context.h"
+#include "cc_rpc.h"
 #include "msg.h"
 #include "msg_headers.h"
 
-cc_int32 
+/*! \fn cc_initialize
+ *  \brief A function that initializes a ccapi context for the caller.
+ *  \param[out] outContext a cc_context_t pointer to which is assigned the newly created context upon success.
+ *  \param[in]  inVersion  a cc_int32 that specifies the 
+ */
+
+CCACHE_API cc_int32 
 cc_initialize (        cc_context_t*           outContext,
                 cc_int32               inVersion,
                 cc_int32*              outSupportedVersion,
                 char const**           outVendor)
 {
     static char vendor[128] = "";
-    cc_msg_t     *request;
+    cc_msg_t     *request = NULL;
     ccmsg_init_t *request_header;
-    cc_msg_t     *response;
+    cc_msg_t     *response = NULL;
+    cc_uint32 type;
     ccmsg_init_resp_t *response_header;
     cc_int32 code;
 
     if ((inVersion != ccapi_version_2) &&
          (inVersion != ccapi_version_3) &&
          (inVersion != ccapi_version_4) &&
-         (inVersion != ccapi_version_5)) {
+         (inVersion != ccapi_version_5) &&
+        (inVersion != ccapi_version_6)) {
 
         if (outSupportedVersion != NULL) {
-            *outSupportedVersion = ccapi_version_5;
+            *outSupportedVersion = ccapi_version_6;
         }
         return ccErrBadAPIVersion;
     }   
@@ -78,29 +88,43 @@ cc_initialize (     cc_context_t*           outContext,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    request_header->in_version = inVersion;
+    /* If the version number is 2, the caller will be passing
+     * the structure into the v2 compatibility functions which
+     * in turn will call the v6 functions.  Set the version to
+     * ccapi_version_max since that is what the compatibility 
+     * functions will be expecting.
+     */
+    if (inVersion == ccapi_version_2)
+       inVersion = ccapi_version_max;
+
+    /* Construct the request */
+    request_header->in_version = htonl(inVersion);
 
     code = cci_msg_new(ccmsg_INIT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+               goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_init_t));
+       if (code != ccNoError) 
+               goto cleanup;
+       request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+       if (code != ccNoError)
+               goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_init_resp_t *)response->header;
-        *outSupportedVersion = response_header->out_version;
-        code = cc_context_int_new(outContext, response_header->out_ctx, response_header->out_version);
+        *outSupportedVersion = ntohl(response_header->out_version);
+        code = cc_int_context_new(outContext, ntohll(response_header->out_ctx), ntohl(response_header->out_version));
 
         if (!vendor[0]) {
             char * string;
-            code = cci_msg_retrieve_blob(response, response_header->vendor_offset, response_header->vendor_length, &string);
+            code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);
             strncpy(vendor, string, sizeof(vendor)-1);
             vendor[sizeof(vendor)-1] = '\0';
             free(string);
@@ -111,8 +135,15 @@ cc_initialize (    cc_context_t*           outContext,
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
index 5de3880e4fd1f08e2acd7e5d7a432d34b6e84415..07e9b8e8790235042705aee79ca98304bc88fb6c 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <CredentialsCache.h>
 #include "credentials.h"
+#include "credentials_iterator.h"
 #include "ccache.h"
+#include "cc_rpc.h"
 #include "msg.h"
 #include "msg_headers.h"
+#include "ccstring.h"
+
+/* 
+ * cc_int_ccache_new
+ *
+ * Input parameters in host order.
+ */
 
 cc_int32
 cc_int_ccache_new( cc_ccache_t * pccache, cc_handle hctx, cc_handle hccache )
@@ -97,11 +107,12 @@ cc_int_ccache_new( cc_ccache_t * pccache, cc_handle hctx, cc_handle hccache )
 cc_int32    
 cc_int_ccache_release( cc_ccache_t ccache )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_release_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_release_t     *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -114,30 +125,41 @@ cc_int_ccache_release( cc_ccache_t ccache )
     request_header = (ccmsg_ccache_release_t*)malloc(sizeof(ccmsg_ccache_release_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_RELEASE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+        goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_release_t));
+    if (code != ccNoError)
+        goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+        goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
-    free(int_ccache->functions);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
+    if (int_ccache->functions)
+       free(int_ccache->functions);
     free(int_ccache);
     return code;
 }
@@ -146,11 +168,12 @@ cc_int_ccache_release( cc_ccache_t ccache )
 cc_int32    
 cc_int_ccache_destroy( cc_ccache_t ccache )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_destroy_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_destroy_t     *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -163,29 +186,39 @@ cc_int_ccache_destroy( cc_ccache_t ccache )
     request_header = (ccmsg_ccache_destroy_t*)malloc(sizeof(ccmsg_ccache_destroy_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_DESTROY, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_destroy_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     free(ccache);
     return code;
 }
@@ -194,11 +227,12 @@ cc_int_ccache_destroy( cc_ccache_t ccache )
 cc_int32
 cc_int_ccache_set_default( cc_ccache_t ccache )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_set_default_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t                    int_ccache;
+    cc_msg_t                           *request = NULL;
+    ccmsg_ccache_set_default_t                 *request_header = NULL;
+    cc_msg_t                           *response = NULL;
+    cc_uint32                          type;
+    cc_int32                           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -211,29 +245,39 @@ cc_int_ccache_set_default( cc_ccache_t ccache )
     request_header = (ccmsg_ccache_set_default_t*)malloc(sizeof(ccmsg_ccache_set_default_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_SET_DEFAULT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_default_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -241,11 +285,12 @@ cc_int32
 cc_int_ccache_get_credentials_version( cc_ccache_t ccache,
                                    cc_uint32* credentials_version)
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_creds_version_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_get_creds_version_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -258,43 +303,53 @@ cc_int_ccache_get_credentials_version( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_creds_version_t*)malloc(sizeof(ccmsg_ccache_get_creds_version_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_CREDS_VERSION, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_creds_version_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_get_creds_version_resp_t * response_header = (ccmsg_ccache_get_creds_version_resp_t*)response->header;
-        *credentials_version = response_header->version;
+        *credentials_version = ntohl(response_header->version);
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32
-cc_int_ccache_get_name( cc_ccache_t ccache,
-                    cc_string_t* name )
+cc_int_ccache_get_name( cc_ccache_t ccache, cc_string_t* name )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_name_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_get_name_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -307,36 +362,46 @@ cc_int_ccache_get_name( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_name_t*)malloc(sizeof(ccmsg_ccache_get_name_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_NAME, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_name_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         char * string;
         ccmsg_ccache_get_name_resp_t * response_header = (ccmsg_ccache_get_name_resp_t*)response->header;
         code = cci_msg_retrieve_blob(response, response_header->name_offset, 
                                       response_header->name_len, &string);
         if (code == ccNoError) {
-            code = cc_string_new(&name, string);
+            code = cci_string_new(name, string);
             free(string);
         }
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -345,11 +410,12 @@ cc_int_ccache_get_principal( cc_ccache_t ccache,
                         cc_uint32 credentials_version,
                         cc_string_t* principal )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_principal_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_get_principal_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -362,37 +428,47 @@ cc_int_ccache_get_principal( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_principal_t*)malloc(sizeof(ccmsg_ccache_get_principal_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->version = credentials_version;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->version = htonl(credentials_version);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_PRINCIPAL, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_principal_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         char * string;
         ccmsg_ccache_get_principal_resp_t * response_header = (ccmsg_ccache_get_principal_resp_t*)response->header;
         code = cci_msg_retrieve_blob(response, response_header->principal_offset, 
                                       response_header->principal_len, &string);
         if (code == ccNoError) {
-            code = cc_string_new(&principal, string);
+            code = cci_string_new(principal, string);
             free(string);
         }
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -401,12 +477,13 @@ cc_int_ccache_set_principal( cc_ccache_t ccache,
                          cc_uint32 credentials_version,
                          const char* principal )
 {
-    cc_uint32   blob_pos;
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_set_principal_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_uint32          blob_pos;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_set_principal_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -419,40 +496,47 @@ cc_int_ccache_set_principal( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_set_principal_t*)malloc(sizeof(ccmsg_ccache_set_principal_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->version = credentials_version;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->version = htonl(credentials_version);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_PRINCIPAL, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_data_blob(request, (void*)principal, strlen(principal) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
     
-    request_header->principal_offset = blob_pos;
-    request_header->principal_len = strlen(principal) + 1;
+    request_header->principal_offset = htonl(blob_pos);
+    request_header->principal_len = htonl(strlen(principal) + 1);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_principal_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -460,11 +544,12 @@ cc_int32
 cc_int_ccache_new_credentials_iterator( cc_ccache_t ccache,
                                         cc_credentials_iterator_t* iterator )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_creds_iterator_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_creds_iterator_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -477,30 +562,41 @@ cc_int_ccache_new_credentials_iterator( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_creds_iterator_t*)malloc(sizeof(ccmsg_ccache_creds_iterator_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
-    code = cci_msg_new(ccmsg_CCACHE_CREDS_ITERATOR, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CCACHE_NEW_CREDS_ITERATOR, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_creds_iterator_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_creds_iterator_resp_t * response_header = (ccmsg_ccache_creds_iterator_resp_t*)response->header;
-        code = cc_int_credentials_iterator_new(iterator, response_header->iterator);
+        code = cc_int_credentials_iterator_new(iterator, int_ccache->ctx, int_ccache->handle,
+                                               ntohll(response_header->iterator));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -508,14 +604,15 @@ cc_int32
 cc_int_ccache_store_credentials( cc_ccache_t ccache,
                              const cc_credentials_union* credentials )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_store_creds_t *request_header;
-    cc_msg_t        *response;
-    char            *flat_cred = 0;
-    cc_uint32       flat_cred_len = 0;
-    cc_uint32       blob_pos;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_store_creds_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    char               *flat_cred = 0;
+    cc_uint32          flat_cred_len = 0;
+    cc_uint32          blob_pos;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL || credentials == NULL )
         return ccErrBadParam;
@@ -528,14 +625,12 @@ cc_int_ccache_store_credentials( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_store_creds_t*)malloc(sizeof(ccmsg_ccache_store_creds_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_STORE_CREDS, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     switch ( credentials->version ) {
     case cc_credentials_v4:
@@ -545,42 +640,47 @@ cc_int_ccache_store_credentials( cc_ccache_t ccache,
         code = cci_creds_v5_marshall(credentials->credentials.credentials_v5, &flat_cred, &flat_cred_len);
         break;
     default:
-        cci_msg_destroy(request);
-        free(request_header);
-        return ccErrBadCredentialsVersion;
-    }
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
+        code = ccErrBadCredentialsVersion;
     }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_data_blob(request, (void*)flat_cred, flat_cred_len, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
     
-    request_header->creds_version = credentials->version;
-    request_header->creds_offset = blob_pos;
-    request_header->creds_len = flat_cred_len;
+    request_header->creds_version = htonl(credentials->version);
+    request_header->creds_offset = htonl(blob_pos);
+    request_header->creds_len = htonl(flat_cred_len);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_store_creds_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    free(flat_cred);
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (flat_cred)
+       free(flat_cred);
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -588,12 +688,13 @@ cc_int32
 cc_int_ccache_remove_credentials( cc_ccache_t ccache,
                               cc_credentials_t credentials )
 {
-    cc_int_ccache_t int_ccache;
-    cc_int_credentials_t  int_creds;
-    cc_msg_t        *request;
-    ccmsg_ccache_rem_creds_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_int_credentials_t       int_creds;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_rem_creds_t   *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL || credentials == NULL )
         return ccErrBadParam;
@@ -611,30 +712,40 @@ cc_int_ccache_remove_credentials( cc_ccache_t ccache,
     if (request_header == NULL)
         return ccErrNoMem;
     
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->creds  = int_creds->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->creds  = htonll(int_creds->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_REM_CREDS, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_rem_creds_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -643,12 +754,13 @@ cc_int32
 cc_int_ccache_move( cc_ccache_t source,
                     cc_ccache_t destination )
 {
-    cc_int_ccache_t int_ccache_source;
-    cc_int_ccache_t int_ccache_dest;
-    cc_msg_t        *request;
-    ccmsg_ccache_move_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache_source;
+    cc_int_ccache_t    int_ccache_dest;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_move_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( source == NULL || destination == NULL )
         return ccErrBadParam;
@@ -668,29 +780,39 @@ cc_int_ccache_move( cc_ccache_t source,
         return ccErrNoMem;
 
     code = cci_msg_new(ccmsg_CCACHE_MOVE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_ccache_source->ctx;
-    request_header->ccache_source = int_ccache_source->handle;
-    request_header->ccache_dest = int_ccache_dest->handle;
+    request_header->ctx = htonll(int_ccache_source->ctx);
+    request_header->ccache_source = htonll(int_ccache_source->handle);
+    request_header->ccache_dest = htonll(int_ccache_dest->handle);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_move_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }       
 
@@ -698,14 +820,16 @@ cc_int_ccache_lock( cc_ccache_t ccache,
                 cc_uint32 lock_type,
                 cc_uint32 block )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_lock_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_lock_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL || 
-         (lock_type != cc_lock_read && lock_type != cc_lock_write) ||
+         (lock_type != cc_lock_read && lock_type != cc_lock_write &&
+         lock_type != cc_lock_upgrade && lock_type != cc_lock_downgrade) ||
          (block != cc_lock_block && block != cc_lock_noblock) )
         return ccErrBadParam;
 
@@ -719,22 +843,26 @@ cc_int_ccache_lock( cc_ccache_t ccache,
         return ccErrNoMem;
 
     code = cci_msg_new(ccmsg_CCACHE_LOCK, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->lock_type;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->lock_type = htonl(lock_type);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_lock_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
+        code = ntohl(nack_header->err_code);
 
         // TODO: if (block == cc_lock_block) .....
     } else if (response->type == ccmsg_ACK) {
@@ -742,19 +870,26 @@ cc_int_ccache_lock( cc_ccache_t ccache,
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32
 cc_int_ccache_unlock( cc_ccache_t ccache )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_unlock_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_unlock_t      *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -769,41 +904,53 @@ cc_int_ccache_unlock( cc_ccache_t ccache )
         return ccErrNoMem;
 
     code = cci_msg_new(ccmsg_CCACHE_UNLOCK, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_unlock_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = htonl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = htonl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 
 cc_int32
 cc_int_ccache_get_last_default_time( cc_ccache_t ccache,
-                                     cc_time_t* time_offset )
+                                     cc_time* time_offset )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_last_default_time_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_get_last_default_time_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_time64                  t64;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -816,43 +963,56 @@ cc_int_ccache_get_last_default_time( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_last_default_time_t*)malloc(sizeof(ccmsg_ccache_get_last_default_time_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_LAST_DEFAULT_TIME, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_last_default_time_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_get_last_default_time_resp_t * response_header = (ccmsg_ccache_get_last_default_time_resp_t*)response->header;
-        *time_offset = response_header->last_default_time;
-        code = ccNoError;
+        t64 = ntohll(response_header->last_default_time);
+       /* TODO: validate that we do not overflow the max value of time_offset */
+        *time_offset = t64;
+       code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32
-cc_int_ccache_get_change_time( cc_ccache_t ccache,
-                           cc_time_t* time )
+cc_int_ccache_get_change_time( cc_ccache_t ccache, cc_time* time )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_change_time_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_get_change_time_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_time64          t64;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -865,31 +1025,43 @@ cc_int_ccache_get_change_time( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_change_time_t*)malloc(sizeof(ccmsg_ccache_get_change_time_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_CHANGE_TIME, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_change_time_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_get_change_time_resp_t * response_header = (ccmsg_ccache_get_change_time_resp_t*)response->header;
-        *time = response_header->time;
+        t64 = htonll(response_header->time);
+       /* TODO: validate that we do not overflow 'time' */
+       *time = t64;
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -898,12 +1070,13 @@ cc_int_ccache_compare( cc_ccache_t ccache,
                    cc_ccache_t compare_to,
                    cc_uint32* equal )
 {
-    cc_int_ccache_t int_ccache;
-    cc_int_ccache_t int_compare_to;
-    cc_msg_t        *request;
-    ccmsg_ccache_compare_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_int_ccache_t            int_compare_to;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_compare_t     *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -918,45 +1091,56 @@ cc_int_ccache_compare( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_compare_t*)malloc(sizeof(ccmsg_ccache_compare_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache1 = int_ccache->handle;
-    request_header->ccache2 = int_compare_to->handle;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache1 = htonll(int_ccache->handle);
+    request_header->ccache2 = htonll(int_compare_to->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_COMPARE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_compare_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_compare_resp_t * response_header = (ccmsg_ccache_compare_resp_t*)response->header;
-        *equal = response_header->is_equal;
+        *equal = ntohl(response_header->is_equal);
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32       
 cc_int_ccache_get_kdc_time_offset( cc_ccache_t ccache,
                                cc_int32        credentials_version,
-                               cc_time_t*      time_offset )
+                               cc_time*        time_offset )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_get_kdc_time_offset_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t            int_ccache;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_get_kdc_time_offset_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -969,45 +1153,57 @@ cc_int_ccache_get_kdc_time_offset( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_get_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_get_kdc_time_offset_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->creds_version = credentials_version;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->creds_version = htonl(credentials_version);
 
     code = cci_msg_new(ccmsg_CCACHE_GET_KDC_TIME_OFFSET, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_kdc_time_offset_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
+        code = ntohl(nack_header->err_code);
     } else if (response->type == ccmsg_ACK) {
         ccmsg_ccache_get_kdc_time_offset_resp_t * response_header = (ccmsg_ccache_get_kdc_time_offset_resp_t*)response->header;
-        *time_offset = response_header->offset;
+        *time_offset = (cc_time64)ntohll(response_header->offset);
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32
 cc_int_ccache_set_kdc_time_offset( cc_ccache_t ccache,
                                cc_int32        credentials_version,
-                               cc_time_t       time_offset )
+                               cc_time time_offset )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_set_kdc_time_offset_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_set_kdc_time_offset_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_int64           t64;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -1020,30 +1216,42 @@ cc_int_ccache_set_kdc_time_offset( cc_ccache_t ccache,
     request_header = (ccmsg_ccache_set_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_set_kdc_time_offset_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->creds_version = credentials_version;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->creds_version = htonl(credentials_version);
+    t64 = time_offset;
+    request_header->offset = htonll(t64);
 
     code = cci_msg_new(ccmsg_CCACHE_SET_KDC_TIME_OFFSET, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_kdc_time_offset_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
                                 
@@ -1051,11 +1259,12 @@ cc_int32
 cc_int_ccache_clear_kdc_time_offset( cc_ccache_t       ccache,
                                  cc_int32      credentials_version )
 {
-    cc_int_ccache_t int_ccache;
-    cc_msg_t        *request;
-    ccmsg_ccache_clear_kdc_time_offset_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_t    int_ccache;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_clear_kdc_time_offset_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -1068,31 +1277,39 @@ cc_int_ccache_clear_kdc_time_offset( cc_ccache_t        ccache,
     request_header = (ccmsg_ccache_clear_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_clear_kdc_time_offset_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_ccache->ctx;
-    request_header->ccache = int_ccache->handle;
-    request_header->creds_version = credentials_version;
+    request_header->ctx = htonll(int_ccache->ctx);
+    request_header->ccache = htonll(int_ccache->handle);
+    request_header->creds_version = htonl(credentials_version);
 
     code = cci_msg_new(ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_clear_kdc_time_offset_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
-
-
index e3b3993ee0f92910df8631a16a109396eced2df8..0a92ebf63d3beed4b1522efd2397428d1f157472 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -114,11 +114,11 @@ cc_int_ccache_unlock( cc_ccache_t ccache );
 
 cc_int32
 cc_int_ccache_get_last_default_time( cc_ccache_t ccache,
-                                cc_time_t* time );
+                                cc_time* time );
 
 cc_int32
 cc_int_ccache_get_change_time( cc_ccache_t ccache,
-                          cc_time_t* time );
+                          cc_time* time );
 
 cc_int32
 cc_int_ccache_compare( cc_ccache_t ccache,
@@ -128,12 +128,12 @@ cc_int_ccache_compare( cc_ccache_t ccache,
 cc_int32       
 cc_int_ccache_get_kdc_time_offset( cc_ccache_t ccache,
                               cc_int32 credentials_version,
-                              cc_time_t*       time_offset );
+                              cc_time* time_offset );
 
 cc_int32
 cc_int_ccache_set_kdc_time_offset( cc_ccache_t ccache,
                               cc_int32 credentials_version,
-                              cc_time_t        time_offset );
+                              cc_time  time_offset );
                                 
 cc_int32
 cc_int_ccache_clear_kdc_time_offset( cc_ccache_t       ccache,
index 03266b1bbe2eba6ba2a2cf5e05c3c67ec317bcbd..3da9b35478d04072c2178584de3686ba8befdab6 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -46,7 +46,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <CredentialsCache.h>
+#include "ccache.h"
 #include "ccache_iterator.h"
+#include "cc_rpc.h"
 #include "msg.h"
 #include "msg_headers.h"
 
@@ -56,7 +58,7 @@ cc_int_ccache_iterator_new( cc_ccache_iterator_t * piter,
                             cc_handle ctx,
                             cc_handle handle )
 {
-    cc_int_ccache_iterator_t iter;
+    cc_int_ccache_iterator_t iter = NULL;
 
     if ( piter == NULL )
         return ccErrBadParam;
@@ -66,7 +68,7 @@ cc_int_ccache_iterator_new( cc_ccache_iterator_t * piter,
         return ccErrNoMem;
 
     iter->functions = (cc_ccache_iterator_f*)malloc( sizeof(cc_ccache_iterator_f));
-    if ( iter->functions ) {
+    if ( iter->functions == NULL ) {
         free(iter);
         return ccErrNoMem;
     }
@@ -84,11 +86,12 @@ cc_int_ccache_iterator_new( cc_ccache_iterator_t * piter,
 cc_int32
 cc_int_ccache_iterator_release( cc_ccache_iterator_t iter )
 {
-    cc_int_ccache_iterator_t int_iter;
-    cc_msg_t        *request;
-    ccmsg_ccache_iterator_release_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_iterator_t   int_iter;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_iterator_release_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
 
     if ( iter == NULL )
@@ -102,31 +105,43 @@ cc_int_ccache_iterator_release( cc_ccache_iterator_t iter )
     request_header = (ccmsg_ccache_iterator_release_t*)malloc(sizeof(ccmsg_ccache_iterator_release_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_iter->ctx;
-    request_header->iterator = int_iter->handle;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->iterator = htonll(int_iter->handle);
     code = cci_msg_new(ccmsg_CCACHE_ITERATOR_RELEASE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_release_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
 
-    free(int_iter->functions);
-    free(int_iter);
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
+
+    if (int_iter->functions)
+       free(int_iter->functions);
+    if (iter)
+       free(int_iter);
     return ccNoError;
 }
 
@@ -134,11 +149,12 @@ cc_int32
 cc_int_ccache_iterator_next( cc_ccache_iterator_t iter,
                              cc_ccache_t * ccache )
 {
-    cc_int_ccache_iterator_t int_iter;
-    cc_msg_t        *request;
-    ccmsg_ccache_iterator_next_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_ccache_iterator_t   int_iter;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_iterator_next_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( ccache == NULL )
         return ccErrBadParam;
@@ -151,29 +167,98 @@ cc_int_ccache_iterator_next( cc_ccache_iterator_t iter,
     request_header = (ccmsg_ccache_iterator_next_t*)malloc(sizeof(ccmsg_ccache_iterator_next_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_iter->ctx;
-    request_header->iterator = int_iter->handle;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->iterator = htonll(int_iter->handle);
 
     code = cci_msg_new(ccmsg_CCACHE_ITERATOR_NEXT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_next_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
         code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+    } else if (type == ccmsg_ACK) {
         ccmsg_ccache_iterator_next_resp_t * response_header = (ccmsg_ccache_iterator_next_resp_t*)response->header;
-        code = cc_ccache_new(ccache, int_iter->ctx, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_iter->ctx, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+    
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
+    return code;
+}
+
+cc_int32
+cc_int_ccache_iterator_clone( cc_ccache_iterator_t iter,
+                              cc_ccache_iterator_t * new_iter )
+{
+    cc_int_ccache_iterator_t   int_iter;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ccache_iterator_clone_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
+
+    if ( iter == NULL || new_iter == NULL )
+        return ccErrBadParam;
+
+    int_iter = (cc_int_ccache_iterator_t)iter;
+
+    if ( int_iter->magic != CC_CCACHE_ITER_MAGIC )
+        return ccErrInvalidCCacheIterator;
+
+    request_header = (ccmsg_ccache_iterator_clone_t*)malloc(sizeof(ccmsg_ccache_iterator_clone_t));
+    if (request_header == NULL)
+        return ccErrNoMem;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->iterator = htonll(int_iter->handle);
+
+    code = cci_msg_new(ccmsg_CCACHE_ITERATOR_CLONE, &request);
+    if (code != ccNoError)
+       goto cleanup;
+
+    code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_clone_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
+
+    code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
+
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
+        ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
+        ccmsg_ccache_iterator_clone_resp_t * response_header = (ccmsg_ccache_iterator_clone_resp_t*)response->header;
+        code = cc_int_ccache_iterator_new(new_iter, int_iter->ctx, ntohll(response_header->iterator));
+    } else {
+        code = ccErrBadInternalMessage;
+    }
+
+  cleanup:
+    if (request_header)
+       free(request);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
index c55d72ee67de716bbf471b2b9911f2af44d940fb..5a390b82ed80827af83f10fcd5b604a799001fe6 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -73,6 +73,10 @@ cc_int32
 cc_int_ccache_iterator_next( cc_ccache_iterator_t iter,
                              cc_ccache_t * ccache );
 
+cc_int32
+cc_int_ccache_iterator_clone( cc_ccache_iterator_t iter,
+                              cc_ccache_iterator_t * iter_new );
+
 cc_int32
 cc_int_ccache_iterator_set_repeat_count( cc_int_ccache_iterator_t iter, 
                                          cc_uint32 count );
diff --git a/src/lib/ccapi/client/ccapiv2.c b/src/lib/ccapi/client/ccapiv2.c
new file mode 100644 (file)
index 0000000..82b04c2
--- /dev/null
@@ -0,0 +1,295 @@
+/* $Copyright:\r
+ *\r
+ * Copyright 1998-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+/*\r
+ * This is backwards compatibility for CCache API v2 clients to be able to run \r
+ * against the CCache API v3 library\r
+ */\r
\r
+#include "CredentialsCache2.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+CCACHE_API cc_int32 cc_shutdown (\r
+        apiCB**                                ioContext)\r
+{\r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_get_NC_info (\r
+       apiCB*                          inContext,\r
+       infoNC***                       outInfo)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_get_change_time (\r
+       apiCB*                          inContext,\r
+       cc_time*                        outTime)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_open (\r
+       apiCB*                          inContext,\r
+       const char*                     inName,\r
+       cc_int32                        inVersion,\r
+       cc_uint32                       inFlags,\r
+       ccache_p**                      outCCache)\r
+{\r
+    if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
+       return CC_ERR_CRED_VERSION;\r
+\r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_create (\r
+       apiCB*                          inContext,\r
+       const char*                     inName,\r
+       const char*                     inPrincipal,\r
+       cc_int32                        inVersion,\r
+       cc_uint32                       inFlags,\r
+       ccache_p**                      outCCache)\r
+{\r
+    if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
+       return CC_ERR_CRED_VERSION;\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_close (\r
+       apiCB*                          inContext,\r
+       ccache_p**                      ioCCache)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_destroy (\r
+       apiCB*                          inContext,\r
+       ccache_p**                      ioCCache)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_seq_fetch_NCs_begin (\r
+       apiCB*                          inContext,\r
+       ccache_cit**                    outIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_seq_fetch_NCs_next (\r
+       apiCB*                          inContext,\r
+       ccache_p**                      outCCache,\r
+       ccache_cit*                     inIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_seq_fetch_NCs_end (\r
+       apiCB*                          inContext,\r
+       ccache_cit**                    ioIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_get_name (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       char**                          outName)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_get_cred_version (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       cc_int32*                       outVersion)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_set_principal (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       cc_int32                        inVersion,\r
+       char*                           inPrincipal)\r
+{\r
+    if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
+       return CC_ERR_CRED_VERSION;\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_get_principal (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       char**                          outPrincipal)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_store (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       cred_union                      inCredentials)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_remove_cred (\r
+       apiCB*                          inContext,\r
+       ccache_p*                       inCCache,\r
+       cred_union                      inCredentials)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_seq_fetch_creds_begin (\r
+       apiCB*                          inContext,\r
+       const ccache_p*                 inCCache,\r
+       ccache_cit**                    outIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_seq_fetch_creds_next (\r
+       apiCB*                          inContext,\r
+       cred_union**                    outCreds,\r
+       ccache_cit*                     inIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_seq_fetch_creds_end (\r
+       apiCB*                          inContext,\r
+       ccache_cit**                    ioIterator)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+       \r
+CCACHE_API cc_int32 cc_free_principal (\r
+       apiCB*                          inContext,\r
+       char**                          ioPrincipal)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_free_name (\r
+       apiCB*                          inContext,\r
+       char**                          ioName)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_free_creds (\r
+       apiCB*                          inContext,\r
+       cred_union**                    creds)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_free_NC_info (\r
+       apiCB*                          inContext,\r
+       infoNC***                       ioInfo)\r
+{\r
+       \r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+CCACHE_API cc_int32 cc_lock_request(\r
+        apiCB*                                 inContext,\r
+        const ccache_p*                inCCache,\r
+        const cc_int32                         lock_type)\r
+{\r
+    /* replace this return value when the function is implemented */\r
+    return CC_NOT_SUPP;\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
index 419bfef7728466d6654404f6351bf86b7c352f70..6f3fa2bcbf67539356acdd9becde9c3b58ee17de 100644 (file)
@@ -50,9 +50,9 @@
 #include "ccstring.h"
 
 cc_int32
-cc_int_string_new( cc_string_t * pstring, char * data )
+cci_string_new( cc_string_t * pstring, char * data )
 {
-    cc_int_string_t string = (cc_int_string_t)malloc(sizeof(cc_int_string_d));
+    cci_string_t string = (cci_string_t)malloc(sizeof(cci_string_d));
     if ( string == NULL )
         return ccErrNoMem;
 
@@ -63,7 +63,7 @@ cc_int_string_new( cc_string_t * pstring, char * data )
     }
 
     string->magic = CC_STRING_MAGIC;
-    string->functions->release = cc_int_string_release;
+    string->functions->release = cci_string_release;
 
     string->data = strdup(data);
     if ( string->data == NULL ) {
@@ -77,13 +77,13 @@ cc_int_string_new( cc_string_t * pstring, char * data )
 }
 
 cc_int32
-cc_int_string_release( cc_string_t str )
+cci_string_release( cc_string_t str )
 {
-    cc_int_string_t int_string;
+    cci_string_t int_string;
     if ( str == NULL )
         return ccErrBadParam;
 
-    int_string = (cc_int_string_t)str;
+    int_string = (cci_string_t)str;
     if ( int_string->magic != CC_STRING_MAGIC )
         return ccErrInvalidString;
 
index 9e0ad223f5a23fbcc17cf72279766b0e68d5f6cd..2c973afbb5d9a66bcd10c3e61d2f07f789b9dc5e 100644 (file)
@@ -45,7 +45,7 @@
 
 #define CC_STRING_MAGIC ('S'<<24 | 'T'<<16 | 'R'<<8 | 'I')
 
-struct cc_int_string_d {
+struct cci_string_d {
     char*         data;
     cc_string_f*  functions;
 #if TARGET_OS_MAC
@@ -53,13 +53,13 @@ struct cc_int_string_d {
 #endif
     cc_uint32           magic;
 };
-typedef struct cc_int_string_d cc_int_string_d;
-typedef cc_int_string_d*    cc_int_string_t;
+typedef struct cci_string_d cci_string_d;
+typedef cci_string_d*    cci_string_t;
 
 cc_int32
-cc_int_string_new( cc_string_t * pstring, char * data );
+cci_string_new( cc_string_t * pstring, char * data );
 
 cc_int32
-cc_int_string_release( cc_string_t string );
+cci_string_release( cc_string_t string );
 
 
index 86c41b8e7018671bba982f9d4c989bb05490af96..5d88d4686823763202d4a1c592d539ff304181cd 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <CredentialsCache.h>
 #include "context.h"
+#include "ccache.h"
+#include "ccache_iterator.h"
+#include "cc_rpc.h"
 #include "msg.h"
 #include "msg_headers.h"
+#include "ccstring.h"
+
+/* cc_int_context_new
+ *
+ * input parameters (handle, version) are in host order 
+ */
 
 cc_int32
 cc_int_context_new( cc_context_t * pcontext, cc_handle handle, cc_uint32 version )
@@ -87,11 +97,12 @@ cc_int_context_new( cc_context_t * pcontext, cc_handle handle, cc_uint32 version
 cc_int32    
 cc_int_context_release( cc_context_t context )
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_release_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_release_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL )
         return ccErrBadParam;
@@ -104,28 +115,38 @@ cc_int_context_release( cc_context_t context )
     request_header = (ccmsg_ctx_release_t*)malloc(sizeof(ccmsg_ctx_release_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_new(ccmsg_CTX_RELEASE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_release_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       request_header = NULL;
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     free(int_context->functions);
     free(int_context);
     return code;
@@ -133,14 +154,16 @@ cc_int_context_release( cc_context_t context )
 
 cc_int32
 cc_int_context_get_change_time( cc_context_t context,
-                                cc_time_t* time)
+                                cc_time* time)
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_get_change_time_t *request_header;
-    cc_msg_t        *response;
+    cc_int_context_t           int_context;
+    cc_msg_t                   *request = NULL;
+    ccmsg_ctx_get_change_time_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
     ccmsg_ctx_get_change_time_resp_t *response_header;
-    cc_int32 code;
+    cc_time64          t64;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( context == NULL || time == NULL )
         return ccErrBadParam;
@@ -153,30 +176,42 @@ cc_int_context_get_change_time( cc_context_t context,
     request_header = (ccmsg_ctx_get_change_time_t*)malloc(sizeof(ccmsg_ctx_get_change_time_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_new(ccmsg_CTX_GET_CHANGE_TIME, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_get_change_time_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
+        code = ntohl(nack_header->err_code);
     } else if (response->type == ccmsg_ACK) {
         response_header = (ccmsg_ctx_get_change_time_resp_t*)response->header;
-        *time = response_header->time;
+        t64 = ntohll(response_header->time);
+       /* TODO: validate that value is not greater than can fit in cc_time */
+       *time = (cc_time)t64;
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -184,12 +219,14 @@ cc_int32
 cc_int_context_get_default_ccache_name( cc_context_t context,
                                         cc_string_t* name )
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_get_default_ccache_name_t *request_header;
-    cc_msg_t        *response;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_get_default_ccache_name_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ctx_get_default_ccache_name_resp_t *response_header;
-    cc_int32 code;
+    char               *string = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || name == NULL )
         return ccErrBadParam;
@@ -202,35 +239,44 @@ cc_int_context_get_default_ccache_name( cc_context_t context,
     request_header = (ccmsg_ctx_get_default_ccache_name_t*)malloc(sizeof(ccmsg_ctx_get_default_ccache_name_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_new(ccmsg_CTX_GET_DEFAULT_CCACHE_NAME, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_get_default_ccache_name_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
-        char * string;
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ctx_get_default_ccache_name_resp_t*)response->header;
         code = cci_msg_retrieve_blob(response, response_header->name_offset, 
                                      response_header->name_len, &string);
-        if (code == ccNoError) {
-            code = cc_string_new(&name, string);
-            free(string);
-        }
+        if (code == ccNoError)
+            code = cci_string_new(name, string);
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (string)
+       free(string);
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -240,11 +286,12 @@ cc_int_context_compare( cc_context_t context,
                         cc_uint32* equal )
 {
     cc_int_context_t int_context, int_compare_to;
-    cc_msg_t        *request;
-    ccmsg_ctx_compare_t *request_header;
-    cc_msg_t        *response;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_compare_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ctx_compare_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || compare_to == NULL || 
          equal == NULL )
@@ -260,31 +307,41 @@ cc_int_context_compare( cc_context_t context,
     request_header = (ccmsg_ctx_compare_t*)malloc(sizeof(ccmsg_ctx_compare_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx1 = int_context->handle;
-    request_header->ctx2 = int_compare_to->handle;
+    request_header->ctx1 = htonll(int_context->handle);
+    request_header->ctx2 = htonll(int_compare_to->handle);
 
     code = cci_msg_new(ccmsg_CTX_COMPARE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_compare_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ctx_compare_resp_t*)response->header;
-        *equal = response_header->is_equal;
+        *equal = ntohl(response_header->is_equal);
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -293,12 +350,13 @@ cc_int32
 cc_int_context_new_ccache_iterator( cc_context_t context,
                                     cc_ccache_iterator_t* iterator )
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_new_ccache_iterator_t *request_header;
-    cc_msg_t        *response;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_new_ccache_iterator_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ctx_new_ccache_iterator_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || iterator == NULL )
         return ccErrBadParam;
@@ -311,29 +369,40 @@ cc_int_context_new_ccache_iterator( cc_context_t context,
     request_header = (ccmsg_ctx_new_ccache_iterator_t*)malloc(sizeof(ccmsg_ctx_new_ccache_iterator_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_new(ccmsg_CTX_NEW_CCACHE_ITERATOR, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_new_ccache_iterator_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ctx_new_ccache_iterator_resp_t*)response->header;
-        code = cc_int_ccache_iterator_new(iterator, int_context->handle, response_header->iterator);
+        code = cc_int_ccache_iterator_new(iterator, int_context->handle,
+                                          ntohll(response_header->iterator));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -342,13 +411,14 @@ cc_int_context_open_ccache( cc_context_t context,
                             const char* name,
                             cc_ccache_t* ccache )
 {
-    cc_uint32 blob_pos;
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ccache_open_t *request_header;
-    cc_msg_t        *response;
+    cc_uint32          blob_pos;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_open_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ccache_open_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || name == NULL || ccache == NULL )
         return ccErrBadParam;
@@ -362,38 +432,45 @@ cc_int_context_open_ccache( cc_context_t context,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    code = cci_msg_new(ccmsg_CCACHE_OPEN, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CTX_CCACHE_OPEN, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_data_blob(request, (void *)name, strlen(name) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
     
-    request_header->ctx = int_context->handle;
-    request_header->name_offset = blob_pos;
-    request_header->name_len = strlen(name) + 1;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->name_offset = htonl(blob_pos);
+    request_header->name_len = htonl(strlen(name) + 1);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_open_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ccache_open_resp_t*)response->header;
-        code = cc_cache_new(ccache, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -401,12 +478,13 @@ cc_int32
 cc_int_context_open_default_ccache( cc_context_t context,
                                     cc_ccache_t* ccache)
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ccache_open_default_t *request_header;
-    cc_msg_t        *response;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_open_default_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ccache_open_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || ccache == NULL )
         return ccErrBadParam;
@@ -420,29 +498,39 @@ cc_int_context_open_default_ccache( cc_context_t context,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    code = cci_msg_new(ccmsg_CCACHE_OPEN_DEFAULT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CTX_CCACHE_OPEN_DEFAULT, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_open_default_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ccache_open_resp_t*)response->header;
-        code = cc_cache_new(ccache, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+    
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -453,13 +541,14 @@ cc_int_context_create_ccache( cc_context_t context,
                               const char* principal, 
                               cc_ccache_t* ccache )
 {
-    cc_uint32 blob_pos;
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ccache_create_t *request_header;
-    cc_msg_t        *response;
+    cc_uint32          blob_pos;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_create_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ccache_create_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || name == NULL || 
          cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
@@ -475,48 +564,53 @@ cc_int_context_create_ccache( cc_context_t context,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    code = cci_msg_new(ccmsg_CCACHE_CREATE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_data_blob(request, (void *)name, strlen(name) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
     
-    request_header->ctx = int_context->handle;
-    request_header->version = cred_vers;
-    request_header->name_offset = blob_pos;
-    request_header->name_len = strlen(name) + 1;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->version = htonl(cred_vers);
+    request_header->name_offset = htonl(blob_pos);
+    request_header->name_len = htonl(strlen(name) + 1);
 
     code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
-    request_header->principal_offset = blob_pos;
-    request_header->principal_len = strlen(principal) + 1;
+    if (code != ccNoError)
+       goto cleanup;
+
+    request_header->principal_offset = htonl(blob_pos);
+    request_header->principal_len = htonl(strlen(principal) + 1);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ccache_create_resp_t*)response->header;
-        code = cc_cache_new(ccache, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -526,13 +620,14 @@ cc_int_context_create_default_ccache( cc_context_t context,
                                       const char* principal, 
                                       cc_ccache_t* ccache )
 {
-    cc_uint32 blob_pos;
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ccache_create_default_t *request_header;
-    cc_msg_t        *response;
+    cc_uint32          blob_pos;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_create_default_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ccache_create_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL ||
          cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
@@ -548,39 +643,47 @@ cc_int_context_create_default_ccache( cc_context_t context,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    code = cci_msg_new(ccmsg_CCACHE_CREATE_DEFAULT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE_DEFAULT, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_context->handle;
-    request_header->version = cred_vers;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->version = htonl(cred_vers);
 
     code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
-    request_header->principal_offset = blob_pos;
-    request_header->principal_len = strlen(principal) + 1;
+    if (code != ccNoError)
+       goto cleanup;
+
+    request_header->principal_offset = htonl(blob_pos);
+    request_header->principal_len = htonl(strlen(principal) + 1);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_default_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ccache_create_resp_t*)response->header;
-        code = cc_cache_new(ccache, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -590,13 +693,14 @@ cc_int_context_create_new_ccache( cc_context_t context,
                                   const char* principal, 
                                   cc_ccache_t* ccache )
 {
-    cc_uint32 blob_pos;
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ccache_create_unique_t *request_header;
-    cc_msg_t        *response;
+    cc_uint32          blob_pos;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ccache_create_unique_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
     ccmsg_ccache_create_resp_t *response_header;
-    cc_int32 code;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL ||
          cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
@@ -612,39 +716,47 @@ cc_int_context_create_new_ccache( cc_context_t context,
     if (request_header == NULL)
         return ccErrNoMem;
 
-    code = cci_msg_new(ccmsg_CCACHE_CREATE_UNIQUE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE_UNIQUE, &request);
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_context->handle;
-    request_header->version = cred_vers;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->version = htonl(cred_vers);
 
     code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
-    if (code != ccNoError) {
-        cci_msg_destroy(request);
-        free(request_header);
-        return code;
-    }
-    request_header->principal_offset = blob_pos;
-    request_header->principal_len = strlen(principal) + 1;
+    if (code != ccNoError)
+       goto cleanup;
+
+    request_header->principal_offset = htonl(blob_pos);
+    request_header->principal_len = htonl(strlen(principal) + 1);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_unique_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = htonl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         response_header = (ccmsg_ccache_create_resp_t*)response-> header;
-        code = cc_cache_new(ccache, response_header->ccache);
+        code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
  
@@ -653,14 +765,16 @@ cc_int_context_lock( cc_context_t context,
                      cc_uint32 lock_type,
                      cc_uint32 block )
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_lock_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_lock_t   *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL || 
-         (lock_type != cc_lock_read && lock_type != cc_lock_write) ||
+         (lock_type != cc_lock_read && lock_type != cc_lock_write &&
+         lock_type != cc_lock_upgrade && lock_type != cc_lock_downgrade) ||
          (block != cc_lock_block && block != cc_lock_noblock) )
         return ccErrBadParam;
 
@@ -674,41 +788,52 @@ cc_int_context_lock( cc_context_t context,
         return ccErrNoMem;
 
     code = cci_msg_new(ccmsg_CTX_LOCK, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_context->handle;
-    request_header->lock_type;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->lock_type = htonl(lock_type);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_lock_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
+        code = ntohl(nack_header->err_code);
 
         // TODO: if (block == cc_lock_block) .....
-    } else if (response->type == ccmsg_ACK) {
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+    
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
 cc_int32
 cc_int_context_unlock( cc_context_t context )
 {
-    cc_int_context_t int_context;
-    cc_msg_t        *request;
-    ccmsg_ctx_unlock_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_int_context_t   int_context;
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_unlock_t *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( context == NULL )
         return ccErrBadParam;
@@ -723,27 +848,37 @@ cc_int_context_unlock( cc_context_t context )
         return ccErrNoMem;
 
     code = cci_msg_new(ccmsg_CTX_UNLOCK, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    request_header->ctx = int_context->handle;
+    request_header->ctx = htonll(int_context->handle);
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_unlock_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -754,20 +889,22 @@ cc_int_context_clone( cc_context_t      inContext,
                       cc_int32*         supportedVersion,
                       char const**      vendor )
 {
-    cc_int_context_t int_context, new_context;
-    static char vendor_st[128] = "";
-    cc_msg_t     *request;
-    ccmsg_clone_t *request_header;
-    cc_msg_t     *response;
-    ccmsg_clone_resp_t *response_header;
-    cc_int32 code;
+    cc_int_context_t   int_context;
+    static char        vendor_st[128] = "";
+    cc_msg_t           *request = NULL;
+    ccmsg_ctx_clone_t  *request_header = NULL;
+    cc_msg_t           *response = NULL;
+    ccmsg_ctx_clone_resp_t *response_header;
+    char               *string = NULL;
+    cc_uint32          type;
+    cc_int32           code;
 
     if ( inContext == NULL ||
          outContext == NULL ||
          supportedVersion == NULL )
         return ccErrBadParam;
 
-    int_context = (cc_int_context_t)context;
+    int_context = (cc_int_context_t)inContext;
 
     if ( int_context->magic != CC_CONTEXT_MAGIC )
         return ccErrInvalidContext;
@@ -775,45 +912,48 @@ cc_int_context_clone( cc_context_t      inContext,
     if ((requestedVersion != ccapi_version_2) &&
          (requestedVersion != ccapi_version_3) &&
          (requestedVersion != ccapi_version_4) &&
-         (requestedVersion != ccapi_version_5)) {
+         (requestedVersion != ccapi_version_5) &&
+        (requestedVersion != ccapi_version_6)) {
 
         if (supportedVersion != NULL) {
-            *supportedVersion = ccapi_version_5;
+            *supportedVersion = ccapi_version_max;
         }
         return ccErrBadAPIVersion;
     }   
 
-    request_header = (ccmsg_clone_t*)malloc(sizeof(ccmsg_clone_t));
+    request_header = (ccmsg_ctx_clone_t*)malloc(sizeof(ccmsg_ctx_clone_t));
     if (request_header == NULL)
         return ccErrNoMem;
 
-    request_header->ctx = int_context->handle;
-    request_header->in_version = requestedVersion;
+    request_header->ctx = htonll(int_context->handle);
+    request_header->in_version = htonl(requestedVersion);
 
     code = cci_msg_new(ccmsg_INIT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
-    code = cci_msg_add_header(request, request_header, sizeof(ccmsg_init_t));
+    code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_clone_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
-        response_header = (ccmsg_clone_resp_t *)response->header;
-        *supportedVersion = response_header->out_version;
-        code = cc_int_context_new(outContext, response_header->out_ctx, response_header->out_version);
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
+        response_header = (ccmsg_ctx_clone_resp_t *)response->header;
+        *supportedVersion = ntohl(response_header->out_version);
+        code = cc_int_context_new(outContext, ntohll(response_header->out_ctx), ntohl(response_header->out_version));
 
         if (!vendor_st[0]) {
-            char * string;
-            code = cci_msg_retrieve_blob(response, response_header->vendor_offset, response_header->vendor_length, &string);
+            code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);
             strncpy(vendor_st, string, sizeof(vendor_st)-1);
             vendor_st[sizeof(vendor_st)-1] = '\0';
-            free(string);
         } 
         *vendor = vendor_st;
 
@@ -821,8 +961,16 @@ cc_int_context_clone( cc_context_t      inContext,
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+    
+  cleanup:
+    if (string)
+       free(string);
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
 
@@ -831,7 +979,6 @@ cc_int_context_get_version( cc_context_t        context,
                             cc_int32*           version )
 {
     cc_int_context_t int_context;
-    cc_int32 code;
 
     if ( context == NULL ||
          version == NULL )
index cd5ca678d443cc3e0c6c604450f1f3cccded2933..6ff113a26928a4da32b06aa656f532c68ecd946f 100644 (file)
@@ -66,7 +66,7 @@ cc_int_context_release( cc_context_t context );
 
 cc_int32
 cc_int_context_get_change_time( cc_context_t context,
-                                cc_time_t* time);
+                                cc_time* time);
 
 cc_int32
 cc_int_context_get_default_ccache_name( cc_context_t context,
index b0a3df2b7531d81936b3003c9d00ac3be9b1f619..dbdf6345e8509c2cdf25d5fe4e31a99d427ca497 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -88,10 +88,10 @@ cc_int_credentials_new( cc_credentials_t *pcredentials, cc_uint32 version,
 
     switch ( version ) {
     case cc_credentials_v4:
-        code = cci_cred_v4_unmarshall(data, len, credentials->data);
+        code = cci_creds_v4_unmarshall(data, len, credentials->data);
         break;
     case cc_credentials_v5:
-        code = cci_cred_v5_unmarshall(data, len, credentials->data);
+        code = cci_creds_v5_unmarshall(data, len, credentials->data);
         break;
     default:
         free(credentials);
@@ -159,23 +159,23 @@ cc_int_credentials_release( cc_credentials_t creds )
 
 cc_int32
 cc_int_credentials_compare( cc_credentials_t credentials,
-                        cc_credentials_t compare_to,
-                        cc_uint32* equal )
+                           cc_credentials_t compare_to,
+                           cc_uint32* equal )
 {
     cc_int_credentials_t int_credentials;
     cc_int_credentials_t int_compare_to;
 
     if ( credentials == NULL || compare_to == NULL || equal == NULL )
         return ccErrBadParam;
-
     
+    int_credentials = (cc_int_credentials_t)credentials;
+    int_compare_to  = (cc_int_credentials_t)compare_to;
+
     if ( int_credentials->magic != CC_CREDS_MAGIC ||
          int_compare_to->magic != CC_CREDS_MAGIC )
         return ccErrInvalidCredentials;
 
-    int_credentials = (cc_int_credentials_t)credentials;
-    int_compare_to  = (cc_int_credentials_t)compare_to;
-
     *equal = (int_credentials->handle == int_compare_to->handle);
+   
     return ccNoError;
 }
index 320c6182573231592ca4ef4db29b27f187dea006..dfd589f3267ff964a14de0d09fe4f32c7c3fec6f 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -84,8 +84,8 @@ cci_creds_v5_marshall( cc_credentials_v5_t * creds,
 
 cc_int32
 cci_creds_v4_unmarshall( char * flat, 
-                             cc_uint32 len,
-                             cc_credentials_union * creds);
+                         cc_uint32 len,
+                         cc_credentials_union * creds);
 
 cc_int32
 cci_creds_v5_unmarshall( char * flat, 
index b7333daf30077958fc9eaf0bae7d8e7a9d1308e2..3cdab875a38ae14e21010a21b84976126a2261ad 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -46,7 +46,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <CredentialsCache.h>
+#include "credentials.h"
 #include "credentials_iterator.h"
+#include "cc_rpc.h"
 #include "msg.h"
 #include "msg_headers.h"
 
@@ -74,6 +76,7 @@ cc_int_credentials_iterator_new( cc_credentials_iterator_t * piter,
 
     iter->functions->release = cc_int_credentials_iterator_release;
     iter->functions->next = cc_int_credentials_iterator_next;
+    iter->functions->clone = cc_int_credentials_iterator_clone;
     iter->magic = CC_CREDS_ITER_MAGIC;
     iter->ctx = ctx;
     iter->ccache = ccache;
@@ -87,10 +90,11 @@ cc_int32
 cc_int_credentials_iterator_release( cc_credentials_iterator_t iter )
 {
     cc_int_credentials_iterator_t int_iter;
-    cc_msg_t        *request;
-    ccmsg_creds_iterator_release_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_msg_t                   *request = NULL;
+    ccmsg_creds_iterator_release_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( iter == NULL )
         return ccErrBadParam;
@@ -103,29 +107,40 @@ cc_int_credentials_iterator_release( cc_credentials_iterator_t iter )
     request_header = (ccmsg_creds_iterator_release_t*)malloc(sizeof(ccmsg_creds_iterator_release_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_iter->ctx;
-    request_header->ccache = int_iter->ccache;
-    request_header->iterator = int_iter->handle;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->ccache = htonll(int_iter->ccache);
+    request_header->iterator = htonll(int_iter->handle);
+
     code = cci_msg_new(ccmsg_CREDS_ITERATOR_RELEASE, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_release_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = htonl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = htonl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         code = ccNoError;
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
 
     free(int_iter->functions);
     free(int_iter);
@@ -137,10 +152,11 @@ cc_int_credentials_iterator_next( cc_credentials_iterator_t iter,
                                   cc_credentials_t * credentials )
 {
     cc_int_credentials_iterator_t int_iter;
-    cc_msg_t        *request;
-    ccmsg_creds_iterator_next_t *request_header;
-    cc_msg_t        *response;
-    cc_int32 code;
+    cc_msg_t                   *request = NULL;
+    ccmsg_creds_iterator_next_t *request_header = NULL;
+    cc_msg_t                   *response = NULL;
+    cc_uint32                  type;
+    cc_int32                   code;
 
     if ( credentials == NULL )
         return ccErrBadParam;
@@ -153,35 +169,105 @@ cc_int_credentials_iterator_next( cc_credentials_iterator_t iter,
     request_header = (ccmsg_creds_iterator_next_t*)malloc(sizeof(ccmsg_creds_iterator_next_t));
     if (request_header == NULL)
         return ccErrNoMem;
-    request_header->ctx = int_iter->ctx;
-    request_header->ccache = int_iter->ccache;
-    request_header->iterator = int_iter->handle;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->ccache = htonll(int_iter->ccache);
+    request_header->iterator = htonll(int_iter->handle);
 
     code = cci_msg_new(ccmsg_CREDS_ITERATOR_NEXT, &request);
-    if (code != ccNoError) {
-        free(request_header);
-        return code;
-    }
+    if (code != ccNoError)
+       goto cleanup;
 
     code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_next_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
 
     code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
 
-    if (response->type == ccmsg_NACK) {
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
         ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
-        code = nack_header->err_code;
-    } else if (response->type == ccmsg_ACK) {
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
         char * blob;
         ccmsg_creds_iterator_next_resp_t * response_header = (ccmsg_creds_iterator_next_resp_t*)response->header;
-        code = cci_msg_retrieve_blob(response, response_header->creds_offset, response_header->creds_len, &blob);
-        code = cc_credentials_new(credentials, response_header->version,
-                                  int_iter->ctx, int_iter->ccache, response_header->creds_handle
-                                  blob, response_header->creds_len);
+        code = cci_msg_retrieve_blob(response, ntohl(response_header->creds_offset), ntohl(response_header->creds_len), &blob);
+        code = cc_int_credentials_new(credentials, ntohl(response_header->version),
+                                  int_iter->ctx, int_iter->ccache, ntohll(response_header->creds_handle)
+                                  blob, ntohl(response_header->creds_len));
         free(blob);
     } else {
         code = ccErrBadInternalMessage;
     }
-    cci_msg_destroy(request);
-    cci_msg_destroy(response);
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
+    return code;
+}
+
+cc_int32
+cc_int_credentials_iterator_clone( cc_credentials_iterator_t iter,
+                                  cc_credentials_iterator_t* new_iter)
+{
+    cc_int_credentials_iterator_t      int_iter;
+    cc_msg_t                           *request = NULL;
+    ccmsg_creds_iterator_clone_t       *request_header = NULL;
+    cc_msg_t                           *response = NULL;
+    cc_uint32                          type;
+    cc_int32                           code;
+
+    if ( iter == NULL || new_iter == NULL )
+        return ccErrBadParam;
+
+    int_iter = (cc_int_credentials_iterator_t)iter;
+
+    if ( int_iter->magic != CC_CREDS_ITER_MAGIC )
+        return ccErrInvalidCCacheIterator;
+
+    request_header = (ccmsg_creds_iterator_clone_t*)malloc(sizeof(ccmsg_creds_iterator_clone_t));
+    if (request_header == NULL)
+        return ccErrNoMem;
+    request_header->ctx = htonll(int_iter->ctx);
+    request_header->iterator = htonll(int_iter->handle);
+
+    code = cci_msg_new(ccmsg_CREDS_ITERATOR_CLONE, &request);
+    if (code != ccNoError)
+       goto cleanup;
+
+    code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_clone_t));
+    if (code != ccNoError)
+       goto cleanup;
+    request_header = NULL;
+
+    code = cci_perform_rpc(request, &response);
+    if (code != ccNoError)
+       goto cleanup;
+
+    type = ntohl(response->type);
+    if (type == ccmsg_NACK) {
+        ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
+        code = ntohl(nack_header->err_code);
+    } else if (type == ccmsg_ACK) {
+        ccmsg_creds_iterator_clone_resp_t * response_header = (ccmsg_creds_iterator_clone_resp_t*)response->header;
+        code = cc_int_credentials_iterator_new(new_iter, int_iter->ctx, int_iter->ccache, ntohll(response_header->iterator));
+    } else {
+        code = ccErrBadInternalMessage;
+    }
+
+  cleanup:
+    if (request_header)
+       free(request_header);
+    if (request)
+       cci_msg_destroy(request);
+    if (response)
+       cci_msg_destroy(response);
     return code;
 }
+
index 2a6f8edf2d8554104b6ca5ea22f8627e987828ea..954d2f1afaf2a3971310e1c8a556c27192ad3305 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -69,4 +69,8 @@ cc_int32
 cc_int_credentials_iterator_next( cc_credentials_iterator_t iter,
                                   cc_credentials_t * credentials );
 
+cc_int32
+cc_int_credentials_iterator_clone( cc_credentials_iterator_t iter,
+                                   cc_credentials_iterator_t * new_iter );
+
 
diff --git a/src/lib/ccapi/common/NTMakefile b/src/lib/ccapi/common/NTMakefile
new file mode 100644 (file)
index 0000000..a43985a
--- /dev/null
@@ -0,0 +1,15 @@
+!INCLUDE <WIN32.MAK>\r
+\r
+CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
+\r
+CC_COMMON_OBJS = marshall.obj msg.obj generic_lists.obj\r
+\r
+CC_COMMON_LIB = cc_common.lib\r
+\r
+$(CC_COMMON_LIB): $(CC_COMMON_OBJS)\r
+        $(implib) /NOLOGO /OUT:$@ $**\r
+\r
+all: $(CC_COMMON_LIB)\r
+\r
+clean:\r
+        del *.obj *.lib\r
diff --git a/src/lib/ccapi/common/generic_lists.c b/src/lib/ccapi/common/generic_lists.c
new file mode 100644 (file)
index 0000000..2c73983
--- /dev/null
@@ -0,0 +1,397 @@
+/* $Copyright:\r
+*\r
+* Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+* \r
+* All rights reserved.\r
+* \r
+* Export of this software from the United States of America may require a\r
+* specific license from the United States Government.  It is the\r
+* responsibility of any person or organization contemplating export to\r
+* obtain such a license before exporting.\r
+* \r
+* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+* this software and its documentation for any purpose and without fee is\r
+* hereby granted, provided that the above copyright notice appear in all\r
+* copies and that both that copyright notice and this permission notice\r
+* appear in supporting documentation, and that the name of M.I.T. not be\r
+* used in advertising or publicity pertaining to distribution of the\r
+* software without specific, written prior permission.  Furthermore if you\r
+* modify this software you must label your software as modified software\r
+* and not distribute it in such a fashion that it might be confused with\r
+* the original MIT software. M.I.T. makes no representations about the\r
+* suitability of this software for any purpose.  It is provided "as is"\r
+* without express or implied warranty.\r
+* \r
+* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+* \r
+* Individual source code files are copyright MIT, Cygnus Support,\r
+* OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+* \r
+* Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+* and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+* (MIT).  No commercial use of these trademarks may be made without prior\r
+* written permission of MIT.\r
+* \r
+* "Commercial use" means use of a name in a product or other for-profit\r
+* manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+* trademarks in order to convey information (although in doing so,\r
+* recognition of their trademark status should be given).\r
+* $\r
+*/\r
+\r
+\r
+/*\r
+ * Lists implementation.\r
+ * \r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <memory.h>\r
+\r
+#include "CredentialsCache.h"\r
+#include "generic_lists.h"\r
+\r
+/**\r
+ * cci_generic_iterate_has_next()\r
+ *\r
+ * Purpose: Determine if an iterator has a next element\r
+ *\r
+ * Return:  1 if another element exists\r
+ *          0 if no additional elements exist\r
+ *\r
+ * Errors:  None\r
+ *\r
+ */\r
+cc_int32 \r
+cci_generic_iterate_has_next(cc_generic_iterate_t *iterate) \r
+{\r
+    return ((iterate == NULL || iterate->next == NULL) ? 0 : 1);\r
+}\r
+\r
+/**\r
+ * cci_generic_iterate_next()\r
+ *\r
+ * Purpose: Retrieve the next element from an iterator and advance\r
+ *          the iterator\r
+ *\r
+ * Return:  non-NULL, the next element in the iterator\r
+ *          NULL, the iterator list is empty or iterator is invalid\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_iterate_next(cc_generic_iterate_t *iterator, cc_generic_list_node_t** nodepp) \r
+{\r
+    cc_generic_list_node_t* ret;\r
+    \r
+    if (iterator == NULL || nodepp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    ret = iterator->next;\r
+    if (iterator->next != NULL)\r
+        iterator->next = iterator->next->next;\r
+\r
+    *nodepp = ret;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_list_new()\r
+ *\r
+ * Purpose: Allocate new generic list\r
+ *\r
+ * Return:  non-NULL, an empty list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_list_new(cc_generic_list_head_t ** listpp) \r
+{\r
+    cc_generic_list_head_t* ret = (cc_generic_list_head_t *)malloc(sizeof(cc_generic_list_head_t));\r
+    if (ret == NULL)\r
+        return ccErrNoMem;\r
+       \r
+    ret->type = generic;\r
+    ret->head = ret->tail = NULL;\r
+    *listpp = ret;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_list_append()\r
+ *\r
+ * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) \r
+{\r
+    cc_generic_list_node_t* new_node;\r
+\r
+    if ( data == NULL || len == 0 )\r
+        return ccErrBadParam;\r
+\r
+    new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));\r
+    if (new_node == NULL)\r
+        return ccErrNoMem;\r
+\r
+    new_node->data = malloc(len);\r
+    if ( new_node->data == NULL ) {\r
+        free(new_node);\r
+        return ccErrNoMem;         \r
+    }\r
+    \r
+    memcpy(new_node->data,data,len);\r
+    new_node->len = len;\r
+\r
+    if (head->head == NULL) { /*empty list*/\r
+        head->head = new_node;\r
+        head->tail = new_node;\r
+           new_node->next = new_node->prev = NULL;\r
+    } else {\r
+        new_node->prev = head->tail;\r
+        head->tail->next = new_node;\r
+        head->tail = new_node;\r
+               new_node->next = NULL;\r
+    }\r
+       if (nodepp != NULL)\r
+           *nodepp = new_node;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_list_prepend()\r
+ *\r
+ * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data'\r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem, ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) \r
+{\r
+    cc_generic_list_node_t* new_node;\r
+\r
+    if ( data == NULL || len == 0 )\r
+        return ccErrBadParam;\r
+\r
+    new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));\r
+    if (new_node == NULL)\r
+        return ccErrNoMem;\r
+\r
+    new_node->data = malloc(len);\r
+    if ( new_node->data == NULL ) {\r
+        free(new_node);\r
+        return ccErrNoMem;\r
+    }\r
+    \r
+    memcpy(new_node->data,data,len);\r
+    new_node->len = len;\r
+       \r
+    if (head->head == NULL) { /*empty list*/\r
+        head->head = new_node;\r
+        head->tail = new_node;\r
+        new_node->prev = new_node->next = NULL;\r
+    } else {\r
+        new_node->next = head->head;\r
+        head->head->prev = new_node;\r
+        new_node->prev = NULL;\r
+        head->head = new_node;\r
+    }\r
+\r
+       if (nodepp != NULL)\r
+               *nodepp = new_node;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_list_remove_element()\r
+ *\r
+ * Purpose: Remove a node from the list\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem) \r
+{\r
+    if (head->head == NULL || rem == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (head->head == rem && head->tail == rem) { /*removing only element of list*/\r
+        head->head = head->tail = NULL;\r
+    } else if (head->head == rem) { /*removing head*/\r
+        head->head = head->head->next;\r
+    } else if (head->tail == rem) { /*removing tail*/\r
+        head->tail = head->tail->prev;\r
+        head->tail->next = NULL;\r
+    } else {\r
+        rem->prev->next = rem->next;\r
+        rem->next->prev = rem->prev;\r
+    }\r
+    free(rem);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_free_element()\r
+ *\r
+ * Purpose: Free the memory associated with a node\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_free_element(cc_generic_list_node_t* node)\r
+{\r
+    if ( node == NULL )\r
+        return ccErrBadParam;\r
+\r
+    if ( node->data ) {\r
+        free(node->data);\r
+        node->data = NULL;\r
+    }\r
+    node->len = 0;\r
+    node->next = node->prev = NULL;\r
+    free(node);\r
+    return ccNoError;\r
+}\r
+\r
+\r
+/**\r
+ * cci_generic_list_destroy()\r
+ *\r
+ * Purpose: Deallocate a list and all of its contents\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32\r
+cci_generic_list_destroy(cc_generic_list_head_t* head) \r
+{\r
+    cc_generic_list_node_t *cur, *next;\r
+    cc_int32 ret = ccNoError;\r
+\r
+    if ( head == NULL )\r
+        return ccErrBadParam;\r
+       \r
+    for (cur = head->head; ret == ccNoError && cur != NULL; cur = next) {\r
+        next = cur->next;\r
+        ret = cci_generic_free_element(cur);\r
+    }       \r
+    free(head);\r
+    return(ret);\r
+}\r
+\r
+/**\r
+ * cci_generic_list_copy()\r
+ *\r
+ * Purpose: Copy a list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrBadParam, ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t** headpp) \r
+{\r
+    cc_generic_list_head_t* copy;\r
+    cc_generic_list_node_t *src_node, *dst_node;\r
+    cc_int32 code;\r
+\r
+    if (head == NULL || headpp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = cci_generic_list_new(&copy);\r
+    if (code != ccNoError)\r
+        return code;\r
+\r
+    for (src_node = head->head; src_node != NULL; src_node = src_node->next) {\r
+        code = cci_generic_list_append(copy, src_node->data, src_node->len, &dst_node);\r
+        if (code != ccNoError) {\r
+            cci_generic_list_destroy(copy);\r
+            return code;\r
+        }\r
+    }\r
+    *headpp = copy;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_list_iterator()\r
+ *\r
+ * Purpose: Allocate an iterator for the specified list\r
+ *\r
+ * Return:  non-NULL, an iterator\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t** headpp) \r
+{\r
+    cc_generic_iterate_t* iterator;\r
+\r
+    if ( head == NULL || headpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator = (cc_generic_iterate_t*)malloc(sizeof(cc_generic_iterate_t));\r
+    if (iterator == NULL)\r
+        return ccErrNoMem;\r
+    \r
+    iterator->next = head->head;\r
+    *headpp = iterator;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_generic_free_iterator()\r
+ *\r
+ * Purpose: Deallocate memory associated with an iterator\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+cci_generic_free_iterator(cc_generic_iterate_t* iterator)\r
+{\r
+    if ( iterator == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator->next = NULL;\r
+    free(iterator);\r
+    return ccNoError;\r
+}\r
+\r
+\r
+\r
diff --git a/src/lib/ccapi/common/mac/mig.defs b/src/lib/ccapi/common/mac/mig.defs
new file mode 100755 (executable)
index 0000000..dd3ee1b
--- /dev/null
@@ -0,0 +1,58 @@
+/* $Copyright:
+ *
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
+ * 
+ * All rights reserved.
+ * 
+ * Export of this software from the United States of America may require a
+ * specific license from the United States Government.  It is the
+ * responsibility of any person or organization contemplating export to
+ * obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
+ * this software and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of M.I.T. not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.  Furthermore if you
+ * modify this software you must label your software as modified software
+ * and not distribute it in such a fashion that it might be confused with
+ * the original MIT software. M.I.T. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * 
+ * Individual source code files are copyright MIT, Cygnus Support,
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
+ * 
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology
+ * (MIT).  No commercial use of these trademarks may be made without prior
+ * written permission of MIT.
+ * 
+ * "Commercial use" means use of a name in a product or other for-profit
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT
+ * trademarks in order to convey information (although in doing so,
+ * recognition of their trademark status should be given).
+ * $
+ */
+import "mig_types.h";
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+subsystem ccapi 128;
+
+type msg_request_t = array [] of char;
+type msg_reply_t = array [] of char;
+type msg_error_t = int32;
+
+routine ccapi_msg (in_server_port : mach_port_t;
+                   in_request     : msg_request_t;
+               out out_reply      : msg_reply_t;
+               out out_error      : msg_error_t);
diff --git a/src/lib/ccapi/common/mac/mig_types.h b/src/lib/ccapi/common/mac/mig_types.h
new file mode 100644 (file)
index 0000000..586a019
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Copyright:
+*
+* Copyright 2004-2006 by the Massachusetts Institute of Technology.
+* 
+* All rights reserved.
+* 
+* Export of this software from the United States of America may require a
+* specific license from the United States Government.  It is the
+* responsibility of any person or organization contemplating export to
+* obtain such a license before exporting.
+* 
+* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
+* this software and its documentation for any purpose and without fee is
+* hereby granted, provided that the above copyright notice appear in all
+* copies and that both that copyright notice and this permission notice
+* appear in supporting documentation, and that the name of M.I.T. not be
+* used in advertising or publicity pertaining to distribution of the
+* software without specific, written prior permission.  Furthermore if you
+* modify this software you must label your software as modified software
+* and not distribute it in such a fashion that it might be confused with
+* the original MIT software. M.I.T. makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+* 
+* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+* 
+* Individual source code files are copyright MIT, Cygnus Support,
+* OpenVision, Oracle, Sun Soft, FundsXpress, and others.
+* 
+* Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
+* and Zephyr are trademarks of the Massachusetts Institute of Technology
+* (MIT).  No commercial use of these trademarks may be made without prior
+* written permission of MIT.
+* 
+* "Commercial use" means use of a name in a product or other for-profit
+* manner.  It does NOT prevent a commercial firm from referring to the MIT
+* trademarks in order to convey information (although in doing so,
+* recognition of their trademark status should be given).
+* $
+*/
+
+#include "CredentialsCache.h"
+
+typedef const char *msg_request_t;
+typedef char       *msg_reply_t;
+typedef cc_int32    msg_error_t;
diff --git a/src/lib/ccapi/common/marshall.c b/src/lib/ccapi/common/marshall.c
new file mode 100644 (file)
index 0000000..48abb33
--- /dev/null
@@ -0,0 +1,441 @@
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+/* marshall.c */\r
+\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <CredentialsCache.h>\r
+#include "msg.h"\r
+#include "msg_headers.h"\r
+#include "marshall.h"\r
+\r
+cc_int32\r
+cci_creds_v4_marshall( cc_credentials_v4_t * creds, \r
+                       char ** pflat, \r
+                       cc_uint32 * plen)\r
+{\r
+    cc_uint32 len;\r
+    char * flat;\r
+    cci_flat_creds_v4_t * header;\r
+    cc_time64 t64;\r
+\r
+    if ( creds == NULL || pflat == NULL || plen == NULL )\r
+        return ccErrBadParam;\r
+\r
+    len = sizeof(cci_flat_creds_v4_t);\r
+    flat = (char *)malloc(len);\r
+    if ( flat == NULL )\r
+        return ccErrNoMem;\r
+    memset(flat, 0, len);\r
+\r
+    header = (cci_flat_creds_v4_t *)flat;\r
+    header->version = htonl(creds->version);\r
+    memcpy(header->principal, creds->principal, cc_v4_name_size);\r
+    memcpy(header->principal_instance, creds->principal_instance, cc_v4_instance_size);\r
+    memcpy(header->service, creds->service, cc_v4_name_size);\r
+    memcpy(header->service_instance, creds->service_instance, cc_v4_instance_size);\r
+    memcpy(header->realm, creds->realm, cc_v4_realm_size);\r
+    memcpy(header->session_key, creds->session_key, cc_v4_key_size);\r
+    header->kvno = htonl(creds->kvno);\r
+    header->string_to_key_type = htonl(creds->string_to_key_type);\r
+    t64 = creds->issue_date;\r
+    header->issue_date = htonll(t64);\r
+    header->lifetime = htonl(creds->lifetime);\r
+    /* TODO: verify that address is stored in host order */\r
+    header->address = htonl(creds->address);\r
+    header->ticket_size = htonl(creds->ticket_size);\r
+    memcpy(header->ticket, creds->ticket, cc_v4_ticket_size);\r
+\r
+    *pflat = flat;\r
+    *plen = len;\r
+\r
+    return ccNoError;  \r
+}\r
+\r
+cc_int32\r
+cci_creds_v4_unmarshall( char * flat, \r
+                         cc_uint32 len,\r
+                         cc_credentials_union * creds_union)\r
+{\r
+    struct cci_flat_creds_v4 * header;\r
+    cc_credentials_v4_t * creds;\r
+    cc_time64 t64;\r
+\r
+    if ( flat == NULL || len == 0 || creds_union == NULL )\r
+        return ccErrBadParam;\r
+\r
+    creds_union->version = cc_credentials_v4;\r
+\r
+    header = (cci_flat_creds_v4_t *)flat;\r
+\r
+    creds = (cc_credentials_v4_t *)malloc(sizeof(cc_credentials_v4_t));\r
+    if ( creds == NULL )\r
+       return ccErrNoMem;\r
+\r
+    creds->version = ntohl(header->version);\r
+    memcpy(creds->principal, header->principal, cc_v4_name_size);\r
+    memcpy(creds->principal_instance, header->principal_instance, cc_v4_instance_size);\r
+    memcpy(creds->service, header->service, cc_v4_name_size);\r
+    memcpy(creds->service_instance, header->service_instance, cc_v4_instance_size);\r
+    memcpy(creds->realm, header->realm, cc_v4_realm_size);\r
+    memcpy(creds->session_key, header->session_key, cc_v4_key_size);\r
+    creds->kvno = htonl(header->kvno);\r
+    creds->string_to_key_type = htonl(header->string_to_key_type);\r
+    t64 = header->issue_date;\r
+    creds->issue_date = (cc_time64)ntohll(t64);\r
+    creds->lifetime = (cc_int32)ntohl(header->lifetime);\r
+    /* TODO: verify that address is stored in host order */\r
+    creds->address = ntohl(header->address);\r
+    creds->ticket_size = ntohl(header->ticket_size);\r
+    memcpy(creds->ticket, header->ticket, cc_v4_ticket_size);\r
+\r
+    creds_union->credentials.credentials_v4 = creds;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+\r
+cc_int32\r
+cci_creds_cc_data_array_count_entries( cc_data ** array, cc_uint32 * pcount)\r
+{\r
+    cc_uint32 count;\r
+\r
+    if (array == NULL) {\r
+        *pcount = 0;\r
+        return ccNoError;\r
+    }\r
+\r
+    for ( count=0; array[count] != NULL ; count++) ;\r
+\r
+    *pcount = count;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+cci_creds_v5_compute_flat_size( cc_credentials_v5_t * creds, cc_uint32 * plen)\r
+{\r
+    cc_uint32 len;\r
+    cc_uint32 i, count;\r
+\r
+    len = sizeof(struct cci_flat_creds_v5);\r
+\r
+    if (creds->client)\r
+        len += strlen(creds->client) + 1;\r
+\r
+    if (creds->server)\r
+        len += strlen(creds->server) + 1;\r
+\r
+    len += creds->keyblock.length;\r
+\r
+    cci_creds_cc_data_array_count_entries( creds->addresses, &count );\r
+    len += count * sizeof(cc_flat_data);\r
+    for ( i=0; i<count; i++ ) {\r
+        len += creds->addresses[i]->length;\r
+    }\r
+\r
+    len += creds->ticket.length;\r
+    len += creds->second_ticket.length;\r
+\r
+    cci_creds_cc_data_array_count_entries( creds->authdata, &count );\r
+    len += count * sizeof(cc_flat_data);\r
+    for ( i=0; i<count; i++ ) {\r
+        len += creds->authdata[i]->length;\r
+    }\r
+\r
+    *plen = len;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+cci_creds_v5_marshall( cc_credentials_v5_t * creds, \r
+                       char ** pflat, \r
+                       cc_uint32 * plen)\r
+{\r
+    cc_uint32 len;\r
+    char * flat;\r
+    struct cci_flat_creds_v5 * header;\r
+    cc_uint32 length;\r
+    cc_uint32 offset;\r
+    cc_time64 t64;\r
+    cc_uint32 count;\r
+    cc_uint32 i;\r
+\r
+    if ( creds == NULL || pflat == NULL || plen == NULL )\r
+        return ccErrBadParam;\r
+\r
+    cci_creds_v5_compute_flat_size(creds, &len);\r
+\r
+    flat = (char *)malloc(len);\r
+    if ( flat == NULL )\r
+        return ccErrNoMem;\r
+    memset(flat, 0, len);\r
+\r
+    offset = sizeof(struct cci_flat_creds_v5);\r
+    header = (struct cci_flat_creds_v5 *)flat;\r
+    header->version = htonl(FLAT_CREDS_V5_VERSION);\r
+    if (creds->client) {\r
+       length = strlen(creds->client) + 1;\r
+        header->client.length = htonl(length);\r
+        header->client.data = htonl(offset);\r
+        memcpy(flat + offset, creds->client, length);\r
+        offset += length;\r
+    }\r
+\r
+    if (creds->server) {\r
+       length = strlen(creds->server) + 1;\r
+        header->server.length = htonl(length);\r
+        header->server.data = htonl(offset);\r
+        memcpy(flat + offset, creds->server, length);\r
+        offset += length;\r
+    }\r
+\r
+    header->keyblock.type = htonl(creds->keyblock.type);\r
+    if (creds->keyblock.length) {\r
+       length = creds->keyblock.length;\r
+        header->keyblock.length = htonl(length);\r
+        header->keyblock.data = htonl(offset);\r
+        memcpy(flat + offset, creds->keyblock.data, length);\r
+        offset += length;\r
+    }           \r
+\r
+    t64 = creds->authtime;\r
+    header->authtime = htonll(t64);\r
+    t64 = creds->starttime;\r
+    header->starttime = htonll(t64);\r
+    t64 = creds->endtime;\r
+    header->endtime = htonll(t64);\r
+    t64 = creds->renew_till;\r
+    header->renew_till = htonll(t64);\r
+\r
+    header->is_skey = htonl(creds->is_skey);\r
+    header->ticket_flags = htonl(creds->ticket_flags);\r
+\r
+    cci_creds_cc_data_array_count_entries( creds->addresses, &count );\r
+    if ( count ) {\r
+        cc_flat_data * addresses = (cc_flat_data *)flat + offset;\r
+       header->address_count = htonl(count);\r
+        header->addresses = htonl(offset);\r
+        offset += count * sizeof(cc_flat_data);\r
+\r
+        for ( i=0; i < count; i++ ) {\r
+            addresses[i].type = htonl(creds->addresses[i]->type);\r
+            if (creds->addresses[i]->length) {\r
+               length = creds->addresses[i]->length;\r
+                addresses[i].length = htonl(length);\r
+                addresses[i].data = htonl(offset);\r
+               /* TODO: verify that addresses are stored in network order */\r
+                memcpy(flat + offset, creds->addresses[i]->data, length);\r
+                offset += length;\r
+            }\r
+        }\r
+    }\r
+\r
+    header->ticket.type = htonl(creds->ticket.type);\r
+    if (creds->ticket.length) {\r
+       length = creds->ticket.length;\r
+        header->ticket.length = htonl(length);\r
+        header->ticket.data = htonl(offset);\r
+        memcpy(flat + offset, creds->ticket.data, length);\r
+        offset += length;\r
+    }           \r
+\r
+    header->second_ticket.type = htonl(creds->second_ticket.type);\r
+    if (creds->second_ticket.length) {\r
+       length = creds->second_ticket.length;\r
+        header->second_ticket.length = htonl(length);\r
+        header->second_ticket.data = htonl(offset);\r
+        memcpy(flat + offset, creds->second_ticket.data, length);\r
+        offset += length;\r
+    }           \r
+\r
+    cci_creds_cc_data_array_count_entries( creds->authdata, &count );\r
+    if ( count ) {\r
+        cc_flat_data * authdata = (cc_flat_data *)flat + offset;\r
+\r
+       header->authdata_count = htonl(count);\r
+        header->authdata = (offset);\r
+        offset += count * sizeof(cc_flat_data);\r
+\r
+        for ( i=0; i < count; i++ ) {\r
+            authdata[i].type = htonl(creds->authdata[i]->type);\r
+            if (creds->authdata[i]->length) {\r
+               length = creds->authdata[i]->length;\r
+                authdata[i].length = htonl(length);\r
+                authdata[i].data = htonl(offset);\r
+                memcpy(flat + offset, creds->authdata[i]->data, length);\r
+                offset += length;\r
+            }\r
+        }\r
+    }\r
+\r
+    *pflat = flat;\r
+    *plen = len;\r
+    return ccNoError;\r
+}\r
+\r
+\r
+// TODO: a much better job of checking for out of memory errors\r
+//       and validating that we do not read beyond the flat input\r
+//       data buffer\r
+\r
+cc_int32\r
+cci_creds_v5_unmarshall( char * flat, \r
+                         cc_uint32 len,\r
+                         cc_credentials_union * creds_union)\r
+{\r
+    struct cci_flat_creds_v5 * header;\r
+    cc_credentials_v5_t * creds;\r
+    cc_flat_data * flat_data;\r
+    cc_time64 t64;\r
+    cc_uint32  length;\r
+    cc_uint32  count;\r
+    cc_uint32  i;\r
+\r
+    if ( flat == NULL || len == 0 || creds_union == NULL )\r
+        return ccErrBadParam;\r
+\r
+    creds_union->version = cc_credentials_v5;\r
+\r
+    header = (struct cci_flat_creds_v5 *)flat;\r
+\r
+    if ( ntohl(header->version) != FLAT_CREDS_V5_VERSION )\r
+        return ccErrBadParam;\r
+\r
+    creds = (cc_credentials_v5_t *)malloc(sizeof(cc_credentials_v5_t));\r
+    if ( creds == NULL )\r
+        return ccErrNoMem;\r
+    memset(creds, 0, sizeof(cc_credentials_v5_t));\r
+\r
+    if ( header->client.length ) {\r
+       length = ntohl(header->client.length);\r
+        creds->client = (char *)malloc(length);\r
+        memcpy(creds->client, flat + header->client.data, length);\r
+    }\r
+\r
+    if ( header->server.length ) {\r
+       length = ntohl(header->server.length);\r
+        creds->server = (char *)malloc(length);\r
+        memcpy(creds->server, flat + header->server.data, length);\r
+    }\r
+\r
+    creds->keyblock.type = ntohl(header->keyblock.type);\r
+    if ( header->keyblock.length ) {\r
+       length = ntohl(header->keyblock.length);\r
+        creds->keyblock.length = length;\r
+        creds->keyblock.data = malloc(length);\r
+        memcpy(creds->keyblock.data, flat + header->keyblock.data, length);\r
+    }\r
+\r
+    /* TODO: need to perform overflow validation checks to ensure\r
+     * that we do not attempt to store too large a value into cc_time_t\r
+     * when it is a 32-bit field.\r
+     */\r
+    t64 = ntohll(header->authtime);\r
+    creds->authtime = (cc_time)t64;\r
+    t64 = ntohll(header->starttime);\r
+    creds->starttime = (cc_time)t64;\r
+    t64 = ntohll(header->endtime);\r
+    creds->endtime = (cc_time)t64;\r
+    t64 = ntohll(header->renew_till);\r
+    creds->renew_till = (cc_time)t64;\r
+\r
+    creds->is_skey = ntohl(header->is_skey);\r
+    creds->ticket_flags = ntohl(header->ticket_flags);\r
+\r
+    count = ntohl(header->address_count);\r
+    creds->addresses = (cc_data **) malloc((count + 1) * sizeof(cc_data *));\r
+    flat_data = (cc_flat_data *)flat + header->addresses;\r
+    for ( i=0 ; i < count ; i++ ) {\r
+        creds->addresses[i] = (cc_data *)malloc(sizeof(cc_data));\r
+        creds->addresses[i]->type = ntohl(flat_data[i].type);\r
+       length = ntohl(flat_data[i].length);\r
+        creds->addresses[i]->length = length;\r
+        if ( length ) {\r
+            creds->addresses[i]->data = malloc(length);\r
+           /* TODO: verify that addresses are stored in network order */\r
+            memcpy(creds->addresses[i]->data, flat + flat_data[i].data, length);\r
+        } else {\r
+            creds->addresses[i]->data = NULL;\r
+        }\r
+    }\r
+    creds->addresses[i] = NULL;\r
+\r
+    creds->ticket.type = ntohl(header->ticket.type);\r
+    length = ntohl(header->ticket.length);\r
+    if ( length ) {\r
+        creds->ticket.length = length;\r
+        creds->ticket.data = malloc(length);\r
+        memcpy(creds->ticket.data, flat + header->ticket.data, length);\r
+    }\r
+\r
+    creds->second_ticket.type = header->second_ticket.type;\r
+    if ( header->second_ticket.length ) {\r
+        creds->second_ticket.length = header->second_ticket.length;\r
+        creds->second_ticket.data = malloc(creds->second_ticket.length);\r
+        memcpy(creds->second_ticket.data, flat + header->second_ticket.data, creds->second_ticket.length);\r
+    }\r
+\r
+    count = ntohl(header->authdata_count);\r
+    creds->authdata = (cc_data **) malloc((count + 1) * sizeof(cc_data *));\r
+    flat_data = (cc_flat_data *)flat + header->authdata;\r
+    for ( i=0 ; i < count ; i++ ) {\r
+        creds->authdata[i] = (cc_data *)malloc(sizeof(cc_data));\r
+        creds->authdata[i]->type = ntohl(flat_data[i].type);\r
+       length = ntohl(flat_data[i].length);\r
+        creds->authdata[i]->length = length;\r
+        if ( length ) {\r
+            creds->authdata[i]->data = malloc(length);\r
+            memcpy(creds->authdata[i]->data, flat + flat_data[i].data, length);\r
+        } else {\r
+            creds->authdata[i]->data = NULL;\r
+        }\r
+    }\r
+    creds->authdata[i] = NULL;\r
+\r
+    creds_union->credentials.credentials_v5 = creds;\r
+\r
+    return ccNoError;\r
+}\r
+\r
similarity index 79%
rename from src/lib/ccapi/msg.c
rename to src/lib/ccapi/common/msg.c
index f5f074aa04beef93a879cdb92b34b322c7572b5e..789fc874649c374f457923e1f5e5ecbad643d6d4 100644 (file)
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-/*
- * Verifiable, extensible message format.
- */
-
-#include "CredentialsCache.h"
-#include "msg.h"
-#include "datastore.h"
-
-#include <stdlib.h>
-#include <memory.h>
-#include <stdio.h>
-#include <string.h>
-
-/**
- * cci_msg_new()
- *
- * Purpose: Allocate and initialize a new cc_msg_t structure
- *
- * Return:  non-NULL, the msg
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_msg_new(cc_uint32 type, cc_msg_t** msgpp) 
-{
-    // type should be validated.  If invalid set error to ccErrBadParam
-    cc_msg_t* msg;
-    
-    if ( type > CC_MSG_MAX_TYPE || msgpp == NULL )
-        return ccErrBadParam;
-
-    msg = (cc_msg_t*)malloc(sizeof(cc_msg_t));
-    if (msg == NULL)
-        return ccErrNoMem;
-
-    msg->type = type;
-    msg->flat = NULL;
-    msg->header = NULL;
-    msg->flat_len = 0;
-    msg->header_len = 0;
-    msg->magic = 0;
-    cci_generic_list_new(&msg->data_blobs);
-    if (msg->data_blobs == NULL) {
-        // pass on error from previous call
-        free(msg);
-        return ccErrNoMem;
-    }
-
-    *msgpp = msg;     
-    return ccNoError;
-}
-
-/**
- * cci_msg_calc_header_size()
- *
- * Purpose: Calculates the size of the header
- *
- * Return:  the size in bytes
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_msg_calc_header_size(cc_msg_t* msg, cc_uint32 * lenp) 
-{
-    int header_len = 12; /* header size, entire size, type */
-
-    if ( msg == NULL || lenp == NULL )
-        return ccErrBadParam;
-
-    header_len += msg->header_len;
-    *lenp = header_len;
-    return ccNoError;
-}
-
-/**
- * cci_msg_calc_size()
- *
- * Purpose: Calculates the size of the message
- *          (does not include the magic bytes)
- *
- * Return:  the size in bytes
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32 
-cci_msg_calc_size(cc_msg_t* msg, cc_uint32 * lenp) 
-{
-    cc_uint32 flat_len;
-    cc_generic_list_node_t* gen_node;
-    cc_generic_iterate_t* gen_iterator;
-       cc_int32 code;
-
-    if ( msg == NULL || lenp == NULL ) 
-        return ccErrBadParam;
-
-    code = cci_msg_calc_header_size(msg, &flat_len);
-    if (code != ccNoError)
-        goto bad;
-
-    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
-    if ( code != ccNoError )
-        goto bad;
-
-    while (cci_generic_iterate_has_next(gen_iterator)) {
-        code = cci_generic_iterate_next(gen_iterator, &gen_node);
-        if (code != ccNoError)
-            break;
-        flat_len += gen_node->len + BLOB_LEN;
-    }
-    cci_generic_free_iterator(gen_iterator);
-    if (code != ccNoError)
-        goto bad;
-
-    flat_len += MAGIC_HEAD_LEN + MAGIC_DATA_LEN;
-    *lenp = flat_len;
-
-  bad:
-    return code;
-}
-
-/**
- * cci_msg_add_data_blob()
- *
- * Purpose: Adds 'len' bytes of data to the msg
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32 
-cci_msg_add_data_blob(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 *lenp) 
-{
-    cc_int32 code;
-
-    if (msg == NULL || data == NULL || len <= 0 || lenp == NULL)
-        return ccErrBadParam;
-
-    code = cci_generic_list_append(msg->data_blobs, data, len, NULL);
-    if ( code != ccNoError )
-        return code;
-    return cci_msg_calc_blob_pos(msg, data, len, lenp);
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32 
-cci_msg_calc_blob_pos(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 * posp) 
-{
-    cc_uint32 pos;
-    cc_generic_list_node_t* gen_node;
-    cc_generic_iterate_t* gen_iterator;
-    cc_int32 code;
-
-    code = cci_msg_calc_header_size(msg, &pos);
-    pos += sizeof(cc_uint32); /*+ sizeof(cc_uint32) for magic*/
-
-    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
-    while (cci_generic_iterate_has_next(gen_iterator)) {
-        code = cci_generic_iterate_next(gen_iterator, &gen_node);
-        if (gen_node->len != len && gen_node->data != data) {
-            pos += gen_node->len + sizeof(cc_uint32);
-        } else {
-            cci_generic_free_iterator(gen_iterator);
-            *posp = pos + sizeof(cc_uint32);
-            return ccNoError;
-        }
-    }
-    
-    cci_generic_free_iterator(gen_iterator);
-    return ccIteratorEnd;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32 
-cci_msg_add_header(cc_msg_t* msg, void *header, cc_uint32 header_len) 
-{
-    if ( msg == NULL || header == NULL )
-        return ccErrBadParam;
-
-    msg->header = header;
-    msg->header_len = header_len;
-    return ccNoError;
-}
-
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32
-cci_msg_flatten(cc_msg_t* msg, void **flatpp) 
-{
-    cc_generic_list_node_t* gen_node;
-    cc_generic_iterate_t* gen_iterator;
-    char *cur_pos;
-    cc_uint32 zero = 0;
-    cc_uint32 magic = 0;
-    cc_uint32 msg_len;
-    cc_int32 code;
-
-    if (msg == NULL || flatpp == NULL)
-        return ccErrBadParam;
-
-    code = cci_msg_calc_size(msg,&msg->flat_len);
-    if ( code != ccNoError )
-        return code;
-
-    if (msg->flat_len > CC_MSG_MAX_SIZE)
-        return ccErrBadParam;
-
-    msg->flat = (void *)malloc(msg->flat_len);
-    if (msg->flat == NULL)
-        return ccErrNoMem;
-    
-    cur_pos = msg->flat;
-
-    memcpy(cur_pos,&msg->header_len,sizeof(cc_uint32));
-    cur_pos+=sizeof(cc_uint32);
-
-    memcpy(cur_pos,&msg->flat_len,sizeof(cc_uint32));
-    cur_pos+=sizeof(cc_uint32);
-
-    memcpy(cur_pos,&msg->type,sizeof(cc_uint32));
-    cur_pos+=sizeof(cc_uint32);
-
-    memcpy(cur_pos, msg->header, msg->header_len);
-    cur_pos += msg->header_len;
-
-    memcpy(cur_pos, &zero, sizeof(cc_uint32)); /*will be magic number later*/
-    cur_pos += sizeof(cc_uint32);
-
-    code = cci_generic_list_iterator(msg->data_blobs,&gen_iterator);
-    if ( code != ccNoError ) {
-        free(msg->flat);
-        return code;
-    }
-
-    while (cci_generic_iterate_has_next(gen_iterator)) {
-        code = cci_generic_iterate_next(gen_iterator, &gen_node);
-        if (code != ccNoError) {
-            free(gen_iterator);
-            free(msg->flat);
-            return code;
-        }
-        memcpy(cur_pos, &gen_node->len, sizeof(cc_uint32));
-        cur_pos+=sizeof(cc_uint32);
-               
-        memcpy(cur_pos, gen_node->data, gen_node->len);
-        cur_pos += gen_node->len;
-    }
-    free(gen_iterator);
-
-    memcpy(cur_pos, &zero, sizeof(cc_uint32)); /*magic number will go here later*/
-    cur_pos += sizeof(cc_uint32);
-
-    if (cur_pos - (char *)msg->flat != msg->flat_len) {
-        printf("ERRORR cur_pos - msg->flat = %d\n",msg->flat_len);
-    }
-
-    cci_msg_calc_magic(msg->flat, msg->flat_len, &magic);
-    printf("magic = %d\n",magic);
-       
-    cci_msg_calc_header_size(msg, &msg_len);
-    memcpy((char *)msg->flat + msg_len, &magic, sizeof(cc_uint32));
-    memcpy((char *)msg->flat + msg->flat_len - sizeof(cc_uint32), &magic, sizeof(cc_uint32));
-
-    if ( flatpp != NULL )
-        *flatpp = msg->flat;
-    return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32
-cci_msg_calc_magic(void *flat, int flat_len, cc_uint32 * magicp)
-{
-    cc_uint32 magic = 0;
-    int i;
-       
-    for (i = 0; i < flat_len; i += sizeof(cc_uint32)) {
-        magic = magic ^ *(int *)((char *)flat + i);
-    }
-    *magicp = magic;
-    return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32 
-cci_msg_verify(void *flat, int flat_len, cc_uint32 * validp)  
-{
-    cc_uint32 *magic1, *magic2;
-    cc_uint32 *pheader_len;
-    cc_uint32 *ptotal_len;
-    cc_uint32 *pblob_len;
-    cc_uint32 *ptype;
-    cc_uint32 num_blobs = 0;
-    cc_uint32 zero = 0;
-    cc_uint32 msg_magic, msg_magic2;
-
-    if (flat == NULL || flat_len <= 0 || validp == NULL)
-        return ccErrBadParam;
-
-    pheader_len = flat;
-    ptotal_len = (cc_uint32 *)((char *)pheader_len + sizeof(cc_uint32));
-    ptype = (cc_uint32 *)((char *)ptotal_len + sizeof(cc_uint32));
-
-    if (*ptotal_len != flat_len) {
-        *validp = 0;
-        return ccNoError;
-    }
-    
-    if (*pheader_len > flat_len) {
-        /*too weak. We could verify header_len against type spec header.*/
-        *validp = 0;
-        return ccNoError;
-    }
-    if (*ptype > CC_MSG_MAX_TYPE) {
-        *validp = 0;
-        return ccNoError;
-    }
-
-    magic1 = (cc_uint32 *)((char *)ptype + sizeof(cc_uint32) + *pheader_len); 
-    if ((char *)magic1 - (char *)flat == (flat_len - 8)) {
-        /*There are no data blobs*/
-        magic2 = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));
-        num_blobs = 0;
-    } else {
-        pblob_len = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));
-        num_blobs = 1;
-
-        while (*pblob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) < (flat_len - sizeof(cc_uint32))) {
-            pblob_len = (cc_uint32 *)((char *)pblob_len + *pblob_len + sizeof(cc_uint32));
-            num_blobs++;
-        }
-
-        if (*pblob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) != (flat_len - sizeof(cc_uint32))) {
-            /*blobs didn't line up*/
-            *validp = 0;
-            return ccNoError;
-        }
-        magic2 = (cc_uint32 *)((char *)pblob_len + *pblob_len + sizeof(cc_uint32)); /*2nd magic should be directly after the last blob*/
-    }
-       
-    if (*magic1 != *magic2) {
-        *validp = 0;
-        return ccNoError;
-    }
-    msg_magic = *magic1;
-
-    printf("%d %d\n", (char *)magic1 - (char *)flat, (char *)magic2 - (char *)flat);
-
-    memcpy(magic1, &zero, sizeof(cc_uint32));
-    memcpy(magic2, &zero, sizeof(cc_uint32));
-    cci_msg_calc_magic(flat, flat_len, &msg_magic2);
-    if (msg_magic != msg_magic2) {
-        *validp = 0;
-        return ccNoError;
-    }
-    memcpy(magic1, &msg_magic, sizeof(cc_uint32));
-    memcpy(magic2, &msg_magic, sizeof(cc_uint32));
-
-    *validp = 1;
-    return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32
-cci_msg_unflatten(void *flat, int flat_len, cc_msg_t** msgpp) 
-{
-    cc_msg_t* msg;
-    char *cur_pos;
-    cc_uint32 blob_len;
-    char *blob;
-    cc_uint32 valid;
-    cc_int32 code;
-
-    if ( flat == NULL || flat_len <= 0 || msgpp == NULL )
-        return ccErrBadParam;
-
-    code = cci_msg_new(0, &msg);
-    if (code)
-        return code;
-
-    cci_msg_verify(flat, flat_len, &valid);
-    if (valid != 1) {
-        cci_msg_destroy(msg);
-        return ccErrBadParam;
-    }
-
-    cur_pos = flat;
-    msg->flat = flat;
-
-    msg->header_len = *(cc_uint32 *)cur_pos;
-    cur_pos += sizeof(cc_uint32);
-
-    msg->flat_len = *(cc_uint32 *)cur_pos;
-    cur_pos += sizeof(cc_uint32);
-
-    msg->type = *(cc_uint32 *)cur_pos;
-    cur_pos += sizeof(cc_uint32);
-
-    msg->header = (void *)malloc(msg->header_len);
-    if (msg->header == NULL) {
-        cci_msg_destroy(msg);
-        return ccErrNoMem;
-    }
-    memcpy(msg->header, cur_pos, msg->header_len);
-    cur_pos += msg->header_len;
-       
-    msg->magic = *(cc_uint32 *)cur_pos;
-    cur_pos += sizeof(cc_uint32);
-
-    if (cur_pos - (char *)flat != flat_len - 8) { /*at least 1 blob*/
-        blob_len = *(cc_uint32 *)cur_pos;
-        while (blob_len + (cur_pos - (char *)flat) + sizeof(cc_uint32) <= flat_len - sizeof(cc_uint32)) {
-            blob = (void *)malloc(blob_len);
-            if (blob == NULL) {
-                cci_msg_destroy(msg);
-                return ccErrNoMem;
-            }
-            memcpy(blob, cur_pos + sizeof(cc_uint32), blob_len);
-            cci_generic_list_append(msg->data_blobs, blob, blob_len, NULL);
-
-            cur_pos += sizeof(cc_uint32) + blob_len;
-            blob_len = *(int *)cur_pos;
-        }
-    }
-    *msgpp = msg;
-    return ccNoError;
-}
-
-cc_int32
-cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, void **blobp) 
-{
-    cc_generic_iterate_t*      gen_iterator;
-    cc_generic_list_node_t*    gen_node;
-    void *ret;
-    cc_uint32                   blob_pos;
-    cc_int32                    code;
-
-    /*Ensure that the message has been unflattened*/
-    if ( msg == NULL || msg->flat == NULL || blob_offset > msg->flat_len || 
-         blob_len > msg->flat_len - blob_offset || blobp == NULL)
-        return ccErrBadParam;
-
-    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
-    while (cci_generic_iterate_has_next(gen_iterator)) {
-        code = cci_generic_iterate_next(gen_iterator, &gen_node);
-        code = cci_msg_calc_blob_pos(msg, gen_node->data, gen_node->len, &blob_pos);
-        if (blob_pos == blob_offset && gen_node->len == blob_len)  {
-            free(gen_iterator);
-            ret = (void *)malloc(blob_len);
-            if (ret == NULL)
-                return ccErrNoMem;
-            memcpy(ret,(char *)msg->flat + blob_offset, blob_len);     
-            *blobp = ret;
-            return ccNoError;
-        }
-    }
-    free(gen_iterator);
-    return ccIteratorEnd;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return: 
- *
- * Errors: 
- *
- */
-cc_int32 
-cci_msg_destroy(cc_msg_t* msg) 
-{
-    if (msg->flat != NULL) 
-        free(msg->flat);
-    if (msg->header != NULL)
-        free(msg->flat);
-    cci_generic_list_destroy(msg->data_blobs);
-    free(msg);
-    return ccNoError;
-}
-
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+/*\r
+ * Verifiable, extensible message format.\r
+ *\r
+ * Format:\r
+ * <size of header block (header_len)>\r
+ * <size of *entire* message, including previous field (flat_len)>\r
+ * <message type (type)>\r
+ * <type specific header (header)>\r
+ * <magic number (magic)>\r
+ * <data blob 1 length>\r
+ * <data blob 1>\r
+ * <data blob 2 length>\r
+ * <data blob 2>\r
+ * ...\r
+ * <magic number (magic)>\r
+ *\r
+ * If the header has variable length data it is included in the data blobs. \r
+ * The header field has the offset from the beginning of the message of the 1st \r
+ * byte of the data and the length of the data.\r
+ */\r
+\r
+#include "CredentialsCache.h"\r
+#include "msg.h"\r
+#include "generic_lists.h"\r
+\r
+#include <stdlib.h>\r
+#include <memory.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+/**\r
+ * cci_msg_new()\r
+ *\r
+ * Purpose: Allocate and initialize a new cc_msg_t structure\r
+ *\r
+ * Input parameter (type) in host order\r
+ *\r
+ * Return:  non-NULL, the msg\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+cci_msg_new(cc_uint32 type, cc_msg_t** msgpp) \r
+{\r
+    // type should be validated.  If invalid set error to ccErrBadParam\r
+    cc_msg_t* msg;\r
+    \r
+    if ( type > CC_MSG_MAX_TYPE || msgpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    msg = (cc_msg_t*)malloc(sizeof(cc_msg_t));\r
+    if (msg == NULL)\r
+        return ccErrNoMem;\r
+\r
+    msg->type = type;\r
+    msg->flat = NULL;\r
+    msg->header = NULL;\r
+    msg->flat_len = 0;\r
+    msg->header_len = 0;\r
+    msg->magic = 0;\r
+    cci_generic_list_new(&msg->data_blobs);\r
+    if (msg->data_blobs == NULL) {\r
+        // pass on error from previous call\r
+        free(msg);\r
+        return ccErrNoMem;\r
+    }\r
+\r
+    *msgpp = msg;     \r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_msg_calc_header_size()\r
+ *\r
+ * Purpose: Calculates the size of the header\r
+ *\r
+ * Return:  the size in bytes\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+cci_msg_calc_header_size(cc_msg_t* msg, cc_uint32 * lenp) \r
+{\r
+    int header_len = 12; /* header size, entire size, type */\r
+\r
+    if ( msg == NULL || lenp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    header_len += msg->header_len;\r
+    *lenp = header_len;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cci_msg_calc_size()\r
+ *\r
+ * Purpose: Calculates the size of the message\r
+ *          (does not include the magic bytes)\r
+ *\r
+ * Return:  the size in bytes\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_calc_size(cc_msg_t* msg, cc_uint32 * lenp) \r
+{\r
+    cc_uint32 flat_len;\r
+    cc_generic_list_node_t* gen_node;\r
+    cc_generic_iterate_t* gen_iterator;\r
+       cc_int32 code;\r
+\r
+    if ( msg == NULL || lenp == NULL ) \r
+        return ccErrBadParam;\r
+\r
+    code = cci_msg_calc_header_size(msg, &flat_len);\r
+    if (code != ccNoError)\r
+        goto bad;\r
+\r
+    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);\r
+    if ( code != ccNoError )\r
+        goto bad;\r
+\r
+    while (cci_generic_iterate_has_next(gen_iterator)) {\r
+        code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
+        if (code != ccNoError)\r
+            break;\r
+        flat_len += gen_node->len + BLOB_LEN;\r
+    }\r
+    cci_generic_free_iterator(gen_iterator);\r
+    if (code != ccNoError)\r
+        goto bad;\r
+\r
+    flat_len += MAGIC_HEAD_LEN + MAGIC_DATA_LEN;\r
+    *lenp = flat_len;\r
+\r
+  bad:\r
+    return code;\r
+}\r
+\r
+/**\r
+ * cci_msg_add_data_blob()\r
+ *\r
+ * Purpose: Adds 'len' bytes of data to the msg\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_add_data_blob(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 *lenp) \r
+{\r
+    cc_int32 code;\r
+\r
+    if (msg == NULL || data == NULL || len <= 0 || lenp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = cci_generic_list_append(msg->data_blobs, data, len, NULL);\r
+    if ( code != ccNoError )\r
+        return code;\r
+    return cci_msg_calc_blob_pos(msg, data, len, lenp);\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_calc_blob_pos(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 * posp) \r
+{\r
+    cc_uint32 pos;\r
+    cc_generic_list_node_t* gen_node;\r
+    cc_generic_iterate_t* gen_iterator;\r
+    cc_int32 code;\r
+\r
+    code = cci_msg_calc_header_size(msg, &pos);\r
+    pos += sizeof(cc_uint32); /*+ sizeof(cc_uint32) for magic*/\r
+\r
+    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);\r
+    while (cci_generic_iterate_has_next(gen_iterator)) {\r
+        code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
+        if (gen_node->len != len && gen_node->data != data) {\r
+            pos += gen_node->len + sizeof(cc_uint32);\r
+        } else {\r
+            cci_generic_free_iterator(gen_iterator);\r
+            *posp = pos + sizeof(cc_uint32);\r
+            return ccNoError;\r
+        }\r
+    }\r
+    \r
+    cci_generic_free_iterator(gen_iterator);\r
+    return ccIteratorEnd;\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_add_header(cc_msg_t* msg, void *header, cc_uint32 header_len) \r
+{\r
+    if ( msg == NULL || header == NULL )\r
+        return ccErrBadParam;\r
+\r
+    msg->header = header;\r
+    msg->header_len = header_len;\r
+    return ccNoError;\r
+}\r
+\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32\r
+cci_msg_flatten(cc_msg_t* msg, void **flatpp) \r
+{\r
+    cc_generic_list_node_t* gen_node;\r
+    cc_generic_iterate_t* gen_iterator;\r
+    char *cur_pos;\r
+    cc_uint32 zero = 0;\r
+    cc_uint32 magic = 0;\r
+    cc_uint32 msg_len;\r
+    cc_uint32 u32;\r
+    cc_int32 code;\r
+\r
+    if (msg == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = cci_msg_calc_size(msg,&msg->flat_len);\r
+    if ( code != ccNoError )\r
+        return code;\r
+\r
+    if (msg->flat_len > CC_MSG_MAX_SIZE)\r
+        return ccErrBadParam;\r
+\r
+    msg->flat = (void *)malloc(msg->flat_len);\r
+    if (msg->flat == NULL)\r
+        return ccErrNoMem;\r
+    \r
+    cur_pos = msg->flat;\r
+\r
+    u32 = htonl(msg->header_len);\r
+    memcpy(cur_pos,&u32,sizeof(cc_uint32));\r
+    cur_pos+=sizeof(cc_uint32);\r
+\r
+    u32 = htonl(msg->flat_len);\r
+    memcpy(cur_pos,&u32,sizeof(cc_uint32));\r
+    cur_pos+=sizeof(cc_uint32);\r
+\r
+    u32 = htonl(msg->type);\r
+    memcpy(cur_pos,&u32,sizeof(cc_uint32));\r
+    cur_pos+=sizeof(cc_uint32);\r
+\r
+    /* header data is already in network order */\r
+    memcpy(cur_pos, msg->header, msg->header_len);\r
+    cur_pos += msg->header_len;\r
+\r
+    u32 = htonl(zero);\r
+    memcpy(cur_pos, &u32, sizeof(cc_uint32)); /*will be magic number later*/\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);\r
+    if ( code != ccNoError ) {\r
+        free(msg->flat);\r
+        return code;\r
+    }\r
+\r
+    while (cci_generic_iterate_has_next(gen_iterator)) {\r
+        code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
+        if (code != ccNoError) {\r
+            free(gen_iterator);\r
+            free(msg->flat);\r
+            return code;\r
+        }\r
+       u32 = htonl(gen_node->len);\r
+           memcpy(cur_pos, &u32, sizeof(cc_uint32));\r
+        cur_pos+=sizeof(cc_uint32);\r
+               \r
+       /* data already in network order */\r
+        memcpy(cur_pos, gen_node->data, gen_node->len);\r
+        cur_pos += gen_node->len;\r
+    }\r
+    free(gen_iterator);\r
+\r
+    u32 = htonl(zero);\r
+    memcpy(cur_pos, &u32, sizeof(cc_uint32)); /*magic number will go here later*/\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    if (cur_pos - (char *)msg->flat != msg->flat_len) {\r
+        fprintf(stderr, "ERROR cur_pos - msg->flat = %d\n",msg->flat_len);\r
+    }\r
+\r
+    cci_msg_calc_magic(msg->flat, msg->flat_len, &magic);\r
+    printf("magic = %d\n",magic);\r
+       \r
+    cci_msg_calc_header_size(msg, &msg_len);\r
+    memcpy((char *)msg->flat + msg_len, &magic, sizeof(cc_uint32));\r
+    memcpy((char *)msg->flat + msg->flat_len - sizeof(cc_uint32), &magic, sizeof(cc_uint32));\r
+\r
+    if ( flatpp != NULL )\r
+        *flatpp = msg->flat;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32\r
+cci_msg_calc_magic(void *flat, int flat_len, cc_uint32 * magicp)\r
+{\r
+    cc_uint32 magic = 0;\r
+    int i;\r
+       \r
+    for (i = 0; i < flat_len; i += sizeof(cc_uint32)) {\r
+        magic = magic ^ *(int *)((char *)flat + i);\r
+    }\r
+    *magicp = htonl(magic);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_verify(void *flat, int flat_len, cc_uint32 * validp)  \r
+{\r
+    cc_uint32 *magic1, *magic2;\r
+    cc_uint32 *pheader_len;\r
+    cc_uint32 header_len;\r
+    cc_uint32 *ptotal_len;\r
+    cc_uint32 total_len;\r
+    cc_uint32 *pblob_len;\r
+    cc_uint32 blob_len;\r
+    cc_uint32 *ptype;\r
+    cc_uint32 type;\r
+    cc_uint32 num_blobs = 0;\r
+    cc_uint32 zero = 0;\r
+    cc_uint32 msg_magic, msg_magic2;\r
+\r
+    if (flat == NULL || flat_len <= 0 || validp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    pheader_len = flat;\r
+    ptotal_len = (cc_uint32 *)((char *)pheader_len + sizeof(cc_uint32));\r
+    ptype = (cc_uint32 *)((char *)ptotal_len + sizeof(cc_uint32));\r
+\r
+    header_len = ntohl(*pheader_len);\r
+    total_len = ntohl(*ptotal_len);\r
+    type = ntohl(*ptype);\r
+\r
+    if (total_len != flat_len) {\r
+        *validp = 0;\r
+        return ccNoError;\r
+    }\r
+    \r
+    if (header_len > flat_len) {\r
+        /*too weak. We could verify header_len against type spec header.*/\r
+        *validp = 0;\r
+        return ccNoError;\r
+    }\r
+    if (type > CC_MSG_MAX_TYPE) {\r
+        *validp = 0;\r
+        return ccNoError;\r
+    }\r
+\r
+    magic1 = (cc_uint32 *)((char *)ptype + sizeof(cc_uint32) + header_len); \r
+    if ((char *)magic1 - (char *)flat == (flat_len - 8)) {\r
+        /*There are no data blobs*/\r
+        magic2 = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));\r
+        num_blobs = 0;\r
+    } else {\r
+        pblob_len = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));\r
+        num_blobs = 1;\r
+       blob_len = ntohl(*pblob_len);\r
+\r
+        while (blob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) < (flat_len - sizeof(cc_uint32))) {\r
+            pblob_len = (cc_uint32 *)((char *)pblob_len + blob_len + sizeof(cc_uint32));\r
+            num_blobs++;\r
+           blob_len = ntohl(*pblob_len);\r
+        }\r
+\r
+        if (blob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) != (flat_len - sizeof(cc_uint32))) {\r
+            /*blobs didn't line up*/\r
+            *validp = 0;\r
+            return ccNoError;\r
+        }\r
+        magic2 = (cc_uint32 *)((char *)pblob_len + blob_len + sizeof(cc_uint32)); /*2nd magic should be directly after the last blob*/\r
+    }\r
+       \r
+    if (*magic1 != *magic2) {\r
+        *validp = 0;\r
+        return ccNoError;\r
+    }\r
+    msg_magic = *magic1;\r
+\r
+    printf("%d %d\n", (char *)magic1 - (char *)flat, (char *)magic2 - (char *)flat);\r
+\r
+    memcpy(magic1, &zero, sizeof(cc_uint32));\r
+    memcpy(magic2, &zero, sizeof(cc_uint32));\r
+    cci_msg_calc_magic(flat, flat_len, &msg_magic2);\r
+    /* both msg_magic and msg_magic2 are in network order */\r
+    if (msg_magic != msg_magic2) {\r
+        *validp = 0;\r
+        return ccNoError;\r
+    }\r
+    memcpy(magic1, &msg_magic, sizeof(cc_uint32));\r
+    memcpy(magic2, &msg_magic, sizeof(cc_uint32));\r
+\r
+    *validp = 1;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32\r
+cci_msg_unflatten(void *flat, int flat_len, cc_msg_t** msgpp) \r
+{\r
+    cc_msg_t* msg;\r
+    char *cur_pos;\r
+    cc_uint32 blob_len;\r
+    char *blob;\r
+    cc_uint32 valid;\r
+    cc_int32 code;\r
+\r
+    if ( flat == NULL || flat_len <= 0 || msgpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    code = cci_msg_new(0, &msg);\r
+    if (code)\r
+        return code;\r
+\r
+    cci_msg_verify(flat, flat_len, &valid);\r
+    if (valid != 1) {\r
+        cci_msg_destroy(msg);\r
+        return ccErrBadParam;\r
+    }\r
+\r
+    cur_pos = flat;\r
+    msg->flat = flat;\r
+\r
+    msg->header_len = ntohl(*(cc_uint32 *)cur_pos);\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    msg->flat_len = ntohl(*(cc_uint32 *)cur_pos);\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    msg->type = ntohl(*(cc_uint32 *)cur_pos);\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    msg->header = (void *)malloc(msg->header_len);\r
+    if (msg->header == NULL) {\r
+        cci_msg_destroy(msg);\r
+        return ccErrNoMem;\r
+    }\r
+    memcpy(msg->header, cur_pos, msg->header_len);\r
+    cur_pos += msg->header_len;\r
+       \r
+    msg->magic = ntohl(*(cc_uint32 *)cur_pos);\r
+    cur_pos += sizeof(cc_uint32);\r
+\r
+    if (cur_pos - (char *)flat != flat_len - 8) { /*at least 1 blob*/\r
+        blob_len = ntohl(*(cc_uint32 *)cur_pos);\r
+        while (blob_len + (cur_pos - (char *)flat) + sizeof(cc_uint32) <= flat_len - sizeof(cc_uint32)) {\r
+            blob = (void *)malloc(blob_len);\r
+            if (blob == NULL) {\r
+                cci_msg_destroy(msg);\r
+                return ccErrNoMem;\r
+            }\r
+            memcpy(blob, cur_pos + sizeof(cc_uint32), blob_len);\r
+            cci_generic_list_append(msg->data_blobs, blob, blob_len, NULL);\r
+\r
+            cur_pos += sizeof(cc_uint32) + blob_len;\r
+            blob_len = ntohl(*(int *)cur_pos);\r
+        }\r
+    }\r
+    *msgpp = msg;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, char **blobp) \r
+{\r
+    cc_generic_iterate_t*      gen_iterator;\r
+    cc_generic_list_node_t*    gen_node;\r
+    void *ret;\r
+    cc_uint32                   blob_pos;\r
+    cc_int32                    code;\r
+\r
+    /*Ensure that the message has been unflattened*/\r
+    if ( msg == NULL || msg->flat == NULL || blob_offset > msg->flat_len || \r
+         blob_len > msg->flat_len - blob_offset || blobp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);\r
+    while (cci_generic_iterate_has_next(gen_iterator)) {\r
+        code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
+        code = cci_msg_calc_blob_pos(msg, gen_node->data, gen_node->len, &blob_pos);\r
+        if (blob_pos == blob_offset && gen_node->len == blob_len)  {\r
+            free(gen_iterator);\r
+            ret = (void *)malloc(blob_len);\r
+            if (ret == NULL)\r
+                return ccErrNoMem;\r
+            memcpy(ret,(char *)msg->flat + blob_offset, blob_len);     \r
+            *blobp = ret;\r
+            return ccNoError;\r
+        }\r
+    }\r
+    free(gen_iterator);\r
+    return ccIteratorEnd;\r
+}\r
+\r
+/**\r
+ * cc_msg_\r
+ *\r
+ * Purpose:\r
+ *\r
+ * Return: \r
+ *\r
+ * Errors: \r
+ *\r
+ */\r
+cc_int32 \r
+cci_msg_destroy(cc_msg_t* msg) \r
+{\r
+    if (msg->flat != NULL) \r
+        free(msg->flat);\r
+    if (msg->header != NULL)\r
+        free(msg->header);\r
+    cci_generic_list_destroy(msg->data_blobs);\r
+    free(msg);\r
+    return ccNoError;\r
+}\r
+\r
diff --git a/src/lib/ccapi/doc/implementation-notes.txt b/src/lib/ccapi/doc/implementation-notes.txt
new file mode 100644 (file)
index 0000000..e6150fb
--- /dev/null
@@ -0,0 +1,156 @@
+The following are notes describing the requirements of the Platform\r
+Specific code necessary for constructing a Portable CCAPI.\r
+\r
+Directory structure:\r
+\r
+ lib/ccapi/client    - platform independent client library\r
+ lib/ccapi/common    - platform independent common library\r
+ lib/ccapi/include   - platform independent header files\r
+ lib/ccapi/mac       - macosx specific headers, libraries, executables\r
+ lib/ccapi/server    - platform independent server library\r
+ lib/ccapi/windows   - windows specific headers, libraries, executables\r
+\r
+\r
+Platform Independent Design:\r
+\r
+The functionality of the Portable CCAPI is implemented in the platform\r
+independent libraries.   The common library encapsulates the functions\r
+for managing generic lists, iterators, and messages as well as routines\r
+formarshalling and unmarshalling.  The client library provides the\r
+client side routines for issuing requests to the ccapi server minus the\r
+platform dependent glue required for shared library initialization,\r
+cleanup, and interprocess communications.  The server library provides\r
+server side functionality for managing credential cache collections,\r
+caches, credentials, iterators, and their handles minus the platform\r
+dependent glue for process initialization, interprocess communication,\r
+session security, and critical section enforcement.\r
+\r
+\r
+Platform Dependent Design Requirements:\r
+\r
+The platform dependent code is responsible for producing a shared\r
+client library:\r
+\r
+ + the shared library is built from cc_client.lib and cc_common.lib plus\r
+   platform dependent glue\r
+\r
+   - [windows] link cc_client.lib and cc_common.lib with platform\r
+     dependent routines and export list (.def) to produce\r
+     krbcc32.{lib,dll}\r
+\r
+ + initialization and cleanup\r
+\r
+   - [windows] provide DllMain entry point providing Process and Thread\r
+     attachment and detachment routines\r
+\r
+ + implement cci_perform_rpc() function used by cc_client.lib\r
+     cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response)\r
+\r
+   - cci_perform_rpc() takes an input request cc_msg_t object, flattens\r
+     it with cci_msg_flatten() and sends the contents of unsigned char\r
+     buffer request->flat of length request->flat_len to the server\r
+     utilizing a platform specific interprocess communication method.\r
+\r
+   - upon IPC success, cci_perform_rpc() unflattens the response buffer\r
+     with cci_msg_unflatten() and returns the new cc_msg_t response\r
+     object to the caller.\r
+\r
+   - cci_perform_rpc() is responsible for performing any necessary\r
+     session security management.  For example, on Windows the Logon\r
+     Provider executes under the local machine's "SYSTEM" account within\r
+     session 0 and not under the account of the user that is logging in\r
+     nor within the session the user's desktop and applications will be\r
+     running within.  It is the responsibility of cci_perform_rpc() and\r
+     the platform dependent IPC mechanism to communicate the user's\r
+     security identifiers to the server.\r
+\r
+     For Windows, this means that the platform specific IPC messaging\r
+     allows a username and session identifier to be sent separate from\r
+     the username and session identifier that will be obtained via the\r
+     use of Local RPC. If the Local RPC authenticates the user as\r
+     "SYSTEM" and session 0, then the communicated values (if provided)\r
+     will be used instead.\r
+\r
+ + implement client side of IPC routine.\r
+\r
+   - [windows] the client side IPC routine is produced by compiling a\r
+     IDL file.  The IDL defines an interface with a single function:\r
+\r
+     __int32 ccapi_Message  (\r
+                 [in] handle_t h,\r
+                 [in, string]  unsigned char * client_name,\r
+                 [in] struct _LUID  luid,\r
+                 [in] __int32 in_len,\r
+                 [in, string, size_is(in_len)] unsigned char * in_buf,\r
+                 [in] __int32 out_size,\r
+                 [out] __int32 * out_len,\r
+                 [out, string, size_is(out_size)] unsigned char\r
+                     out_buf[*]);\r
+\r
+     The handle is a Local RPC specific handle used to identify the\r
+     request. The client_name and luid are the override values for the\r
+     username and session identifier for use during Windows login.  The\r
+     rest of the parameters provide the input and output buffers as well\r
+     as allow communication of the actual length of the message data\r
+     that is required by cci_msg_unflatten().\r
+\r
+ + if the CCAPI server is per-session, the shared client library is\r
+   responsible for ensuring that an instance of the server is running in\r
+   the current session.  If not, the library must initiate an instance\r
+   of the CCAPI server prior to performing any IPC requests.\r
+\r
+The platform dependent code is responsible for producing a server\r
+executable:\r
+\r
+ + The server executable is built from cc_server.lib and cc_common.lib\r
+   plus platform dependent glue.\r
+\r
+   - [windows] The Windows CCAPI Server is being built using the\r
+     per-system model.  The platform specific code is responsible for\r
+     providing NT Service Management routines for installation and\r
+     removal as well as the NT Service Entry Points used when the\r
+     process is started as an NT Service.\r
+\r
+     link cc_server.lib and cc_common.lib with platform dependent\r
+     routines to produce krbcc32s.exe.\r
+\r
+ + Based upon the platform requirements, the server may be constructed\r
+   to be per-session or per-system.   The selected IPC mechanism must\r
+   enforce the appropriate scoping.\r
+\r
+ + The platform dependent startup routines will perform platform\r
+   specific initialization including the IPC engine and call the\r
+   platform independent initialization routine ccs_serv_initialize()\r
+\r
+ + The platform dependent shutdown routines will perform platform\r
+   specific cleanup including the IPC engine and call the platform\r
+   independent function ccs_serv_cleanup() prior to process termination.\r
+\r
+ + For each inbound CCAPI request, the server will unmarshall the\r
+   request using cci_msg_unflatten() to produce a cc_msg_t object,\r
+   construct cc_auth_info_t and cc_session_info_t objects to represent\r
+   the platform dependent authentication and session data, call\r
+   ccs_serv_process_msg() to process the request, call cci_msg_flatten()\r
+   to marhall the response, transmit the response to the caller, and\r
+   then cleanup the request and response cc_msg_t objects with\r
+   cci_msg_destroy().\r
+\r
+ + The cc_auth_info_t and cc_session_info_t objects are structures\r
+   storing opaque binary (data, length) representations of the\r
+   authentication and session data.   These are stored as part of ccache\r
+   collection and ccaches.  ccs_serv_process_msg() will perform a binary\r
+   comparison of the stored data with the data provided in the current\r
+   request.   If they do not match, the request will be denied.  It is\r
+   necessary that the data generated data always be the same.   If\r
+   username strings are not case-sensitive, they should be normalized\r
+   before being passed to ccs_serv_process_msg().\r
+\r
+ + The current cc_server.lib routines assume that one request at a time\r
+   is being processed.  If the IPC engine allows for more than one\r
+   request to be simultaneously received in separate threads, then the\r
+   call to ccs_serv_process_msg() must be wrapped by a critical section.\r
+   Future enhancements to cc_server.lib will allow for per-object\r
+   mutexes.  When available the platform specific glue must provide\r
+   functions to create, obtain, release, and destroy mutex objects.\r
+\r
+\r
index dd60fa46d6542a0cf8ca4d7e65df59ed61ac3f09..95c4fe79ba1c710b9c774d8aaf55f2e0c1a536d4 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 1998-2004 by the Massachusetts Institute of Technology.
+ * Copyright 1998-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 /*
  * Declarations for Credentials Cache API Library
  *
- * API specification: <http://web.mit.edu/pismere/kerberos/ccache-api-v2.html>
+ * API specification: <http://web.mit.edu/pismere/kerberos/ccache-api-v3.html>
  *
  *     Revision 1: Frank Dabek, 6/4/1998
  *     Revision 2: meeroh, 2/24/1999
  *      Revision 3: meeroh, 11/12/1999
- *      Revision 4: jaltman, 10/27/2004
+ *      Revision 6: jaltman, 10/27/2004
  *
  */
  
 #define __CREDENTIALSCACHE__
 
 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
-       #include <TargetConditionals.h>
-    #if TARGET_RT_MAC_CFM
-        #error "Use KfM 4.0 SDK headers for CFM compilation."
-    #endif
+#include <TargetConditionals.h>
 #endif
 
-#if TARGET_OS_MAC
-    #include <sys/types.h>
+#if defined(_WIN32)
+#include <winsock.h>
 #endif
 
 #ifdef __cplusplus
@@ -74,11 +71,20 @@ extern "C" {
 #endif /* __cplusplus */
 
 #if TARGET_OS_MAC
-    #if defined(__MWERKS__)
-        #pragma import on
-        #pragma enumsalwaysint on
-    #endif
-    #pragma options align=mac68k
+#pragma options align=mac68k
+#endif
+    
+#if defined(_WIN32)
+#define CCACHE_API     __declspec(dllexport)
+
+#if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)
+#if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR)
+#error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform.
+#endif /* _TIME_T_DEFINED */
+#define _USE_32BIT_TIME_T
+#endif 
+#else
+#define CCACHE_API
 #endif
 
 #include <time.h>
@@ -92,14 +98,16 @@ enum {
     ccapi_version_2 = 2,
     ccapi_version_3 = 3,
     ccapi_version_4 = 4,
-    ccapi_version_5 = 5
+    ccapi_version_5 = 5,
+    ccapi_version_6 = 6,
+    ccapi_version_max = ccapi_version_6
 };
  
 /* Errors */
 enum {
-    ccNoError                                                  = 0,
+    ccNoError                                          = 0,
 
-    ccIteratorEnd                                              = 201,
+    ccIteratorEnd                                      = 201,
     ccErrBadParam,
     ccErrNoMem,
     ccErrInvalidContext,
@@ -111,7 +119,7 @@ enum {
     ccErrInvalidCredentialsIterator,
     ccErrInvalidLock,
 
-    ccErrBadName,                                              /* 211 */
+    ccErrBadName,                                      /* 211 */
     ccErrBadCredentialsVersion,
     ccErrBadAPIVersion,
     ccErrContextLocked,
@@ -123,7 +131,7 @@ enum {
     ccErrNeverDefault,
     ccErrCredentialsNotFound,
 
-    ccErrCCacheNotFound,                                       /* 221 */
+    ccErrCCacheNotFound,                               /* 221 */
     ccErrContextNotFound,
     ccErrServerUnavailable,
     ccErrServerInsecure,
@@ -135,20 +143,22 @@ enum {
 };
 
 /* Credentials versions */
-enum {
+enum cc_credential_versions {
     cc_credentials_v4 = 1,
     cc_credentials_v5 = 2,
     cc_credentials_v4_v5 = 3
 };
 
 /* Lock types */
-enum {
-    cc_lock_read = 1,
-    cc_lock_write = 2
+enum cc_lock_types {
+    cc_lock_read = 0,
+    cc_lock_write = 1,
+    cc_lock_upgrade = 2,
+    cc_lock_downgrade = 3
 };
 
 /* Locking Modes */
-enum {
+enum cc_lock_modes {
     cc_lock_noblock = 0,
     cc_lock_block = 1
 };
@@ -157,12 +167,20 @@ enum {
  * Basic types
  */
  
-typedef char           cc_int8;
-typedef unsigned char  cc_uint8;
-typedef int            cc_int32;
-typedef unsigned int   cc_uint32;
-typedef time_t         cc_time_t;
-typedef void *         cc_handle;
+typedef char                           cc_int8;
+typedef unsigned char                  cc_uint8;
+typedef int                            cc_int32;
+typedef unsigned int                   cc_uint32;
+#if defined (WIN32)
+typedef __int64                        cc_int64;
+typedef unsigned __int64       cc_uint64;
+#else
+typedef long long              cc_int64;
+typedef unsigned long long     cc_uint64;
+#endif
+typedef time_t                         cc_time;
+typedef cc_int64               cc_time64;
+typedef cc_uint64                      cc_handle;
 
 /*
  * API types
@@ -190,10 +208,11 @@ typedef struct cc_credentials_f cc_credentials_f;
 /* Credentials types */
 
 enum { /* Make sure all of these are multiples of four (for alignment sanity) */
-    cc_v4_name_size            = 40,
+    cc_v4_name_size    = 40,
     cc_v4_instance_size        = 40,
     cc_v4_realm_size   = 40,
-    cc_v4_ticket_size  = 1254
+    cc_v4_ticket_size  = 1254,
+    cc_v4_key_size     = 8
 };
 
 enum cc_string_to_key_type {
@@ -211,10 +230,10 @@ struct cc_credentials_v4_t {
     char                       service [cc_v4_name_size];
     char                       service_instance [cc_v4_instance_size];
     char                       realm [cc_v4_realm_size];
-    unsigned char              session_key [8];
+    unsigned char              session_key [cc_v4_key_size];
     cc_int32                   kvno;
     cc_int32                   string_to_key_type;
-    cc_time_t                  issue_date;
+    cc_time                    issue_date;
     cc_int32                   lifetime;
     cc_uint32                  address;
     cc_int32                   ticket_size;
@@ -233,10 +252,10 @@ struct cc_credentials_v5_t {
     char*                      client;
     char*                      server;
     cc_data                    keyblock;
-    cc_time_t                  authtime;
-    cc_time_t                  starttime;
-    cc_time_t                  endtime;
-    cc_time_t                  renew_till;
+    cc_time                    authtime;
+    cc_time                    starttime;
+    cc_time                    endtime;
+    cc_time                    renew_till;
     cc_uint32                  is_skey;
     cc_uint32                  ticket_flags;
     cc_data**                  addresses;
@@ -320,7 +339,7 @@ struct  cc_context_f {
                                 cc_context_t context);
     cc_int32    (*get_change_time) (
                                 cc_context_t context,
-                                cc_time_t* time);
+                                cc_time* time);
     cc_int32    (*get_default_ccache_name) (
                                 cc_context_t context,
                                 cc_string_t* name);
@@ -397,16 +416,16 @@ struct cc_ccache_f {
                                  cc_ccache_t destination);
     cc_int32    (*lock) (
                                  cc_ccache_t ccache,
-                                 cc_uint32 block,
-                                 cc_uint32 lock_type);
+                                 cc_uint32 lock_type,
+                                 cc_uint32 block);
     cc_int32    (*unlock) (
                                  cc_ccache_t ccache);
     cc_int32    (*get_last_default_time) (
                                  cc_ccache_t ccache,
-                                 cc_time_t* time);
+                                 cc_time* time);
     cc_int32    (*get_change_time) (
                                  cc_ccache_t ccache,
-                                 cc_time_t* time);
+                                 cc_time* time);
     cc_int32    (*compare) (
                                 cc_ccache_t ccache,
                                 cc_ccache_t compare_to,
@@ -414,11 +433,11 @@ struct cc_ccache_f {
     cc_int32   (*get_kdc_time_offset) (
                                 cc_ccache_t ccache,
                                 cc_int32       credentials_version,
-                                cc_time_t*     time_offset);
+                                cc_time*       time_offset);
     cc_int32   (*set_kdc_time_offset) (
                                 cc_ccache_t ccache,
                                 cc_int32       credentials_version,
-                                cc_time_t      time_offset);
+                                cc_time        time_offset);
                                 
     cc_int32   (*clear_kdc_time_offset) (
                                 cc_ccache_t    ccache,
@@ -446,6 +465,9 @@ struct cc_ccache_iterator_f {
     cc_int32    (*next) (
                                  cc_ccache_iterator_t iter,
                                  cc_ccache_t* ccache);
+
+    cc_int32   (*clone) (       cc_ccache_iterator_t iter,
+                                cc_ccache_iterator_t* new_iter);
 };
 
 struct cc_credentials_iterator_f {
@@ -453,17 +475,20 @@ struct cc_credentials_iterator_f {
                                  cc_credentials_iterator_t iter);
     cc_int32    (*next) (
                                  cc_credentials_iterator_t iter,
-                                 cc_credentials_t* ccache);
+                                 cc_credentials_t* cred);
+
+    cc_int32   (*clone) (       cc_credentials_iterator_t iter,
+                                cc_credentials_iterator_t* new_iter);
 };
 
 /*
  * API functions
  */
  
-cc_int32 cc_initialize (
+CCACHE_API cc_int32 cc_initialize (
        cc_context_t*           outContext,
-       cc_int32                        inVersion,
-       cc_int32*                       outSupportedVersion,
+       cc_int32                inVersion,
+       cc_int32*               outSupportedVersion,
        char const**            outVendor);
        
 /*
@@ -488,8 +513,8 @@ cc_int32 cc_initialize (
                        ((context) -> functions -> create_new_ccache (context, version, principal, ccache))
 #define                cc_context_new_ccache_iterator(context, iterator)                                               \
                        ((context) -> functions -> new_ccache_iterator (context, iterator))
-#define                cc_context_lock(context, type, lock)                                                                    \
-                       ((context) -> functions -> lock (context, type, lock))
+#define                cc_context_lock(context, type, block)                                                                   \
+                       ((context) -> functions -> lock (context, type, block))
 #define                cc_context_unlock(context)                                                                                              \
                        ((context) -> functions -> unlock (context))
 #define                cc_context_compare(context, compare_to, equal)                                                  \
@@ -515,8 +540,8 @@ cc_int32 cc_initialize (
                        ((ccache) -> functions -> remove_credentials (ccache, credentials))
 #define                cc_ccache_new_credentials_iterator(ccache, iterator)                                    \
                        ((ccache) -> functions -> new_credentials_iterator (ccache, iterator))
-#define                cc_ccache_lock(ccache, lock)                                                                                    \
-                       ((ccache) -> functions -> lock (ccache, lock))
+#define                cc_ccache_lock(ccache, type, block)                                                                                     \
+                       ((ccache) -> functions -> lock (ccache, type, block))
 #define                cc_ccache_unlock(ccache, unlock)                                                                                \
                        ((ccache) -> functions -> unlock (ccache, unlock))
 #define                cc_ccache_get_last_default_time(ccache, time)                                                   \
@@ -528,11 +553,11 @@ cc_int32 cc_initialize (
 #define                cc_ccache_compare(ccache, compare_to, equal)                                                    \
                        ((ccache) -> functions -> compare (ccache, compare_to, equal))
 #define                cc_ccache_get_kdc_time_offset(ccache, version, time)                                    \
-            ((ccache) -> functions -> get_kdc_time_offset (version, time))
+                        ((ccache) -> functions -> get_kdc_time_offset (version, time))
 #define                cc_ccache_set_kdc_time_offset(ccache, version, time)                                    \
-            ((ccache) -> functions -> set_kdc_time_offset (version, time))
+                        ((ccache) -> functions -> set_kdc_time_offset (version, time))
 #define                cc_ccache_clear_kdc_time_offset(ccache, version)                                                \
-            ((ccache) -> functions -> clear_kdc_time_offset (version))
+                        ((ccache) -> functions -> clear_kdc_time_offset (version))
 
 #define                cc_string_release(string)                                                                                               \
                        ((string) -> functions -> release (string))
@@ -546,18 +571,18 @@ cc_int32 cc_initialize (
                        ((iterator) -> functions -> release (iterator))
 #define                cc_ccache_iterator_next(iterator, ccache)                                                               \
                        ((iterator) -> functions -> next (iterator, ccache))
+#define                cc_ccache_iterator_clone(iterator, new_iter)                                                            \
+                       ((iterator) -> functions -> clone (iterator, new_iter))
        
 #define                cc_credentials_iterator_release(iterator)                                                               \
                        ((iterator) -> functions -> release (iterator))
 #define                cc_credentials_iterator_next(iterator, credentials)                                             \
                        ((iterator) -> functions -> next (iterator, credentials))
+#define                cc_credentials_iterator_clone(iterator, new_iter)                                                               \
+                       ((iterator) -> functions -> clone (iterator, new_iter))
                        
 #if TARGET_OS_MAC
-    #if defined(__MWERKS__)
-        #pragma enumsalwaysint reset
-        #pragma import reset
-    #endif
-       #pragma options align=reset
+#pragma options align=reset
 #endif
 
 #ifdef __cplusplus
index 401e093f43f7871726fbe44d93c13db27574fe2c..5505bf29fe9c192bb4c8216284c219ff18ada31f 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 1998-2004 by the Massachusetts Institute of Technology.
+ * Copyright 1998-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 #ifndef __CREDENTIALSCACHE2__
 #define __CREDENTIALSCACHE2__
  
-#include <Kerberos/CredentialsCache.h>
+#include "CredentialsCache.h"
+
 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
-       #include <TargetConditionals.h>
-    #if TARGET_RT_MAC_CFM
-        #error "Use KfM 4.0 SDK headers for CFM compilation."
-    #endif
+#include <TargetConditionals.h>
 #endif
 
 #ifdef __cplusplus
@@ -61,13 +59,9 @@ extern "C" {
 #endif /* __cplusplus */
 
 #if TARGET_OS_MAC
-    #if defined(__MWERKS__)
-        #pragma import on
-        #pragma enumsalwaysint on
-    #endif
-    #pragma options align=mac68k
+#pragma options align=mac68k
 #endif
-
+    
 /* Some old types get directly mapped to new types */
 
 typedef cc_context_d apiCB;
@@ -87,10 +81,10 @@ typedef struct cc_credentials_v5_compat {
     char*                      client;
     char*                      server;
     cc_data_compat             keyblock;
-    cc_time_t                  authtime;
-    cc_time_t                  starttime;
-    cc_time_t                  endtime;
-    cc_time_t                  renew_till;
+    cc_time                    authtime;
+    cc_time                    starttime;
+    cc_time                    endtime;
+    cc_time                    renew_till;
     cc_uint32                  is_skey;
     cc_uint32                  ticket_flags;
     cc_data_compat**           addresses;
@@ -185,25 +179,32 @@ enum {
     CC_CRED_MAX
 };
 
-cc_int32 cc_shutdown (
+enum {
+    CC_LOCK_UNLOCK = 1,
+    CC_LOCK_READER = 2,
+    CC_LOCK_WRITER = 3,
+    CC_LOCK_NOBLOCK = 16
+};
+
+CCACHE_API cc_int32 cc_shutdown (
         apiCB**                                ioContext);
        
-cc_int32 cc_get_NC_info (
+CCACHE_API cc_int32 cc_get_NC_info (
        apiCB*                          inContext,
        infoNC***                       outInfo);
        
-cc_int32 cc_get_change_time (
+CCACHE_API cc_int32 cc_get_change_time (
        apiCB*                          inContext,
-       cc_time_t*                      outTime);
+       cc_time*                        outTime);
        
-cc_int32 cc_open (
+CCACHE_API cc_int32 cc_open (
        apiCB*                          inContext,
        const char*                     inName,
        cc_int32                        inVersion,
        cc_uint32                       inFlags,
        ccache_p**                      outCCache);
        
-cc_int32 cc_create (
+CCACHE_API cc_int32 cc_create (
        apiCB*                          inContext,
        const char*                     inName,
        const char*                     inPrincipal,
@@ -211,94 +212,95 @@ cc_int32 cc_create (
        cc_uint32                       inFlags,
        ccache_p**                      outCCache);
        
-cc_int32 cc_close (
+CCACHE_API cc_int32 cc_close (
        apiCB*                          inContext,
        ccache_p**                      ioCCache);
        
-cc_int32 cc_destroy (
+CCACHE_API cc_int32 cc_destroy (
        apiCB*                          inContext,
        ccache_p**                      ioCCache);
        
-cc_int32 cc_seq_fetch_NCs_begin (
+CCACHE_API cc_int32 cc_seq_fetch_NCs_begin (
        apiCB*                          inContext,
-       ccache_cit**            outIterator);
+       ccache_cit**                    outIterator);
 
-cc_int32 cc_seq_fetch_NCs_next (
+CCACHE_API cc_int32 cc_seq_fetch_NCs_next (
        apiCB*                          inContext,
        ccache_p**                      outCCache,
        ccache_cit*                     inIterator);
 
-cc_int32 cc_seq_fetch_NCs_end (
+CCACHE_API cc_int32 cc_seq_fetch_NCs_end (
        apiCB*                          inContext,
-       ccache_cit**            ioIterator);
+       ccache_cit**                    ioIterator);
 
-cc_int32 cc_get_name (
+CCACHE_API cc_int32 cc_get_name (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        char**                          outName);
        
-cc_int32 cc_get_cred_version (
+CCACHE_API cc_int32 cc_get_cred_version (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        cc_int32*                       outVersion);
        
-cc_int32 cc_set_principal (
+CCACHE_API cc_int32 cc_set_principal (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        cc_int32                        inVersion,
        char*                           inPrincipal);
        
-cc_int32 cc_get_principal (
+CCACHE_API cc_int32 cc_get_principal (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        char**                          outPrincipal);
        
-cc_int32 cc_store (
+CCACHE_API cc_int32 cc_store (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        cred_union                      inCredentials);
 
-cc_int32 cc_remove_cred (
+CCACHE_API cc_int32 cc_remove_cred (
        apiCB*                          inContext,
        ccache_p*                       inCCache,
        cred_union                      inCredentials);
 
-cc_int32 cc_seq_fetch_creds_begin (
+CCACHE_API cc_int32 cc_seq_fetch_creds_begin (
        apiCB*                          inContext,
-       const ccache_p*         inCCache,
-       ccache_cit**            outIterator);
+       const ccache_p*                 inCCache,
+       ccache_cit**                    outIterator);
 
-cc_int32 cc_seq_fetch_creds_next (
+CCACHE_API cc_int32 cc_seq_fetch_creds_next (
        apiCB*                          inContext,
-       cred_union**            outCreds,
+       cred_union**                    outCreds,
        ccache_cit*                     inIterator);
        
-cc_int32 cc_seq_fetch_creds_end (
+CCACHE_API cc_int32 cc_seq_fetch_creds_end (
        apiCB*                          inContext,
-       ccache_cit**            ioIterator);
+       ccache_cit**                    ioIterator);
        
-cc_int32 cc_free_principal (
+CCACHE_API cc_int32 cc_free_principal (
        apiCB*                          inContext,
        char**                          ioPrincipal);
 
-cc_int32 cc_free_name (
+CCACHE_API cc_int32 cc_free_name (
        apiCB*                          inContext,
        char**                          ioName);
 
-cc_int32 cc_free_creds (
+CCACHE_API cc_int32 cc_free_creds (
        apiCB*                          inContext,
-       cred_union**            creds);
+       cred_union**                    creds);
 
-cc_int32 cc_free_NC_info (
+CCACHE_API cc_int32 cc_free_NC_info (
        apiCB*                          inContext,
        infoNC***                       ioInfo);
        
+CCACHE_API cc_int32 cc_lock_request(
+        apiCB*                                 inContext,
+        const ccache_p*                inCCache,
+        const cc_int32                         lock_type);
+
 #if TARGET_OS_MAC
-    #if defined(__MWERKS__)
-        #pragma enumsalwaysint reset
-        #pragma import reset
-    #endif
-       #pragma options align=reset
+#pragma options align=reset
 #endif
 
 #ifdef __cplusplus
diff --git a/src/lib/ccapi/include/cc_rpc.h b/src/lib/ccapi/include/cc_rpc.h
new file mode 100644 (file)
index 0000000..0f14724
--- /dev/null
@@ -0,0 +1,52 @@
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+\r
+#ifndef __CC_RPC_H__\r
+#define __CC_RPC_H__\r
+\r
+#include "msg.h"\r
+\r
+cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response);\r
+\r
+#endif /* __CC_RPC_H__ */\r
similarity index 52%
rename from src/lib/ccapi/server/datastore.h
rename to src/lib/ccapi/include/datastore.h
index a92c60636bfc032fdbc82580cd7f642a23178d46..7bb8b093d8acc453f63120276415efe659a2bc23 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
 
 #include "CredentialsCache.h"
 #include "rpc_auth.h"
-
-enum cc_list_type {
-    generic = 0,
-    context,
-    cache,
-    credentials
-};
-
-struct cc_generic_list_node_t {
-    cc_uint8*                          data;
-    cc_uint32                          len;
-    struct cc_generic_list_node_t*     next;
-    struct cc_generic_list_node_t*     prev;
-};
-typedef struct cc_generic_list_node_t cc_generic_list_node_t;
-
-struct cc_generic_list_head_t {
-    enum cc_list_type                   type;
-    cc_generic_list_node_t*            head;
-    cc_generic_list_node_t*            tail; 
-};      
-typedef struct cc_generic_list_head_t cc_generic_list_head_t;
-
-
-struct cc_generic_iterate_t {
-    cc_generic_list_node_t*            next;
-};
-typedef struct cc_generic_iterate_t cc_generic_iterate_t;
-
-typedef cc_generic_list_head_t cc_context_list_head_t;
-typedef cc_generic_list_node_t cc_context_list_node_t;
-
-typedef cc_generic_list_head_t cc_ccache_list_head_t;
-typedef cc_generic_list_node_t cc_ccache_list_node_t;
-
-typedef cc_generic_list_head_t cc_credentials_list_head_t;
-typedef cc_generic_list_node_t cc_credentials_list_node_t;
+#include "generic_lists.h"
 
 struct cc_context_iterate_t {
     cc_context_list_node_t*    next;
@@ -104,7 +68,7 @@ struct cc_credentials_iterate_t {
 };
 typedef struct cc_credentials_iterate_t cc_credentials_iterate_t;
 
-struct cc_lock_t {
+struct cc_lock {
     cc_uint32                           read_locks;             /* count of read locks (>= 0) */
     cc_uint32                           write_locks;            /* count of write locks (0 or 1) */
     void *                              platform_data;          /* platform specific implementation data */
@@ -118,7 +82,7 @@ struct cc_server_context_t {
     cc_int32                           api_version;            /*Version our client passed in on init (ccapi_version_X) */
     cc_auth_info_t*                    auth_info;              /*auth info passed in from RPC*/
     cc_session_info_t*                 session_info;           /*session info passed in from RPC*/
-    cc_time_t                          changed;                /*date of last change to this context*/
+    cc_time64                          changed;                /*date of last change to this context*/
     cc_int32                            error;                  /*last error code*/
     cc_lock_t                           locks;                  /*are we locked?*/
 };                                                              
@@ -129,10 +93,10 @@ struct cc_server_ccache_t {
     char*                              principal_v4;           /*v4 principal associated with this cache*/
     char*                              principal_v5;           /*v5 principal associated with this cache*/
     cc_uint32                          versions;               /*versions of creds supported (from cc_credentials enum in CredentialsCache.h)*/
-    cc_time_t                          changed;                /*date of last change to ccache*/
+    cc_time64                          changed;                /*date of last change to ccache*/
     cc_int32                           kdc_set;                /*is the KDC time offset initialized?*/
-    cc_time_t                          kdc_offset;             /*offset of our clock relative kdc*/
-    cc_time_t                          last_default;           /*the last date when we were default*/
+    cc_time64                          kdc_offset;             /*offset of our clock relative kdc*/
+    cc_time64                          last_default;           /*the last date when we were default*/
     cc_int32                           is_default;             /*is this the default cred on this ccache?*/
     cc_generic_list_head_t*            active_iterators;       /*iterators which clients have opened on this cache*/
     cc_credentials_list_head_t*        creds;                          /*list of creds stored in this ccache*/
@@ -150,82 +114,69 @@ typedef struct cc_server_credentials_t cc_server_credentials_t;
 
 /*Note: cci means Credential Cache Internal, to differentiate from exported API macros*/
 
-cc_int32 cci_generic_iterate_has_next(cc_generic_iterate_t *iterate);
-cc_int32 cci_generic_iterate_next(cc_generic_iterate_t *iterate, cc_generic_list_node_t**);
-
-cc_int32 cci_generic_list_new(cc_generic_list_head_t **);
-cc_int32 cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);
-cc_int32 cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);
-cc_int32 cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem);
-cc_int32 cci_generic_free_element(cc_generic_list_node_t* node);
-cc_int32 cci_generic_list_destroy(cc_generic_list_head_t* head);
-cc_int32 cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t**);
-cc_int32 cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t**);
-cc_int32 cci_generic_free_iterator(cc_generic_iterate_t* iterator);
-
-cc_int32 cci_context_iterate_has_next(struct cc_context_iterate_t *iterate);
-cc_int32 cci_context_iterate_next(struct cc_context_iterate_t *iterate, cc_context_list_node_t**);
-
-cc_int32 cci_ccache_iterate_has_next(struct cc_ccache_iterate_t *iterate);
-cc_int32 cci_ccache_iterate_next(struct cc_ccache_iterate_t *iterate, cc_ccache_list_node_t**);
-
-cc_int32 cci_credentials_iterate_has_next(cc_credentials_iterate_t *iterate);
-cc_int32 cci_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t **);
-
-cc_int32 cci_context_list_new(cc_context_list_head_t**);
-cc_int32 cci_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**);
-cc_int32 cci_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**);
-cc_int32 cci_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem);
-cc_int32 cci_context_list_iterator(cc_context_list_head_t *head, struct cc_context_iterate_t**);
-cc_int32 cci_context_free_iterator(struct cc_context_iterate_t *iterator);
-cc_int32 cci_context_list_destroy(cc_context_list_head_t* head) ;
-cc_int32 cci_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t**);
-
-cc_int32 cci_ccache_list_new(cc_ccache_list_head_t**);
-cc_int32 cci_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**);
-cc_int32 cci_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**);
-cc_int32 cci_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem);
-cc_int32 cci_ccache_list_iterator(cc_ccache_list_head_t *head, struct cc_ccache_iterate_t**);
-cc_int32 cci_ccache_free_iterator(struct cc_ccache_iterate_t *iterator);
-cc_int32 cci_ccache_list_destroy(cc_ccache_list_head_t* head) ;
-cc_int32 cci_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t**);
-
-
-cc_int32 cci_credentials_list_new(cc_credentials_list_head_t**);
-cc_int32 cci_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**);
-cc_int32 cci_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**);
-cc_int32 cci_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem);
-cc_int32 cci_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t**);
-cc_int32 cci_credentials_free_iterator(cc_credentials_iterate_t* iterator);
-cc_int32 cci_credentials_list_destroy(cc_credentials_list_head_t* head) ;
-cc_int32 cci_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t**) ;
-
-
-cc_int32 cci_context_new(int api_version, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_server_context_t** ) ;
-cc_int32 cci_context_get_default_ccache_name(cc_server_context_t* ctx, char **);
-cc_int32 cci_context_find_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t**);
-cc_int32 cci_context_open_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t** );
-cc_int32 cci_context_create_ccache(cc_server_context_t* ctx, char *name, int creds_version, char *principal, cc_server_ccache_t**);
-cc_int32 cci_context_create_default_ccache(cc_server_context_t* ctx, int creds_version, char *principal, cc_server_ccache_t**);
-cc_int32 cci_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t**);
-cc_int32 cci_context_compare(cc_server_context_t* a, cc_server_context_t* b);
-cc_int32 cci_context_destroy(cc_server_context_t* ctx);
-cc_int32 cci_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache);
-
-cc_int32 cci_ccache_new(char *name, char *principal, int cred_vers, cc_server_ccache_t**);
-cc_int32 cci_ccache_check_version(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat);
-cc_int32 cci_ccache_check_principal(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat);
-cc_int32 cci_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials);
-cc_int32 cci_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials);
-cc_int32 cci_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination);
-cc_int32 cci_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time_t* offset);
-cc_int32 cci_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time_t offset);
-cc_int32 cci_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache);
-cc_int32 cci_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator);
-cc_int32 cci_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal);
-cc_int32 cci_ccache_set_principal(cc_server_ccache_t* ccache, cc_int32 version, char * principal);
-cc_int32 cci_ccache_free_principal(char * principal);
-cc_int32 cci_ccache_destroy(cc_server_ccache_t* ccache);
-void    cci_ccache_changed(cc_server_ccache_t* ccache);
-cc_int32 cci_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result);
+cc_int32 ccs_context_iterate_has_next(struct cc_context_iterate_t *iterate);
+cc_int32 ccs_context_iterate_next(struct cc_context_iterate_t *iterate, cc_context_list_node_t**);
+
+cc_int32 ccs_ccache_iterate_has_next(struct cc_ccache_iterate_t *iterate);
+cc_int32 ccs_ccache_iterate_next(struct cc_ccache_iterate_t *iterate, cc_ccache_list_node_t**);
+
+cc_int32 ccs_credentials_iterate_has_next(cc_credentials_iterate_t *iterate);
+cc_int32 ccs_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t **);
+
+cc_int32 ccs_context_list_new(cc_context_list_head_t**);
+cc_int32 ccs_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**);
+cc_int32 ccs_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**);
+cc_int32 ccs_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem);
+cc_int32 ccs_context_list_iterator(cc_context_list_head_t *head, struct cc_context_iterate_t**);
+cc_int32 ccs_context_free_iterator(struct cc_context_iterate_t *iterator);
+cc_int32 ccs_context_list_destroy(cc_context_list_head_t* head) ;
+cc_int32 ccs_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t**);
+
+cc_int32 ccs_ccache_list_new(cc_ccache_list_head_t**);
+cc_int32 ccs_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**);
+cc_int32 ccs_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**);
+cc_int32 ccs_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem);
+cc_int32 ccs_ccache_list_iterator(cc_ccache_list_head_t *head, struct cc_ccache_iterate_t**);
+cc_int32 ccs_ccache_free_iterator(struct cc_ccache_iterate_t *iterator);
+cc_int32 ccs_ccache_list_destroy(cc_ccache_list_head_t* head) ;
+cc_int32 ccs_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t**);
+
+
+cc_int32 ccs_credentials_list_new(cc_credentials_list_head_t**);
+cc_int32 ccs_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**);
+cc_int32 ccs_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**);
+cc_int32 ccs_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem);
+cc_int32 ccs_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t**);
+cc_int32 ccs_credentials_free_iterator(cc_credentials_iterate_t* iterator);
+cc_int32 ccs_credentials_list_destroy(cc_credentials_list_head_t* head) ;
+cc_int32 ccs_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t**) ;
+
+
+cc_int32 ccs_context_new(int api_version, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_server_context_t** ) ;
+cc_int32 ccs_context_get_default_ccache_name(cc_server_context_t* ctx, char **);
+cc_int32 ccs_context_find_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t**);
+cc_int32 ccs_context_open_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t** );
+cc_int32 ccs_context_create_ccache(cc_server_context_t* ctx, char *name, int creds_version, char *principal, cc_server_ccache_t**);
+cc_int32 ccs_context_create_default_ccache(cc_server_context_t* ctx, int creds_version, char *principal, cc_server_ccache_t**);
+cc_int32 ccs_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t**);
+cc_int32 ccs_context_compare(cc_server_context_t* a, cc_server_context_t* b);
+cc_int32 ccs_context_destroy(cc_server_context_t* ctx);
+cc_int32 ccs_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache);
+
+cc_int32 ccs_ccache_new(char *name, char *principal, int cred_vers, cc_server_ccache_t**);
+cc_int32 ccs_ccache_check_version(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat);
+cc_int32 ccs_ccache_check_principal(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat);
+cc_int32 ccs_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials);
+cc_int32 ccs_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials);
+cc_int32 ccs_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination);
+cc_int32 ccs_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64* offset);
+cc_int32 ccs_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64 offset);
+cc_int32 ccs_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache);
+cc_int32 ccs_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator);
+cc_int32 ccs_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal);
+cc_int32 ccs_ccache_set_principal(cc_server_ccache_t* ccache, cc_int32 version, char * principal);
+cc_int32 ccs_ccache_free_principal(char * principal);
+cc_int32 ccs_ccache_destroy(cc_server_ccache_t* ccache);
+void    ccs_ccache_changed(cc_server_ccache_t* ccache);
+cc_int32 ccs_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result);
 #endif /*__CCDATASTOREH__*/
diff --git a/src/lib/ccapi/include/generic_lists.h b/src/lib/ccapi/include/generic_lists.h
new file mode 100644 (file)
index 0000000..14b7ae2
--- /dev/null
@@ -0,0 +1,102 @@
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+/*\r
+ * Prototypes and data structures for datastore.\r
+ *\r
+ */\r
+\r
+\r
+#ifndef __CC_GENERIC_LISTS_H_\r
+#define __CC_GENERIC_LISTS_H_\r
+\r
+enum cc_list_type {\r
+    generic = 0,\r
+    context,\r
+    cache,\r
+    credentials\r
+};\r
+\r
+struct cc_generic_list_node_t {\r
+    cc_uint8*                          data;\r
+    cc_uint32                          len;\r
+    struct cc_generic_list_node_t*     next;\r
+    struct cc_generic_list_node_t*     prev;\r
+};\r
+typedef struct cc_generic_list_node_t cc_generic_list_node_t;\r
+\r
+struct cc_generic_list_head_t {\r
+    enum cc_list_type                   type;\r
+    cc_generic_list_node_t*            head;\r
+    cc_generic_list_node_t*            tail; \r
+};      \r
+typedef struct cc_generic_list_head_t cc_generic_list_head_t;\r
+\r
+\r
+struct cc_generic_iterate_t {\r
+    cc_generic_list_node_t*            next;\r
+};\r
+typedef struct cc_generic_iterate_t cc_generic_iterate_t;\r
+\r
+typedef cc_generic_list_head_t cc_context_list_head_t;\r
+typedef cc_generic_list_node_t cc_context_list_node_t;\r
+\r
+typedef cc_generic_list_head_t cc_ccache_list_head_t;\r
+typedef cc_generic_list_node_t cc_ccache_list_node_t;\r
+\r
+typedef cc_generic_list_head_t cc_credentials_list_head_t;\r
+typedef cc_generic_list_node_t cc_credentials_list_node_t;\r
+\r
+cc_int32 cci_generic_iterate_has_next(cc_generic_iterate_t *iterate);\r
+cc_int32 cci_generic_iterate_next(cc_generic_iterate_t *iterate, cc_generic_list_node_t**);\r
+\r
+cc_int32 cci_generic_list_new(cc_generic_list_head_t **);\r
+cc_int32 cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);\r
+cc_int32 cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);\r
+cc_int32 cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem);\r
+cc_int32 cci_generic_free_element(cc_generic_list_node_t* node);\r
+cc_int32 cci_generic_list_destroy(cc_generic_list_head_t* head);\r
+cc_int32 cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t**);\r
+cc_int32 cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t**);\r
+cc_int32 cci_generic_free_iterator(cc_generic_iterate_t* iterator);\r
+\r
+#endif /* __CC_GENERIC_LISTS_H_ */\r
index 19b9463b08246c4d7744b33d48787befae16a972..ca6b12e968f0803b7d1a1670e1623cd8c60fccbf 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -41,7 +41,6 @@
  * $
  */
 
-#define FLAT_CREDS_V5_VERSION   1
 struct cc_flat_data {
     cc_uint32                   type;
     cc_uint32                   length;
@@ -49,15 +48,16 @@ struct cc_flat_data {
 };
 typedef struct cc_flat_data cc_flat_data;
 
+#define FLAT_CREDS_V5_VERSION   1
 struct cci_flat_creds_v5 {
     cc_uint32                   version;        /* version of this structure */
     cc_flat_data                client;
     cc_flat_data                server;
     cc_flat_data               keyblock;
-    cc_time_t                  authtime;
-    cc_time_t                  starttime;
-    cc_time_t                  endtime;
-    cc_time_t                  renew_till;
+    cc_time64                  authtime;
+    cc_time64                  starttime;
+    cc_time64                  endtime;
+    cc_time64                  renew_till;
     cc_uint32                  is_skey;
     cc_uint32                  ticket_flags;
     cc_uint32                   address_count;
@@ -67,6 +67,25 @@ struct cci_flat_creds_v5 {
     cc_uint32                   authdata_count;
     cc_uint32                  authdata;  /* offset to array */
 };
+typedef struct cci_flat_creds_v5 cci_flat_creds_v5_t;
+
+struct cci_flat_creds_v4 {
+    cc_uint32                  version;
+    char                       principal [cc_v4_name_size];
+    char                       principal_instance [cc_v4_instance_size];
+    char                       service [cc_v4_name_size];
+    char                       service_instance [cc_v4_instance_size];
+    char                       realm [cc_v4_realm_size];
+    unsigned char              session_key [cc_v4_key_size];
+    cc_int32                   kvno;
+    cc_int32                   string_to_key_type;
+    cc_time64                  issue_date;
+    cc_int32                   lifetime;
+    cc_uint32                  address;
+    cc_int32                   ticket_size;
+    unsigned char              ticket [cc_v4_ticket_size];
+};      
+typedef struct cci_flat_creds_v4 cci_flat_creds_v4_t;
 
 cc_int32
 cci_creds_v4_marshall( cc_credentials_v4_t * creds, 
index 0d712d666415790949860ae3b6e315c87e0bb92b..79b9a7f72e118b61fbfce9fe448ef689f1ecd753 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -43,7 +43,7 @@
 
 /*
  * Verifiable, extensible message format.
- *
+ * 
  * Format:
  * <size of header block (header_len)>
  * <size of *entire* message, including previous field (flat_len)>
  * If the header has variable length data it is included in the data blobs. 
  * The header field has the offset from the beginning of the message of the 1st 
  * byte of the data and the length of the data.
- *
  */
 
 #ifndef __CC_MSG_H__
 #define __CC_MSG_H__
 
 #include "CredentialsCache.h"
+#include "generic_lists.h"
 
 struct  cc_msg_t {
     cc_uint32 type;                    /*type of message*/
@@ -87,16 +87,15 @@ enum {
     ccmsg_CTX_RELEASE,
     ccmsg_CTX_GET_CHANGE_TIME,
     ccmsg_CTX_GET_DEFAULT_CCACHE_NAME,
-    ccmsg_CTX_COMPARE,
+    ccmsg_CTX_CCACHE_OPEN,
+    ccmsg_CTX_CCACHE_OPEN_DEFAULT,
+    ccmsg_CTX_CCACHE_CREATE,
+    ccmsg_CTX_CCACHE_CREATE_DEFAULT,
+    ccmsg_CTX_CCACHE_CREATE_UNIQUE,
     ccmsg_CTX_NEW_CCACHE_ITERATOR,
     ccmsg_CTX_LOCK,
     ccmsg_CTX_UNLOCK,
-    ccmsg_CTX_CLONE,
-    ccmsg_CCACHE_OPEN,
-    ccmsg_CCACHE_OPEN_DEFAULT,
-    ccmsg_CCACHE_CREATE,
-    ccmsg_CCACHE_CREATE_DEFAULT,
-    ccmsg_CCACHE_CREATE_UNIQUE,
+    ccmsg_CTX_COMPARE,
     ccmsg_CCACHE_RELEASE,
     ccmsg_CCACHE_DESTROY,
     ccmsg_CCACHE_SET_DEFAULT,
@@ -104,29 +103,28 @@ enum {
     ccmsg_CCACHE_GET_NAME,
     ccmsg_CCACHE_GET_PRINCIPAL,
     ccmsg_CCACHE_SET_PRINCIPAL,
-    ccmsg_CCACHE_CREDS_ITERATOR,
+    ccmsg_CCACHE_NEW_CREDS_ITERATOR,
     ccmsg_CCACHE_STORE_CREDS,
     ccmsg_CCACHE_REM_CREDS,
+    ccmsg_CCACHE_MOVE,
+    ccmsg_CCACHE_LOCK,
+    ccmsg_CCACHE_UNLOCK,
     ccmsg_CCACHE_GET_LAST_DEFAULT_TIME,
     ccmsg_CCACHE_GET_CHANGE_TIME,
-    ccmsg_CCACHE_MOVE,
     ccmsg_CCACHE_COMPARE,
     ccmsg_CCACHE_GET_KDC_TIME_OFFSET,
     ccmsg_CCACHE_SET_KDC_TIME_OFFSET,
     ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET,
     ccmsg_CCACHE_ITERATOR_RELEASE,
     ccmsg_CCACHE_ITERATOR_NEXT,
-    ccmsg_CCACHE_LOCK,
-    ccmsg_CCACHE_UNLOCK,
+    ccmsg_CCACHE_ITERATOR_CLONE,
     ccmsg_CREDS_ITERATOR_RELEASE,
     ccmsg_CREDS_ITERATOR_NEXT,
-    ccmsg_CREDS_RELEASE,
-    ccmsg_CREDS_V4,
-    ccmsg_CREDS_V5
+    ccmsg_CREDS_ITERATOR_CLONE
 };      
 
 #define CC_MSG_MAX_SIZE        1073741824 /*2^30*/
-#define CC_MSG_MAX_TYPE ccmsg_CREDS_V5
+#define CC_MSG_MAX_TYPE ccmsg_CREDS_ITERATOR_CLONE
 #define BLOB_LEN (sizeof(cc_uint32))
 #define MAGIC_DATA_LEN (sizeof(cc_uint32))
 #define MAGIC_HEAD_LEN (sizeof(cc_uint32))
@@ -141,6 +139,23 @@ cc_int32 cci_msg_flatten(cc_msg_t* msg, void **);
 cc_int32 cci_msg_calc_magic(void *flat, int flat_len, cc_uint32 * sizep);
 cc_int32 cci_msg_verify(void* flat, int flat_len, cc_uint32 * sizep);
 cc_int32 cci_msg_unflatten(void *flat, int flat_len, cc_msg_t** msgpp);
-cc_int32 cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, void **);
+cc_int32 cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, char **);
 cc_int32 cci_msg_destroy(cc_msg_t* msg);
+
+/* Add missing byte swapping macros for 64-bit values */
+#ifdef MAC
+#define htonll(x) OSSwapHostToBigInt64(x)
+#define ntohll(x) OSSwapBigToHostInt64(x)
+#else 
+#ifdef _WIN32
+#ifdef _M_IX86
+#define htonll(x) _byteswap_uint64(x)
+#define ntohll(x) _byteswap_uint64(x)
+#else
+#define htonll(x) (x)
+#define ntohll(x) (x)
+#endif
+#endif
+#endif
+
 #endif /*__CC_MSG_H__*/
index a27c2d2f126e1eb3abbfd64b40efea48b19dee56..b5a9acd6d56439f3f05cb34c6ff88f0a6e091510 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -57,6 +57,8 @@
  * size divisible by 4. This is to ensure correct alignment
  * and stop different compilers from inserting padding bytes in
  * different places.
+ *
+ * All values are stored in network byte order.
  */
 
 struct ccmsg_ctx_only_t {
@@ -81,18 +83,18 @@ struct ccmsg_init_resp_t {
 typedef struct ccmsg_init_t ccmsg_init_t;
 typedef struct ccmsg_init_resp_t ccmsg_init_resp_t;
 
-struct ccmsg_clone_t {
+struct ccmsg_ctx_clone_t {
     cc_handle   ctx;
     cc_uint32  in_version;             /*client API version*/
 };
-struct ccmsg_clone_resp_t {
+struct ccmsg_ctx_clone_resp_t {
     cc_handle  out_ctx;                /*handle on this ctx*/
     cc_uint32  out_version;            /*server API version*/
     cc_uint32  vendor_offset;          /*offset of vendor blob*/
     cc_uint32  vendor_length;          /*length of vendor blob*/
 };      
-typedef struct ccmsg_clone_t ccmsg_clone_t;
-typedef struct ccmsg_clone_resp_t ccmsg_clone_resp_t;
+typedef struct ccmsg_ctx_clone_t ccmsg_ctx_clone_t;
+typedef struct ccmsg_ctx_clone_resp_t ccmsg_ctx_clone_resp_t;
 
 struct ccmsg_ctx_release_t {
     cc_handle  ctx;    /*# of ctx to release*/
@@ -103,7 +105,7 @@ struct ccmsg_ctx_get_change_time_t {
     cc_handle  ctx;
 };
 struct ccmsg_ctx_get_change_time_resp_t {
-    cc_time_t  time;
+    cc_time64  time;
 };
 typedef struct ccmsg_ctx_get_change_time_t ccmsg_ctx_get_change_time_t;
 typedef struct ccmsg_ctx_get_change_time_resp_t ccmsg_ctx_get_change_time_resp_t;
@@ -304,7 +306,7 @@ struct ccmsg_ccache_get_last_default_time_t {
     cc_handle  ccache;
 };
 struct ccmsg_ccache_get_last_default_time_resp_t {
-    cc_time_t  last_default_time;
+    cc_time64  last_default_time;
 };
 typedef struct ccmsg_ccache_get_last_default_time_t ccmsg_ccache_get_last_default_time_t;
 typedef struct ccmsg_ccache_get_last_default_time_resp_t ccmsg_ccache_get_last_default_time_resp_t;
@@ -314,7 +316,7 @@ struct ccmsg_ccache_get_change_time_t {
     cc_handle  ccache;
 };
 struct ccmsg_ccache_get_change_time_resp_t {
-    cc_time_t  time;
+    cc_time64  time;
 };
 typedef struct ccmsg_ccache_get_change_time_t ccmsg_ccache_get_change_time_t;
 typedef struct ccmsg_ccache_get_change_time_resp_t ccmsg_ccache_get_change_time_resp_t;
@@ -336,7 +338,7 @@ struct ccmsg_ccache_get_kdc_time_offset_t {
     cc_int32    creds_version;
 };      
 struct ccmsg_ccache_get_kdc_time_offset_resp_t {
-    cc_time_t  offset;
+    cc_time64  offset;
 };
 typedef struct ccmsg_ccache_get_kdc_time_offset_t ccmsg_ccache_get_kdc_time_offset_t;
 typedef struct ccmsg_ccache_get_kdc_time_offset_resp_t ccmsg_ccache_get_kdc_time_offset_resp_t;
@@ -344,7 +346,7 @@ typedef struct ccmsg_ccache_get_kdc_time_offset_resp_t ccmsg_ccache_get_kdc_time
 struct ccmsg_ccache_set_kdc_time_offset_t {
     cc_handle  ctx;
     cc_handle  ccache;
-    cc_time_t  offset;
+    cc_time64  offset;
     cc_int32    creds_version;
 };
 typedef struct ccmsg_ccache_set_kdc_time_offset_t ccmsg_ccache_set_kdc_time_offset_t;
@@ -372,6 +374,16 @@ struct ccmsg_ccache_iterator_next_resp_t {
 typedef struct ccmsg_ccache_iterator_next_t ccmsg_ccache_iterator_next_t;
 typedef struct ccmsg_ccache_iterator_next_resp_t ccmsg_ccache_iterator_next_resp_t;
 
+struct ccmsg_ccache_iterator_clone_t {
+    cc_handle   ctx;
+    cc_handle  iterator;
+};
+struct ccmsg_ccache_iterator_clone_resp_t {
+    cc_handle  iterator;
+};      
+typedef struct ccmsg_ccache_iterator_clone_t ccmsg_ccache_iterator_clone_t;
+typedef struct ccmsg_ccache_iterator_clone_resp_t ccmsg_ccache_iterator_clone_resp_t;
+
 struct ccmsg_creds_iterator_release_t {
     cc_handle  ctx;
     cc_handle  ccache;
@@ -393,37 +405,14 @@ struct ccmsg_creds_iterator_next_resp_t {
 typedef struct ccmsg_creds_iterator_next_t ccmsg_creds_iterator_next_t;
 typedef struct ccmsg_creds_iterator_next_resp_t ccmsg_creds_iterator_next_resp_t;
 
-struct ccmsg_creds_v4_t {
-    cc_uint32 offset;
-    cc_uint32 len;
-};
-typedef struct ccmsg_creds_v4_t ccmsg_creds_v4_t;
-
-struct ccmsg_creds_v5_t {
-    cc_uint32 client_offset;
-    cc_uint32 client_len;
-    cc_uint32 server_offset;
-    cc_uint32 server_len;
-    cc_uint32 keyblock_offset;
-    cc_uint32 keyblock_len;
-    cc_time_t authtime;
-    cc_time_t starttime;
-    cc_time_t endtime;
-    cc_time_t renewtime;
-    cc_uint32 is_skey;
-    cc_uint32 ticket_flags;
-    cc_uint32 address_count;
-    cc_uint32 address_offset;
-    cc_uint32 address_len;
-    cc_uint32 ticket_offset;
-    cc_uint32 ticket_len;
-    cc_uint32 ticket2_offset;
-    cc_uint32 ticket2_len;
-    cc_uint32 authdata_count;
-    cc_uint32 authdata_offset;
-    cc_uint32 authdata_len;
-};
-typedef struct ccmsg_creds_v5_t ccmsg_creds_v5_t;
-
+struct ccmsg_creds_iterator_clone_t {
+    cc_handle   ctx;
+    cc_handle  iterator;
+};
+struct ccmsg_creds_iterator_clone_resp_t {
+    cc_handle  iterator;
+};      
+typedef struct ccmsg_creds_iterator_clone_t ccmsg_creds_iterator_clone_t;
+typedef struct ccmsg_creds_iterator_clone_resp_t ccmsg_creds_iterator_clone_resp_t;
 
 #endif /*__MSG_HEADERS_H__*/
similarity index 95%
rename from src/lib/ccapi/server/rpc_auth.h
rename to src/lib/ccapi/include/rpc_auth.h
index 21d7db501cfd66fdae646d9df0518b6a9efb64d6..010a1e2a510b0d6c861b6c134a187c8c9eeb6af9 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -66,6 +66,6 @@ struct cc_session_info_t {
 };
 typedef struct cc_session_info_t cc_session_info_t;
 
-cc_int32 cci_rpc_is_authorized(cc_auth_info_t* msg_auth, cc_session_info_t* msg_session, cc_auth_info_t* stored_auth, cc_session_info_t* stored_session, cc_uint32 *authorizedp);
+cc_int32 ccs_rpc_is_authorized(cc_auth_info_t* msg_auth, cc_session_info_t* msg_session, cc_auth_info_t* stored_auth, cc_session_info_t* stored_session, cc_uint32 *authorizedp);
 
 #endif /*__RPC_AUTH_H__*/
diff --git a/src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.pbxuser b/src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.pbxuser
new file mode 100644 (file)
index 0000000..ea15e54
--- /dev/null
@@ -0,0 +1,2005 @@
+// !$*UTF8*$!
+{
+       08FB7793FE84155DC02AAC07 /* Project object */ = {
+               activeBuildConfigurationName = Debug;
+               activeExecutable = A1E70D5E0A38B796007BE3E3 /* CCacheServer */;
+               activeTarget = A1E70D5C0A38B796007BE3E3 /* CCacheServer */;
+               addToTargets = (
+               );
+               breakpoints = (
+               );
+               breakpointsGroup = A1E70D500A38B5F3007BE3E3 /* XCBreakpointsBucket */;
+               codeSenseManager = A1E70CFE0A38B536007BE3E3 /* Code sense */;
+               executables = (
+                       A1E70D5E0A38B796007BE3E3 /* CCacheServer */,
+               );
+               perUserDictionary = {
+                       PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       811,
+                                       20,
+                                       48,
+                                       43,
+                                       43,
+                                       20,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFileDataSource_FiletypeID,
+                                       PBXFileDataSource_Filename_ColumnID,
+                                       PBXFileDataSource_Built_ColumnID,
+                                       PBXFileDataSource_ObjectSize_ColumnID,
+                                       PBXFileDataSource_Errors_ColumnID,
+                                       PBXFileDataSource_Warnings_ColumnID,
+                                       PBXFileDataSource_Target_ColumnID,
+                               );
+                       };
+                       PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
+                               PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+                               PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+                               PBXFileTableDataSourceColumnWidthsKey = (
+                                       20,
+                                       200,
+                                       608,
+                                       20,
+                                       48,
+                                       43,
+                                       43,
+                               );
+                               PBXFileTableDataSourceColumnsKey = (
+                                       PBXFileDataSource_FiletypeID,
+                                       PBXFileDataSource_Filename_ColumnID,
+                                       PBXTargetDataSource_PrimaryAttribute,
+                                       PBXFileDataSource_Built_ColumnID,
+                                       PBXFileDataSource_ObjectSize_ColumnID,
+                                       PBXFileDataSource_Errors_ColumnID,
+                                       PBXFileDataSource_Warnings_ColumnID,
+                               );
+                       };
+                       PBXPerProjectTemplateStateSaveDate = 171582174;
+                       PBXWorkspaceStateSaveDate = 171582174;
+               };
+               perUserProjectItems = {
+                       A1E70DF70A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DF70A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70DF80A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DF80A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70DF90A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DF90A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70DFA0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DFA0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70DFB0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DFB0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70DFD0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70DFD0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E010A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E010A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E020A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E020A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E060A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E060A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E090A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E090A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E0A0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E0A0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E0B0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E0B0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E0C0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E0C0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E100A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E100A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E110A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E110A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E120A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E120A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E130A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E130A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E140A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E140A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E150A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E150A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E160A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E160A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E170A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E170A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E180A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E180A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E1B0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E1B0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E1E0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E1E0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E1F0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E1F0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E200A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E200A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E250A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E250A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E260A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E260A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E290A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E290A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E2A0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E2A0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E2B0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E2B0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E2D0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E2D0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E2E0A38C765007BE3E3 /* PBXTextBookmark */ = A1E70E2E0A38C765007BE3E3 /* PBXTextBookmark */;
+                       A1E70E380A38C778007BE3E3 /* PBXTextBookmark */ = A1E70E380A38C778007BE3E3 /* PBXTextBookmark */;
+                       A1E70E3D0A38C78C007BE3E3 /* PBXTextBookmark */ = A1E70E3D0A38C78C007BE3E3 /* PBXTextBookmark */;
+                       A1E70E410A38C78C007BE3E3 /* PBXTextBookmark */ = A1E70E410A38C78C007BE3E3 /* PBXTextBookmark */;
+                       A1E70E430A38C791007BE3E3 /* PBXTextBookmark */ = A1E70E430A38C791007BE3E3 /* PBXTextBookmark */;
+                       A1E70E450A38C791007BE3E3 /* PBXTextBookmark */ = A1E70E450A38C791007BE3E3 /* PBXTextBookmark */;
+                       A1E70E4A0A38C7BE007BE3E3 /* PBXTextBookmark */ = A1E70E4A0A38C7BE007BE3E3 /* PBXTextBookmark */;
+                       A1E70E520A38C9FD007BE3E3 /* PBXTextBookmark */ = A1E70E520A38C9FD007BE3E3 /* PBXTextBookmark */;
+                       A1E70E530A38C9FD007BE3E3 /* PBXTextBookmark */ = A1E70E530A38C9FD007BE3E3 /* PBXTextBookmark */;
+                       A1E70E560A38C9FD007BE3E3 /* PBXTextBookmark */ = A1E70E560A38C9FD007BE3E3 /* PBXTextBookmark */;
+                       A1E70E580A38C9FD007BE3E3 /* PBXTextBookmark */ = A1E70E580A38C9FD007BE3E3 /* PBXTextBookmark */;
+                       A1E70E6F0A38CA08007BE3E3 /* PBXTextBookmark */ = A1E70E6F0A38CA08007BE3E3 /* PBXTextBookmark */;
+                       A1E70E770A38CA55007BE3E3 /* PBXTextBookmark */ = A1E70E770A38CA55007BE3E3 /* PBXTextBookmark */;
+                       A1E70E7D0A38CA55007BE3E3 /* PBXTextBookmark */ = A1E70E7D0A38CA55007BE3E3 /* PBXTextBookmark */;
+                       A1E70E9C0A38CAF1007BE3E3 /* PBXTextBookmark */ = A1E70E9C0A38CAF1007BE3E3 /* PBXTextBookmark */;
+                       A1E70EA80A38CB24007BE3E3 /* PBXTextBookmark */ = A1E70EA80A38CB24007BE3E3 /* PBXTextBookmark */;
+                       A1E70EAB0A38CB24007BE3E3 /* PBXTextBookmark */ = A1E70EAB0A38CB24007BE3E3 /* PBXTextBookmark */;
+                       A1E70EB50A38CB4D007BE3E3 /* PBXTextBookmark */ = A1E70EB50A38CB4D007BE3E3 /* PBXTextBookmark */;
+                       A1E70EC30A38CC14007BE3E3 /* PBXTextBookmark */ = A1E70EC30A38CC14007BE3E3 /* PBXTextBookmark */;
+                       A1E70ECB0A38CC4C007BE3E3 /* PBXTextBookmark */ = A1E70ECB0A38CC4C007BE3E3 /* PBXTextBookmark */;
+                       A1E70ED70A38CCB6007BE3E3 /* PBXTextBookmark */ = A1E70ED70A38CCB6007BE3E3 /* PBXTextBookmark */;
+                       A1E70EE20A38CCD6007BE3E3 /* PBXTextBookmark */ = A1E70EE20A38CCD6007BE3E3 /* PBXTextBookmark */;
+                       A1E70EFE0A38CD66007BE3E3 /* PBXTextBookmark */ = A1E70EFE0A38CD66007BE3E3 /* PBXTextBookmark */;
+                       A1E70F0F0A38CE21007BE3E3 /* PBXTextBookmark */ = A1E70F0F0A38CE21007BE3E3 /* PBXTextBookmark */;
+                       A1E70F440A38D252007BE3E3 /* PBXTextBookmark */ = A1E70F440A38D252007BE3E3 /* PBXTextBookmark */;
+                       A1E70F450A38D252007BE3E3 /* PBXTextBookmark */ = A1E70F450A38D252007BE3E3 /* PBXTextBookmark */;
+                       A1E70F8B0A38D3B4007BE3E3 /* PBXTextBookmark */ = A1E70F8B0A38D3B4007BE3E3 /* PBXTextBookmark */;
+                       A1E70F9C0A38D41E007BE3E3 /* PBXTextBookmark */ = A1E70F9C0A38D41E007BE3E3 /* PBXTextBookmark */;
+                       A1E70F9D0A38D41E007BE3E3 /* PBXTextBookmark */ = A1E70F9D0A38D41E007BE3E3 /* PBXTextBookmark */;
+                       A1E70FC60A38D560007BE3E3 /* PBXTextBookmark */ = A1E70FC60A38D560007BE3E3 /* PBXTextBookmark */;
+                       A1E70FC80A38D560007BE3E3 /* PBXTextBookmark */ = A1E70FC80A38D560007BE3E3 /* PBXTextBookmark */;
+                       A1E70FC90A38D560007BE3E3 /* PBXTextBookmark */ = A1E70FC90A38D560007BE3E3 /* PBXTextBookmark */;
+                       A1E70FCA0A38D560007BE3E3 /* PBXTextBookmark */ = A1E70FCA0A38D560007BE3E3 /* PBXTextBookmark */;
+                       A1E70FCD0A38D560007BE3E3 /* PBXTextBookmark */ = A1E70FCD0A38D560007BE3E3 /* PBXTextBookmark */;
+                       A1E70FD80A38D573007BE3E3 /* PBXTextBookmark */ = A1E70FD80A38D573007BE3E3 /* PBXTextBookmark */;
+                       A1E70FEE0A38D7C0007BE3E3 /* PBXTextBookmark */ = A1E70FEE0A38D7C0007BE3E3 /* PBXTextBookmark */;
+                       A1E70FEF0A38D7C0007BE3E3 /* PBXTextBookmark */ = A1E70FEF0A38D7C0007BE3E3 /* PBXTextBookmark */;
+                       A1E70FF00A38D7C0007BE3E3 /* PBXTextBookmark */ = A1E70FF00A38D7C0007BE3E3 /* PBXTextBookmark */;
+                       A1E70FFA0A38D806007BE3E3 /* PBXTextBookmark */ = A1E70FFA0A38D806007BE3E3 /* PBXTextBookmark */;
+                       A1E70FFC0A38D806007BE3E3 /* PBXTextBookmark */ = A1E70FFC0A38D806007BE3E3 /* PBXTextBookmark */;
+                       A1E70FFF0A38D806007BE3E3 /* PBXTextBookmark */ = A1E70FFF0A38D806007BE3E3 /* PBXTextBookmark */;
+                       A1E710010A38D814007BE3E3 /* PBXTextBookmark */ = A1E710010A38D814007BE3E3 /* PBXTextBookmark */;
+                       A1E7100A0A38D888007BE3E3 /* PBXTextBookmark */ = A1E7100A0A38D888007BE3E3 /* PBXTextBookmark */;
+                       A1E7100C0A38D888007BE3E3 /* PBXTextBookmark */ = A1E7100C0A38D888007BE3E3 /* PBXTextBookmark */;
+                       A1E7100D0A38D888007BE3E3 /* PBXTextBookmark */ = A1E7100D0A38D888007BE3E3 /* PBXTextBookmark */;
+                       A1E710110A38D888007BE3E3 /* PBXTextBookmark */ = A1E710110A38D888007BE3E3 /* PBXTextBookmark */;
+                       A1E710140A38D888007BE3E3 /* PBXTextBookmark */ = A1E710140A38D888007BE3E3 /* PBXTextBookmark */;
+                       A1E7103C0A38DE0B007BE3E3 /* PBXTextBookmark */ = A1E7103C0A38DE0B007BE3E3 /* PBXTextBookmark */;
+                       A1E710400A38DE0B007BE3E3 /* PBXTextBookmark */ = A1E710400A38DE0B007BE3E3 /* PBXTextBookmark */;
+                       A1E710530A39EC0B007BE3E3 /* PBXTextBookmark */ = A1E710530A39EC0B007BE3E3 /* PBXTextBookmark */;
+                       A1E7105A0A39ED89007BE3E3 /* PBXTextBookmark */ = A1E7105A0A39ED89007BE3E3 /* PBXTextBookmark */;
+                       A1E7105D0A39ED89007BE3E3 /* PBXTextBookmark */ = A1E7105D0A39ED89007BE3E3 /* PBXTextBookmark */;
+                       A1E7105E0A39ED89007BE3E3 /* PBXTextBookmark */ = A1E7105E0A39ED89007BE3E3 /* PBXTextBookmark */;
+                       A1E710680A39F102007BE3E3 /* PBXTextBookmark */ = A1E710680A39F102007BE3E3 /* PBXTextBookmark */;
+                       A1E710840A3A1CFB007BE3E3 /* PBXTextBookmark */ = A1E710840A3A1CFB007BE3E3 /* PBXTextBookmark */;
+                       A1E710860A3A1CFB007BE3E3 /* PBXTextBookmark */ = A1E710860A3A1CFB007BE3E3 /* PBXTextBookmark */;
+                       A1E710870A3A1CFB007BE3E3 /* PBXTextBookmark */ = A1E710870A3A1CFB007BE3E3 /* PBXTextBookmark */;
+                       A1E710890A3A1D04007BE3E3 /* PBXTextBookmark */ = A1E710890A3A1D04007BE3E3 /* PBXTextBookmark */;
+                       A1E7108B0A3A1D04007BE3E3 /* PBXTextBookmark */ = A1E7108B0A3A1D04007BE3E3 /* PBXTextBookmark */;
+                       A1E7108D0A3A1D06007BE3E3 /* PBXTextBookmark */ = A1E7108D0A3A1D06007BE3E3 /* PBXTextBookmark */;
+                       A1E710930A3A1D22007BE3E3 /* PBXTextBookmark */ = A1E710930A3A1D22007BE3E3 /* PBXTextBookmark */;
+                       A1E710940A3A1D22007BE3E3 /* PBXTextBookmark */ = A1E710940A3A1D22007BE3E3 /* PBXTextBookmark */;
+                       A1E710950A3A1D22007BE3E3 /* PBXTextBookmark */ = A1E710950A3A1D22007BE3E3 /* PBXTextBookmark */;
+                       A1E710960A3A1D22007BE3E3 /* PBXTextBookmark */ = A1E710960A3A1D22007BE3E3 /* PBXTextBookmark */;
+                       A1E710970A3A1D22007BE3E3 /* PBXTextBookmark */ = A1E710970A3A1D22007BE3E3 /* PBXTextBookmark */;
+                       A1E7109C0A3A1D2B007BE3E3 /* PBXTextBookmark */ = A1E7109C0A3A1D2B007BE3E3 /* PBXTextBookmark */;
+                       A1E7109D0A3A1D2B007BE3E3 /* PBXTextBookmark */ = A1E7109D0A3A1D2B007BE3E3 /* PBXTextBookmark */;
+                       A1E7109F0A3A1DD0007BE3E3 /* PBXTextBookmark */ = A1E7109F0A3A1DD0007BE3E3 /* PBXTextBookmark */;
+                       A1E710A00A3A1DD0007BE3E3 /* PBXTextBookmark */ = A1E710A00A3A1DD0007BE3E3 /* PBXTextBookmark */;
+                       A1E710A50A3A22E1007BE3E3 /* PBXTextBookmark */ = A1E710A50A3A22E1007BE3E3 /* PBXTextBookmark */;
+                       A1E710AB0A3A22F5007BE3E3 /* PBXTextBookmark */ = A1E710AB0A3A22F5007BE3E3 /* PBXTextBookmark */;
+                       A1E710AC0A3A22F5007BE3E3 /* PBXTextBookmark */ = A1E710AC0A3A22F5007BE3E3 /* PBXTextBookmark */;
+                       A1E710AD0A3A22F5007BE3E3 /* PBXTextBookmark */ = A1E710AD0A3A22F5007BE3E3 /* PBXTextBookmark */;
+                       A1E710AF0A3A22FE007BE3E3 /* PBXTextBookmark */ = A1E710AF0A3A22FE007BE3E3 /* PBXTextBookmark */;
+                       A1E710B30A3A22FF007BE3E3 /* PBXTextBookmark */ = A1E710B30A3A22FF007BE3E3 /* PBXTextBookmark */;
+                       A1E710B90A3A23FB007BE3E3 /* PBXTextBookmark */ = A1E710B90A3A23FB007BE3E3 /* PBXTextBookmark */;
+                       A1E710BC0A3A2415007BE3E3 /* PBXTextBookmark */ = A1E710BC0A3A2415007BE3E3 /* PBXTextBookmark */;
+                       A1E710BD0A3A2415007BE3E3 /* PBXTextBookmark */ = A1E710BD0A3A2415007BE3E3 /* PBXTextBookmark */;
+                       A1E710BE0A3A2415007BE3E3 /* PBXTextBookmark */ = A1E710BE0A3A2415007BE3E3 /* PBXTextBookmark */;
+                       A1E710BF0A3A2415007BE3E3 /* PBXTextBookmark */ = A1E710BF0A3A2415007BE3E3 /* PBXTextBookmark */;
+                       A1E710C00A3A2415007BE3E3 /* PBXTextBookmark */ = A1E710C00A3A2415007BE3E3 /* PBXTextBookmark */;
+                       A1E710C60A3A2441007BE3E3 /* PBXTextBookmark */ = A1E710C60A3A2441007BE3E3 /* PBXTextBookmark */;
+                       A1E710C70A3A2441007BE3E3 /* PBXTextBookmark */ = A1E710C70A3A2441007BE3E3 /* PBXTextBookmark */;
+                       A1E710C80A3A2441007BE3E3 /* PBXTextBookmark */ = A1E710C80A3A2441007BE3E3 /* PBXTextBookmark */;
+                       A1E710C90A3A2441007BE3E3 /* PBXTextBookmark */ = A1E710C90A3A2441007BE3E3 /* PBXTextBookmark */;
+                       A1E710CA0A3A244D007BE3E3 /* PBXTextBookmark */ = A1E710CA0A3A244D007BE3E3 /* PBXTextBookmark */;
+                       A1E710CB0A3A244D007BE3E3 /* PBXTextBookmark */ = A1E710CB0A3A244D007BE3E3 /* PBXTextBookmark */;
+                       A1E710CC0A3A244D007BE3E3 /* PBXTextBookmark */ = A1E710CC0A3A244D007BE3E3 /* PBXTextBookmark */;
+                       A1E710CD0A3A244D007BE3E3 /* PBXTextBookmark */ = A1E710CD0A3A244D007BE3E3 /* PBXTextBookmark */;
+                       A1E710CE0A3A244D007BE3E3 /* PBXTextBookmark */ = A1E710CE0A3A244D007BE3E3 /* PBXTextBookmark */;
+                       A1E710D00A3A2456007BE3E3 /* PBXTextBookmark */ = A1E710D00A3A2456007BE3E3 /* PBXTextBookmark */;
+                       A1E710D10A3A2456007BE3E3 /* PBXTextBookmark */ = A1E710D10A3A2456007BE3E3 /* PBXTextBookmark */;
+                       A1E710D20A3A2456007BE3E3 /* PBXTextBookmark */ = A1E710D20A3A2456007BE3E3 /* PBXTextBookmark */;
+                       A1E710D30A3A2456007BE3E3 /* PBXTextBookmark */ = A1E710D30A3A2456007BE3E3 /* PBXTextBookmark */;
+                       A1E710D40A3A2456007BE3E3 /* PBXTextBookmark */ = A1E710D40A3A2456007BE3E3 /* PBXTextBookmark */;
+                       A1E710D70A3A2465007BE3E3 /* PBXTextBookmark */ = A1E710D70A3A2465007BE3E3 /* PBXTextBookmark */;
+                       A1E710D80A3A2465007BE3E3 /* PBXTextBookmark */ = A1E710D80A3A2465007BE3E3 /* PBXTextBookmark */;
+                       A1E710D90A3A2465007BE3E3 /* PBXTextBookmark */ = A1E710D90A3A2465007BE3E3 /* PBXTextBookmark */;
+                       A1E710DB0A3A246E007BE3E3 /* PBXTextBookmark */ = A1E710DB0A3A246E007BE3E3 /* PBXTextBookmark */;
+                       A1E710DF0A3A247D007BE3E3 /* PBXTextBookmark */ = A1E710DF0A3A247D007BE3E3 /* PBXTextBookmark */;
+                       A1E710E00A3A247D007BE3E3 /* PBXTextBookmark */ = A1E710E00A3A247D007BE3E3 /* PBXTextBookmark */;
+                       A1E710E10A3A247D007BE3E3 /* PBXTextBookmark */ = A1E710E10A3A247D007BE3E3 /* PBXTextBookmark */;
+                       A1E710E20A3A247D007BE3E3 /* PBXTextBookmark */ = A1E710E20A3A247D007BE3E3 /* PBXTextBookmark */;
+                       A1E710E30A3A247D007BE3E3 /* PBXTextBookmark */ = A1E710E30A3A247D007BE3E3 /* PBXTextBookmark */;
+                       A1E710E50A3A248A007BE3E3 /* PBXTextBookmark */ = A1E710E50A3A248A007BE3E3 /* PBXTextBookmark */;
+                       A1E710E60A3A248A007BE3E3 /* PBXTextBookmark */ = A1E710E60A3A248A007BE3E3 /* PBXTextBookmark */;
+                       A1E710E70A3A24A4007BE3E3 /* PBXTextBookmark */ = A1E710E70A3A24A4007BE3E3 /* PBXTextBookmark */;
+                       A1E710E80A3A24A5007BE3E3 /* PBXTextBookmark */ = A1E710E80A3A24A5007BE3E3 /* PBXTextBookmark */;
+                       A1E710E90A3A24A5007BE3E3 /* PBXTextBookmark */ = A1E710E90A3A24A5007BE3E3 /* PBXTextBookmark */;
+                       A1E710EA0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710EA0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710EB0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710EB0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710EC0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710EC0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710ED0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710ED0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710EE0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710EE0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710EF0A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710EF0A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710F00A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710F00A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710F10A3A2521007BE3E3 /* PBXTextBookmark */ = A1E710F10A3A2521007BE3E3 /* PBXTextBookmark */;
+                       A1E710F40A3A253F007BE3E3 /* PBXTextBookmark */ = A1E710F40A3A253F007BE3E3 /* PBXTextBookmark */;
+                       A1E710F50A3A253F007BE3E3 /* PBXTextBookmark */ = A1E710F50A3A253F007BE3E3 /* PBXTextBookmark */;
+               };
+               sourceControlManager = A1E70CFD0A38B536007BE3E3 /* Source Control */;
+               userBuildSettings = {
+               };
+       };
+       A1E70CFD0A38B536007BE3E3 /* Source Control */ = {
+               isa = PBXSourceControlManager;
+               fallbackIsa = XCSourceControlManager;
+               isSCMEnabled = 0;
+               scmConfiguration = {
+               };
+               scmType = "";
+       };
+       A1E70CFE0A38B536007BE3E3 /* Code sense */ = {
+               isa = PBXCodeSenseManager;
+               indexTemplatePath = "";
+       };
+       A1E70D000A38B5BB007BE3E3 /* cacheapi.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1087, 2100}}";
+                       sepNavSelRange = "{4787, 139}";
+                       sepNavVisRect = "{{0, 1547}, {1087, 448}}";
+               };
+       };
+       A1E70D010A38B5BB007BE3E3 /* ccache.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 18424}}";
+                       sepNavSelRange = "{11919, 0}";
+                       sepNavVisRect = "{{0, 5185}, {1003, 481}}";
+               };
+       };
+       A1E70D020A38B5BB007BE3E3 /* ccache.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {980, 2058}}";
+                       sepNavSelRange = "{2339, 9}";
+                       sepNavVisRect = "{{0, 556}, {980, 387}}";
+               };
+       };
+       A1E70D080A38B5BB007BE3E3 /* context.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {980, 13958}}";
+                       sepNavSelRange = "{29891, 21}";
+                       sepNavVisRect = "{{0, 13156}, {980, 387}}";
+               };
+       };
+       A1E70D0B0A38B5BB007BE3E3 /* credentials.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 1330}}";
+                       sepNavSelRange = "{0, 2110}";
+                       sepNavVisRect = "{{0, 235}, {621, 499}}";
+               };
+       };
+       A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {980, 3836}}";
+                       sepNavSelRange = "{6723, 21}";
+                       sepNavVisRect = "{{0, 2544}, {980, 387}}";
+               };
+       };
+       A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {734, 998}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {734, 998}}";
+                       sepNavWindowFrame = "{{15, 46}, {779, 1127}}";
+               };
+       };
+       A1E70D120A38B5BB007BE3E3 /* generic_lists.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 5572}}";
+                       sepNavSelRange = "{2282, 0}";
+                       sepNavVisRect = "{{0, 489}, {1003, 521}}";
+               };
+       };
+       A1E70D130A38B5BB007BE3E3 /* marshall.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {980, 6188}}";
+                       sepNavSelRange = "{11995, 68}";
+                       sepNavVisRect = "{{0, 4756}, {980, 387}}";
+               };
+       };
+       A1E70D140A38B5BB007BE3E3 /* msg.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1087, 8722}}";
+                       sepNavSelRange = "{15262, 21}";
+                       sepNavVisRect = "{{0, 7868}, {1087, 448}}";
+               };
+       };
+       A1E70D150A38B5BB007BE3E3 /* NTMakefile */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 499}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {888, 742}}";
+                       sepNavSelRange = "{2202, 18}";
+                       sepNavVisRect = "{{0, 453}, {888, 289}}";
+               };
+       };
+       A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 8302}}";
+                       sepNavSelRange = "{2631, 0}";
+                       sepNavVisRect = "{{0, 958}, {1003, 521}}";
+               };
+       };
+       A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 4340}}";
+                       sepNavSelRange = "{7813, 0}";
+                       sepNavVisRect = "{{0, 422}, {1003, 521}}";
+               };
+       };
+       A1E70D1C0A38B5BB007BE3E3 /* datastore.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {888, 2562}}";
+                       sepNavSelRange = "{2301, 0}";
+                       sepNavVisRect = "{{0, 573}, {888, 436}}";
+               };
+       };
+       A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 1442}}";
+                       sepNavSelRange = "{2369, 0}";
+                       sepNavVisRect = "{{0, 545}, {1003, 521}}";
+               };
+       };
+       A1E70D1F0A38B5BB007BE3E3 /* msg.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 2268}}";
+                       sepNavSelRange = "{5529, 0}";
+                       sepNavVisRect = "{{0, 1721}, {1003, 521}}";
+               };
+       };
+       A1E70D260A38B5BB007BE3E3 /* NTMakefile */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 499}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1003, 9856}}";
+                       sepNavSelRange = "{9783, 0}";
+                       sepNavVisRect = "{{0, 3674}, {1003, 730}}";
+               };
+       };
+       A1E70D2C0A38B5BB007BE3E3 /* main.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 910}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 134}, {621, 727}}";
+               };
+       };
+       A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {1087, 22204}}";
+                       sepNavSelRange = "{36879, 21}";
+                       sepNavVisRect = "{{0, 14168}, {1087, 448}}";
+               };
+       };
+       A1E70D3B0A38B5BB007BE3E3 /* client.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {804, 1988}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {804, 503}}";
+               };
+       };
+       A1E70D460A38B5BC007BE3E3 /* server.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 9520}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70D500A38B5F3007BE3E3 /* XCBreakpointsBucket */ = {
+               isa = XCBreakpointsBucket;
+               name = CCAPI;
+               objects = (
+               );
+       };
+       A1E70D5C0A38B796007BE3E3 /* CCacheServer */ = {
+               activeExec = 0;
+               executables = (
+                       A1E70D5E0A38B796007BE3E3 /* CCacheServer */,
+               );
+       };
+       A1E70D5E0A38B796007BE3E3 /* CCacheServer */ = {
+               isa = PBXExecutable;
+               activeArgIndex = 2147483647;
+               activeArgIndices = (
+               );
+               argumentStrings = (
+               );
+               autoAttachOnCrash = 1;
+               configStateDict = {
+               };
+               customDataFormattersEnabled = 1;
+               debuggerPlugin = GDBDebugging;
+               disassemblyDisplayState = 0;
+               enableDebugStr = 1;
+               environmentEntries = (
+               );
+               executableSystemSymbolLevel = 0;
+               executableUserSymbolLevel = 0;
+               libgmallocEnabled = 0;
+               name = CCacheServer;
+               sourceDirectories = (
+               );
+       };
+       A1E70D930A38BB67007BE3E3 /* main.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {980, 476}}";
+                       sepNavSelRange = "{316, 42}";
+                       sepNavVisRect = "{{0, 24}, {980, 387}}";
+               };
+       };
+       A1E70D9E0A38BCAD007BE3E3 /* mig.defs */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {804, 826}}";
+                       sepNavSelRange = "{2123, 0}";
+                       sepNavVisRect = "{{0, 400}, {804, 391}}";
+               };
+       };
+       A1E70DB10A38C01E007BE3E3 /* mig_types.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {804, 686}}";
+                       sepNavSelRange = "{2188, 0}";
+                       sepNavVisRect = "{{0, 281}, {804, 391}}";
+               };
+       };
+       A1E70DE10A38C6FD007BE3E3 /* kipc_common.h */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {888, 1078}}";
+                       sepNavSelRange = "{1293, 0}";
+                       sepNavVisRect = "{{0, 206}, {888, 470}}";
+               };
+       };
+       A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {804, 1218}}";
+                       sepNavSelRange = "{1240, 34}";
+                       sepNavVisRect = "{{0, 235}, {804, 329}}";
+               };
+       };
+       A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {632, 1316}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {728, 4396}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {698, 1988}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70DE80A38C6FD007BE3E3 /* notify.defs */ = {
+               uiCtxt = {
+                       sepNavIntBoundsRect = "{{0, 0}, {621, 518}}";
+                       sepNavSelRange = "{0, 0}";
+                       sepNavVisRect = "{{0, 0}, {621, 499}}";
+               };
+       };
+       A1E70DF70A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D150A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 308;
+               vrLoc = 0;
+       };
+       A1E70DF80A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3B0A38B5BB007BE3E3 /* client.c */;
+               name = "client.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 903;
+               vrLoc = 0;
+       };
+       A1E70DF90A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */;
+               name = "dllmain.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 298;
+               vrLoc = 0;
+       };
+       A1E70DFA0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */;
+               name = "cacheapi.def: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 847;
+               vrLoc = 0;
+       };
+       A1E70DFB0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D460A38B5BC007BE3E3 /* server.c */;
+               name = "server.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 756;
+               vrLoc = 0;
+       };
+       A1E70DFD0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1826;
+               vrLoc = 0;
+       };
+       A1E70E010A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0B0A38B5BB007BE3E3 /* credentials.h */;
+               name = "credentials.h: 1";
+               rLen = 2110;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1604;
+               vrLoc = 749;
+       };
+       A1E70E020A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2C0A38B5BB007BE3E3 /* main.c */;
+               name = "main.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1306;
+               vrLoc = 202;
+       };
+       A1E70E060A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */;
+               name = "CredentialsCache2.h: 303";
+               rLen = 0;
+               rLoc = 7813;
+               rType = 0;
+               vrLen = 1128;
+               vrLoc = 6802;
+       };
+       A1E70E090A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE80A38C6FD007BE3E3 /* notify.defs */;
+               name = "notify.defs: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1437;
+               vrLoc = 0;
+       };
+       A1E70E0A0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */;
+               name = "kipc_server.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1538;
+               vrLoc = 0;
+       };
+       A1E70E0B0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */;
+               name = "kipc_session.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1461;
+               vrLoc = 0;
+       };
+       A1E70E0C0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */;
+               name = "kipc_common.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1496;
+               vrLoc = 0;
+       };
+       A1E70E100A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D150A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 308;
+               vrLoc = 0;
+       };
+       A1E70E110A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1826;
+               vrLoc = 0;
+       };
+       A1E70E120A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3B0A38B5BB007BE3E3 /* client.c */;
+               name = "client.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 903;
+               vrLoc = 0;
+       };
+       A1E70E130A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */;
+               name = "dllmain.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 298;
+               vrLoc = 0;
+       };
+       A1E70E140A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */;
+               name = "cacheapi.def: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 847;
+               vrLoc = 0;
+       };
+       A1E70E150A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D460A38B5BC007BE3E3 /* server.c */;
+               name = "server.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 756;
+               vrLoc = 0;
+       };
+       A1E70E160A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2C0A38B5BB007BE3E3 /* main.c */;
+               name = "main.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 954;
+               vrLoc = 0;
+       };
+       A1E70E170A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = "serv_ops.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1825;
+               vrLoc = 0;
+       };
+       A1E70E180A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */;
+               name = "ccs_ccache.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1861;
+               vrLoc = 0;
+       };
+       A1E70E1B0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D930A38BB67007BE3E3 /* main.c */;
+               name = "main.c: 22";
+               rLen = 0;
+               rLoc = 509;
+               rType = 0;
+               vrLen = 954;
+               vrLoc = 0;
+       };
+       A1E70E1E0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0B0A38B5BB007BE3E3 /* credentials.h */;
+               name = "credentials.h: 1";
+               rLen = 2110;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1604;
+               vrLoc = 749;
+       };
+       A1E70E1F0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */;
+               name = cci_creds_v5_marshall;
+               rLen = 21;
+               rLoc = 6670;
+               rType = 0;
+               vrLen = 1513;
+               vrLoc = 6116;
+       };
+       A1E70E200A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_flatten;
+               rLen = 15;
+               rLoc = 7396;
+               rType = 0;
+               vrLen = 1003;
+               vrLoc = 7034;
+       };
+       A1E70E250A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 583";
+               rLen = 0;
+               rLoc = 20525;
+               rType = 0;
+               vrLen = 2454;
+               vrLoc = 18163;
+       };
+       A1E70E260A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */;
+               name = "ccapi_ipc.defs: 55";
+               rLen = 0;
+               rLoc = 2520;
+               rType = 0;
+               vrLen = 1955;
+               vrLoc = 87;
+       };
+       A1E70E290A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */;
+               name = "kipc_client.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1544;
+               vrLoc = 0;
+       };
+       A1E70E2A0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */;
+               name = "kipc_common.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1496;
+               vrLoc = 0;
+       };
+       A1E70E2B0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE80A38C6FD007BE3E3 /* notify.defs */;
+               name = "notify.defs: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1437;
+               vrLoc = 0;
+       };
+       A1E70E2D0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */;
+               name = "kipc_server.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1538;
+               vrLoc = 0;
+       };
+       A1E70E2E0A38C765007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */;
+               name = "kipc_session.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1461;
+               vrLoc = 0;
+       };
+       A1E70E380A38C778007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */;
+               name = "#include <CredentialsCache.h>";
+               rLen = 30;
+               rLoc = 2170;
+               rType = 0;
+               vrLen = 696;
+               vrLoc = 1821;
+       };
+       A1E70E3D0A38C78C007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D260A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 437;
+               vrLoc = 0;
+       };
+       A1E70E410A38C78C007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D260A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 437;
+               vrLoc = 0;
+       };
+       A1E70E430A38C791007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 432;
+               vrLoc = 0;
+       };
+       A1E70E450A38C791007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 432;
+               vrLoc = 0;
+       };
+       A1E70E4A0A38C7BE007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 432;
+               vrLoc = 0;
+       };
+       A1E70E520A38C9FD007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D150A38B5BB007BE3E3 /* NTMakefile */;
+               name = "NTMakefile: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 308;
+               vrLoc = 0;
+       };
+       A1E70E530A38C9FD007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1C0A38B5BB007BE3E3 /* datastore.h */;
+               name = cc_list_type;
+               rLen = 0;
+               rLoc = 2301;
+               rType = 0;
+               vrLen = 425;
+               vrLoc = 2113;
+       };
+       A1E70E560A38C9FD007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = cc_list_type;
+               rLen = 12;
+               rLoc = 2736;
+               rType = 0;
+               vrLen = 728;
+               vrLoc = 2219;
+       };
+       A1E70E580A38C9FD007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1C0A38B5BB007BE3E3 /* datastore.h */;
+               name = cc_list_type;
+               rLen = 0;
+               rLoc = 2301;
+               rType = 0;
+               vrLen = 425;
+               vrLoc = 2113;
+       };
+       A1E70E6F0A38CA08007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1F0A38B5BB007BE3E3 /* msg.h */;
+               name = "#include \"generic_lists.h\"";
+               rLen = 27;
+               rLoc = 2765;
+               rType = 0;
+               vrLen = 755;
+               vrLoc = 2478;
+       };
+       A1E70E770A38CA55007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */;
+               name = "#include \"msg.h\"";
+               rLen = 18;
+               rLoc = 2202;
+               rType = 0;
+               vrLen = 644;
+               vrLoc = 1674;
+       };
+       A1E70E7D0A38CA55007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */;
+               name = "#include \"msg.h\"";
+               rLen = 18;
+               rLoc = 2202;
+               rType = 0;
+               vrLen = 644;
+               vrLoc = 1674;
+       };
+       A1E70E9C0A38CAF1007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 463;
+               vrLoc = 2119;
+       };
+       A1E70EA80A38CB24007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: cc_generic_list_node_t";
+               rLen = 0;
+               rLoc = 2452;
+               rType = 0;
+               vrLen = 598;
+               vrLoc = 2206;
+       };
+       A1E70EAB0A38CB24007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D080A38B5BB007BE3E3 /* context.c */;
+               name = "code = cci_msg_add_data_blob(request, (void *)name, strlen(name) + 1, &blob_pos);";
+               rLen = 86;
+               rLoc = 14073;
+               rType = 0;
+               vrLen = 704;
+               vrLoc = 13925;
+       };
+       A1E70EB50A38CB4D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */;
+               name = "strncpy(vendor, string, sizeof(vendor)-1);";
+               rLen = 55;
+               rLoc = 4926;
+               rType = 0;
+               vrLen = 780;
+               vrLoc = 1821;
+       };
+       A1E70EC30A38CC14007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */;
+               name = "ccache.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 1115;
+               vrLoc = 0;
+       };
+       A1E70ECB0A38CC4C007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */;
+               name = "#include <Kerberos/kipc_client.h>";
+               rLen = 34;
+               rLoc = 1240;
+               rType = 0;
+               vrLen = 891;
+               vrLoc = 724;
+       };
+       A1E70ED70A38CCB6007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */;
+               name = "#include <Kerberos/kipc_client.h>";
+               rLen = 34;
+               rLoc = 1240;
+               rType = 0;
+               vrLen = 1069;
+               vrLoc = 582;
+       };
+       A1E70EE20A38CCD6007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DB10A38C01E007BE3E3 /* mig_types.h */;
+               name = "ccapi_ipc.h: 39";
+               rLen = 0;
+               rLoc = 1957;
+               rType = 0;
+               vrLen = 892;
+               vrLoc = 1209;
+       };
+       A1E70EFE0A38CD66007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE10A38C6FD007BE3E3 /* kipc_common.h */;
+               name = "#include <Kerberos/KerberosDebug.h>";
+               rLen = 36;
+               rLoc = 1293;
+               rType = 0;
+               vrLen = 609;
+               vrLoc = 1011;
+       };
+       A1E70F0F0A38CE21007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D3B0A38B5BB007BE3E3 /* client.c */;
+               name = "client.c: 1";
+               rLen = 0;
+               rLoc = 0;
+               rType = 0;
+               vrLen = 903;
+               vrLoc = 0;
+       };
+       A1E70F440A38D252007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DB10A38C01E007BE3E3 /* mig_types.h */;
+               name = "msg_ipc.h: 48";
+               rLen = 0;
+               rLoc = 2188;
+               rType = 0;
+               vrLen = 793;
+               vrLoc = 1409;
+       };
+       A1E70F450A38D252007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DE10A38C6FD007BE3E3 /* kipc_common.h */;
+               name = "kipc_common.h: 32";
+               rLen = 0;
+               rLoc = 1293;
+               rType = 0;
+               vrLen = 1252;
+               vrLoc = 450;
+       };
+       A1E70F8B0A38D3B4007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */;
+               name = "msg_ipc.defs: 43";
+               rLen = 0;
+               rLoc = 2111;
+               rType = 0;
+               vrLen = 1149;
+               vrLoc = 1378;
+       };
+       A1E70F9C0A38D41E007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70DB10A38C01E007BE3E3 /* mig_types.h */;
+               name = "mig_types.h: 48";
+               rLen = 0;
+               rLoc = 2188;
+               rType = 0;
+               vrLen = 1178;
+               vrLoc = 1024;
+       };
+       A1E70F9D0A38D41E007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */;
+               name = "mig.defs: 44";
+               rLen = 0;
+               rLoc = 2123;
+               rType = 0;
+               vrLen = 1034;
+               vrLoc = 1439;
+       };
+       A1E70FC60A38D560007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70FC70A38D560007BE3E3 /* migServer.h */;
+               name = ccapi_server;
+               rLen = 12;
+               rLoc = 1268;
+               rType = 0;
+               vrLen = 879;
+               vrLoc = 942;
+       };
+       A1E70FC70A38D560007BE3E3 /* migServer.h */ = {
+               isa = PBXFileReference;
+               name = migServer.h;
+               path = "/Volumes/Ra-Tilt/Users/lxs/Builds/CCAPI.build/Debug/CCacheServer.build/DerivedSources/migServer.h";
+               sourceTree = "<absolute>";
+       };
+       A1E70FC80A38D560007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D930A38BB67007BE3E3 /* main.c */;
+               name = "main.c: 23";
+               rLen = 0;
+               rLoc = 495;
+               rType = 0;
+               vrLen = 691;
+               vrLoc = 0;
+       };
+       A1E70FC90A38D560007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1C0A38B5BB007BE3E3 /* datastore.h */;
+               name = "datastore.h: 55";
+               rLen = 0;
+               rLoc = 2301;
+               rType = 0;
+               vrLen = 805;
+               vrLoc = 2101;
+       };
+       A1E70FCA0A38D560007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 52";
+               rLen = 0;
+               rLoc = 2371;
+               rType = 0;
+               vrLen = 757;
+               vrLoc = 2012;
+       };
+       A1E70FCD0A38D560007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D930A38BB67007BE3E3 /* main.c */;
+               name = "main.c: 23";
+               rLen = 0;
+               rLoc = 495;
+               rType = 0;
+               vrLen = 691;
+               vrLoc = 0;
+       };
+       A1E70FD80A38D573007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D930A38BB67007BE3E3 /* main.c */;
+               name = "syslog (LOG_INFO, \"Starting up.\");";
+               rLen = 42;
+               rLoc = 316;
+               rType = 0;
+               vrLen = 628;
+               vrLoc = 21;
+       };
+       A1E70FEE0A38D7C0007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */;
+               name = "marshall.c: 48";
+               rLen = 0;
+               rLoc = 2234;
+               rType = 0;
+               vrLen = 831;
+               vrLoc = 1674;
+       };
+       A1E70FEF0A38D7C0007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */;
+               name = "ccache.c: 49";
+               rLen = 0;
+               rLoc = 2186;
+               rType = 0;
+               vrLen = 432;
+               vrLoc = 2106;
+       };
+       A1E70FF00A38D7C0007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D080A38B5BB007BE3E3 /* context.c */;
+               name = "code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);";
+               rLen = 139;
+               rLoc = 29872;
+               rType = 0;
+               vrLen = 757;
+               vrLoc = 27442;
+       };
+       A1E70FFA0A38D806007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */;
+               name = "memcpy(creds->client, flat + header->client.data, length);";
+               rLen = 68;
+               rLoc = 11995;
+               rType = 0;
+               vrLen = 1038;
+               vrLoc = 11543;
+       };
+       A1E70FFC0A38D806007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D020A38B5BB007BE3E3 /* ccache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 2339;
+               rType = 0;
+               vrLen = 663;
+               vrLoc = 2042;
+       };
+       A1E70FFF0A38D806007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D020A38B5BB007BE3E3 /* ccache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 2339;
+               rType = 0;
+               vrLen = 663;
+               vrLoc = 2042;
+       };
+       A1E710010A38D814007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 617;
+               vrLoc = 4722;
+       };
+       A1E7100A0A38D888007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 619;
+               vrLoc = 4720;
+       };
+       A1E7100C0A38D888007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D080A38B5BB007BE3E3 /* context.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 29891;
+               rType = 0;
+               vrLen = 1038;
+               vrLoc = 29282;
+       };
+       A1E7100D0A38D888007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 6723;
+               rType = 0;
+               vrLen = 1080;
+               vrLoc = 6223;
+       };
+       A1E710110A38D888007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 22827;
+               rType = 0;
+               vrLen = 921;
+               vrLoc = 22183;
+       };
+       A1E710140A38D888007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 6723;
+               rType = 0;
+               vrLen = 1080;
+               vrLoc = 6223;
+       };
+       A1E7103C0A38DE0B007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1F0A38B5BB007BE3E3 /* msg.h */;
+               name = "msg.h: 142";
+               rLen = 0;
+               rLoc = 5529;
+               rType = 0;
+               vrLen = 1239;
+               vrLoc = 4630;
+       };
+       A1E710400A38DE0B007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: cci_msg_retrieve_blob";
+               rLen = 0;
+               rLoc = 15353;
+               rType = 0;
+               vrLen = 962;
+               vrLoc = 14947;
+       };
+       A1E710530A39EC0B007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = "serv_ops.c: 322";
+               rLen = 0;
+               rLoc = 12676;
+               rType = 0;
+               vrLen = 1049;
+               vrLoc = 12199;
+       };
+       A1E7105A0A39ED89007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */;
+               name = "code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);";
+               rLen = 139;
+               rLoc = 4787;
+               rType = 0;
+               vrLen = 1079;
+               vrLoc = 4176;
+       };
+       A1E7105D0A39ED89007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */;
+               name = "code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);";
+               rLen = 139;
+               rLoc = 4787;
+               rType = 0;
+               vrLen = 1079;
+               vrLoc = 4176;
+       };
+       A1E7105E0A39ED89007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "cur_pos = msg->flat;";
+               rLen = 25;
+               rLoc = 7704;
+               rType = 0;
+               vrLen = 835;
+               vrLoc = 7353;
+       };
+       A1E710680A39F102007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = "resp_header->ccache = htonll((cc_handle) ccache);";
+               rLen = 54;
+               rLoc = 23249;
+               rType = 0;
+               vrLen = 1200;
+               vrLoc = 22714;
+       };
+       A1E710840A3A1CFB007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */;
+               name = "ccache.c: 378";
+               rLen = 0;
+               rLoc = 11919;
+               rType = 0;
+               vrLen = 1092;
+               vrLoc = 11685;
+       };
+       A1E710860A3A1CFB007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: 585";
+               rLen = 0;
+               rLoc = 15353;
+               rType = 0;
+               vrLen = 1129;
+               vrLoc = 14797;
+       };
+       A1E710870A3A1CFB007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */;
+               name = "ccache.c: 378";
+               rLen = 0;
+               rLoc = 11919;
+               rType = 0;
+               vrLen = 1092;
+               vrLoc = 11685;
+       };
+       A1E710890A3A1D04007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */;
+               name = "ccs_ccache.c: 289";
+               rLen = 0;
+               rLoc = 9783;
+               rType = 0;
+               vrLen = 919;
+               vrLoc = 9327;
+       };
+       A1E7108B0A3A1D04007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */;
+               name = "ccs_ccache.c: 289";
+               rLen = 0;
+               rLoc = 9783;
+               rType = 0;
+               vrLen = 919;
+               vrLoc = 9327;
+       };
+       A1E7108D0A3A1D06007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */;
+               name = "ccs_ccache.c: 289";
+               rLen = 0;
+               rLoc = 9783;
+               rType = 0;
+               vrLen = 1441;
+               vrLoc = 9196;
+       };
+       A1E710930A3A1D22007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 36879;
+               rType = 0;
+               vrLen = 1393;
+               vrLoc = 35980;
+       };
+       A1E710940A3A1D22007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1F0A38B5BB007BE3E3 /* msg.h */;
+               name = "msg.h: 142";
+               rLen = 0;
+               rLoc = 5529;
+               rType = 0;
+               vrLen = 1480;
+               vrLoc = 4457;
+       };
+       A1E710950A3A1D22007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               rLen = 21;
+               rLoc = 14700;
+               rType = 0;
+       };
+       A1E710960A3A1D22007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 36879;
+               rType = 0;
+               vrLen = 1393;
+               vrLoc = 35980;
+       };
+       A1E710970A3A1D22007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1F0A38B5BB007BE3E3 /* msg.h */;
+               name = "msg.h: 142";
+               rLen = 0;
+               rLoc = 5529;
+               rType = 0;
+               vrLen = 1480;
+               vrLoc = 4457;
+       };
+       A1E7109C0A3A1D2B007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 36879;
+               rType = 0;
+               vrLen = 1196;
+               vrLoc = 36344;
+       };
+       A1E7109D0A3A1D2B007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               comments = "error: conflicting types for 'cci_msg_retrieve_blob'";
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               rLen = 1;
+               rLoc = 570;
+               rType = 1;
+       };
+       A1E7109F0A3A1DD0007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: 1248";
+               rLen = 0;
+               rLoc = 16800;
+               rType = 0;
+               vrLen = 1576;
+               vrLoc = 14015;
+       };
+       A1E710A00A3A1DD0007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: 1248";
+               rLen = 0;
+               rLoc = 16800;
+               rType = 0;
+               vrLen = 1582;
+               vrLoc = 0;
+       };
+       A1E710A50A3A22E1007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: 623";
+               rLen = 0;
+               rLoc = 16800;
+               rType = 0;
+               vrLen = 1674;
+               vrLoc = 0;
+       };
+       A1E710AB0A3A22F5007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: 623";
+               rLen = 0;
+               rLoc = 16800;
+               rType = 0;
+               vrLen = 2012;
+               vrLoc = 0;
+       };
+       A1E710AC0A3A22F5007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: cci_msg_retrieve_blob";
+               rLen = 0;
+               rLoc = 15346;
+               rType = 0;
+               vrLen = 1284;
+               vrLoc = 15187;
+       };
+       A1E710AD0A3A22F5007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: cci_msg_retrieve_blob";
+               rLen = 0;
+               rLoc = 15346;
+               rType = 0;
+               vrLen = 1209;
+               vrLoc = 15187;
+       };
+       A1E710AF0A3A22FE007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: cci_msg_retrieve_blob";
+               rLen = 0;
+               rLoc = 15346;
+               rType = 0;
+               vrLen = 1589;
+               vrLoc = 14614;
+       };
+       A1E710B30A3A22FF007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = "msg.c: cci_msg_retrieve_blob";
+               rLen = 0;
+               rLoc = 15346;
+               rType = 0;
+               vrLen = 1209;
+               vrLoc = 15187;
+       };
+       A1E710B90A3A23FB007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 15262;
+               rType = 0;
+               vrLen = 1209;
+               vrLoc = 15187;
+       };
+       A1E710BC0A3A2415007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 15262;
+               rType = 0;
+               vrLen = 1356;
+               vrLoc = 15083;
+       };
+       A1E710BD0A3A2415007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 873;
+               vrLoc = 1826;
+       };
+       A1E710BE0A3A2415007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 15262;
+               rType = 0;
+               vrLen = 1356;
+               vrLoc = 15083;
+       };
+       A1E710BF0A3A2415007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 863;
+               vrLoc = 1826;
+       };
+       A1E710C00A3A2415007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 15262;
+               rType = 0;
+               vrLen = 1209;
+               vrLoc = 15187;
+       };
+       A1E710C60A3A2441007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 863;
+               vrLoc = 1826;
+       };
+       A1E710C70A3A2441007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 54";
+               rLen = 0;
+               rLoc = 2452;
+               rType = 0;
+               vrLen = 1215;
+               vrLoc = 1674;
+       };
+       A1E710C80A3A2441007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 863;
+               vrLoc = 1826;
+       };
+       A1E710C90A3A2441007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 939;
+               vrLoc = 1935;
+       };
+       A1E710CA0A3A244D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D140A38B5BB007BE3E3 /* msg.c */;
+               name = cci_msg_retrieve_blob;
+               rLen = 21;
+               rLoc = 15262;
+               rType = 0;
+               vrLen = 1209;
+               vrLoc = 15187;
+       };
+       A1E710CB0A3A244D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 696;
+               vrLoc = 2147;
+       };
+       A1E710CC0A3A244D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               comments = "error: CredentialsCache.h: No such file or directory";
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               rLen = 1;
+               rLoc = 53;
+               rType = 1;
+       };
+       A1E710CD0A3A244D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 696;
+               vrLoc = 2147;
+       };
+       A1E710CE0A3A244D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "#include \"CredentialsCache.h\"";
+               rLen = 31;
+               rLoc = 2221;
+               rType = 0;
+               vrLen = 608;
+               vrLoc = 2043;
+       };
+       A1E710D00A3A2456007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 906;
+               vrLoc = 2012;
+       };
+       A1E710D10A3A2456007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "#include \"CredentialsCache.h\"";
+               rLen = 31;
+               rLoc = 2221;
+               rType = 0;
+               vrLen = 861;
+               vrLoc = 1792;
+       };
+       A1E710D20A3A2456007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 822;
+               vrLoc = 4694;
+       };
+       A1E710D30A3A2456007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "#include \"CredentialsCache.h\"";
+               rLen = 31;
+               rLoc = 2221;
+               rType = 0;
+               vrLen = 861;
+               vrLoc = 1792;
+       };
+       A1E710D40A3A2456007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 822;
+               vrLoc = 4694;
+       };
+       A1E710D70A3A2465007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 802;
+               vrLoc = 4694;
+       };
+       A1E710D80A3A2465007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "#include \"CredentialsCache.h\"";
+               rLen = 31;
+               rLoc = 2221;
+               rType = 0;
+               vrLen = 683;
+               vrLoc = 1899;
+       };
+       A1E710D90A3A2465007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 726;
+               vrLoc = 4701;
+       };
+       A1E710DB0A3A246E007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 726;
+               vrLoc = 4701;
+       };
+       A1E710DF0A3A247D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */;
+               name = "CredentialsCache2.h: 303";
+               rLen = 0;
+               rLoc = 7813;
+               rType = 0;
+               vrLen = 786;
+               vrLoc = 7144;
+       };
+       A1E710E00A3A247D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 802;
+               vrLoc = 4694;
+       };
+       A1E710E10A3A247D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = cc_handle;
+               rLen = 9;
+               rLoc = 5095;
+               rType = 0;
+               vrLen = 802;
+               vrLoc = 4694;
+       };
+       A1E710E20A3A247D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */;
+               name = "CredentialsCache2.h: 303";
+               rLen = 0;
+               rLoc = 7813;
+               rType = 0;
+               vrLen = 786;
+               vrLoc = 7144;
+       };
+       A1E710E30A3A247D007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 836;
+               vrLoc = 2610;
+       };
+       A1E710E50A3A248A007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 1007;
+               vrLoc = 2180;
+       };
+       A1E710E60A3A248A007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 750;
+               vrLoc = 2696;
+       };
+       A1E710E70A3A24A4007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 750;
+               vrLoc = 2696;
+       };
+       A1E710E80A3A24A5007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 825;
+               vrLoc = 2639;
+       };
+       A1E710E90A3A24A5007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 750;
+               vrLoc = 2696;
+       };
+       A1E710EA0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 825;
+               vrLoc = 2639;
+       };
+       A1E710EB0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */;
+               name = "CredentialsCache2.h: 303";
+               rLen = 0;
+               rLoc = 7813;
+               rType = 0;
+               vrLen = 1103;
+               vrLoc = 1564;
+       };
+       A1E710EC0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 906;
+               vrLoc = 2012;
+       };
+       A1E710ED0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 825;
+               vrLoc = 2639;
+       };
+       A1E710EE0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */;
+               name = "CredentialsCache2.h: 303";
+               rLen = 0;
+               rLoc = 7813;
+               rType = 0;
+               vrLen = 1103;
+               vrLoc = 1564;
+       };
+       A1E710EF0A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */;
+               name = "generic_lists.h: 58";
+               rLen = 0;
+               rLoc = 2369;
+               rType = 0;
+               vrLen = 906;
+               vrLoc = 2012;
+       };
+       A1E710F00A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 56";
+               rLen = 0;
+               rLoc = 2280;
+               rType = 0;
+               vrLen = 842;
+               vrLoc = 1792;
+       };
+       A1E710F10A3A2521007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 750;
+               vrLoc = 2696;
+       };
+       A1E710F40A3A253F007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */;
+               name = "generic_lists.c: 57";
+               rLen = 0;
+               rLoc = 2282;
+               rType = 0;
+               vrLen = 861;
+               vrLoc = 1792;
+       };
+       A1E710F50A3A253F007BE3E3 /* PBXTextBookmark */ = {
+               isa = PBXTextBookmark;
+               fRef = A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */;
+               name = "CredentialsCache.h: 67";
+               rLen = 0;
+               rLoc = 2631;
+               rType = 0;
+               vrLen = 750;
+               vrLoc = 2696;
+       };
+       D2AAC045055464E500DB518D /* CCAPI */ = {
+               activeExec = 0;
+       };
+}
diff --git a/src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.perspective b/src/lib/ccapi/mac/CCAPI.xcodeproj/lxs.perspective
new file mode 100644 (file)
index 0000000..1983707
--- /dev/null
@@ -0,0 +1,1567 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>ActivePerspectiveName</key>
+       <string>Project</string>
+       <key>AllowedModules</key>
+       <array>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXSmartGroupTreeModule</string>
+                       <key>Name</key>
+                       <string>Groups and Files Outline View</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXNavigatorGroup</string>
+                       <key>Name</key>
+                       <string>Editor</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCTaskListModule</string>
+                       <key>Name</key>
+                       <string>Task List</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDetailModule</string>
+                       <key>Name</key>
+                       <string>File and Smart Group Detail Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXBuildResultsModule</string>
+                       <key>Name</key>
+                       <string>Detailed Build Results Viewer</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXProjectFindModule</string>
+                       <key>Name</key>
+                       <string>Project Batch Find Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXRunSessionModule</string>
+                       <key>Name</key>
+                       <string>Run Log</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXBookmarksModule</string>
+                       <key>Name</key>
+                       <string>Bookmarks Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXClassBrowserModule</string>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXCVSModule</string>
+                       <key>Name</key>
+                       <string>Source Code Control Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXDebugBreakpointsModule</string>
+                       <key>Name</key>
+                       <string>Debug Breakpoints Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>XCDockableInspector</string>
+                       <key>Name</key>
+                       <string>Inspector</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>n</string>
+                       <key>Module</key>
+                       <string>PBXOpenQuicklyModule</string>
+                       <key>Name</key>
+                       <string>Open Quickly Tool</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugSessionModule</string>
+                       <key>Name</key>
+                       <string>Debugger</string>
+               </dict>
+               <dict>
+                       <key>BundleLoadPath</key>
+                       <string></string>
+                       <key>MaxInstances</key>
+                       <string>1</string>
+                       <key>Module</key>
+                       <string>PBXDebugCLIModule</string>
+                       <key>Name</key>
+                       <string>Debug Console</string>
+               </dict>
+       </array>
+       <key>Description</key>
+       <string>AIODescriptionKey</string>
+       <key>DockingSystemVisible</key>
+       <false/>
+       <key>Extension</key>
+       <string>perspective</string>
+       <key>FavBarConfig</key>
+       <dict>
+               <key>PBXProjectModuleGUID</key>
+               <string>A1E70E750A38CA08007BE3E3</string>
+               <key>XCBarModuleItemNames</key>
+               <dict/>
+               <key>XCBarModuleItems</key>
+               <array/>
+       </dict>
+       <key>FirstTimeWindowDisplayed</key>
+       <false/>
+       <key>Identifier</key>
+       <string>com.apple.perspectives.project.default</string>
+       <key>MajorVersion</key>
+       <integer>33</integer>
+       <key>MinorVersion</key>
+       <integer>0</integer>
+       <key>Name</key>
+       <string>All-In-One</string>
+       <key>Notifications</key>
+       <array>
+               <dict>
+                       <key>XCObserverAutoDisconnectKey</key>
+                       <true/>
+                       <key>XCObserverDefintionKey</key>
+                       <dict/>
+                       <key>XCObserverFactoryKey</key>
+                       <string>XCPerspectivesSpecificationIdentifier</string>
+                       <key>XCObserverGUIDKey</key>
+                       <string>XCObserverProjectIdentifier</string>
+                       <key>XCObserverNotificationKey</key>
+                       <string>PBXStatusBuildStateMessageNotification</string>
+                       <key>XCObserverTargetKey</key>
+                       <string>XCMainBuildResultsModuleGUID</string>
+                       <key>XCObserverTriggerKey</key>
+                       <string>awakenModuleWithObserver:</string>
+                       <key>XCObserverValidationKey</key>
+                       <dict/>
+               </dict>
+       </array>
+       <key>OpenEditors</key>
+       <array/>
+       <key>PerspectiveWidths</key>
+       <array>
+               <integer>1340</integer>
+               <integer>1340</integer>
+               <integer>1340</integer>
+       </array>
+       <key>Perspectives</key>
+       <array>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>XCToolbarPerspectiveControl</string>
+                               <string>NSToolbarSeparatorItem</string>
+                               <string>active-target-popup</string>
+                               <string>action</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>buildOrClean</string>
+                               <string>build-and-runOrDebug</string>
+                               <string>com.apple.ide.PBXToolbarStopButton</string>
+                               <string>get-info</string>
+                               <string>toggle-editor</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>com.apple.pbx.toolbar.searchfield</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>WindowOfProject</string>
+                       <key>Identifier</key>
+                       <string>perspective.project</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array>
+                                                       <string>1C37FBAC04509CD000000102</string>
+                                                       <string>1C37FAAC04509CD000000102</string>
+                                                       <string>1C08E77C0454961000C914BD</string>
+                                                       <string>1C37FABC05509CD000000102</string>
+                                                       <string>1C37FABC05539CD112110102</string>
+                                                       <string>E2644B35053B69B200211256</string>
+                                                       <string>1C37FABC04509CD000100104</string>
+                                                       <string>1CC0EA4004350EF90044410B</string>
+                                                       <string>1CC0EA4004350EF90041110B</string>
+                                                       <string>1C77FABC04509CD000000102</string>
+                                               </array>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CA23ED40692098700951B8B</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>268</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array>
+                                                               <string>08FB7794FE84155DC02AAC07</string>
+                                                               <string>A1E70CFF0A38B5BB007BE3E3</string>
+                                                               <string>A1E70D110A38B5BB007BE3E3</string>
+                                                               <string>A1E70D7E0A38BAC5007BE3E3</string>
+                                                               <string>A1E70D180A38B5BB007BE3E3</string>
+                                                               <string>A1E70D270A38B5BB007BE3E3</string>
+                                                               <string>A1E70D2B0A38B5BB007BE3E3</string>
+                                                               <string>A1E70D390A38B5BB007BE3E3</string>
+                                                               <string>1C37FBAC04509CD000000102</string>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>24</integer>
+                                                                       <integer>19</integer>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 0}, {268, 841}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <false/>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {285, 859}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>MainColumn</string>
+                                                       <real>268</real>
+                                               </array>
+                                               <key>RubberWindowFrame</key>
+                                               <string>170 278 1340 900 0 0 1920 1178 </string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>285pt</string>
+                               </dict>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <true/>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>A1E70DF50A38C765007BE3E3</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>generic_lists.c</string>
+                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                               <dict>
+                                                                       <key>Split0</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>A1E70DF60A38C765007BE3E3</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>generic_lists.c</string>
+                                                                               <key>_historyCapacity</key>
+                                                                               <integer>0</integer>
+                                                                               <key>bookmark</key>
+                                                                               <string>A1E710F40A3A253F007BE3E3</string>
+                                                                               <key>history</key>
+                                                                               <array>
+                                                                                       <string>A1E70DF90A38C765007BE3E3</string>
+                                                                                       <string>A1E70DFA0A38C765007BE3E3</string>
+                                                                                       <string>A1E70DFB0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E010A38C765007BE3E3</string>
+                                                                                       <string>A1E70E020A38C765007BE3E3</string>
+                                                                                       <string>A1E70E090A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0A0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0B0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0C0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E3D0A38C78C007BE3E3</string>
+                                                                                       <string>A1E70E4A0A38C7BE007BE3E3</string>
+                                                                                       <string>A1E70E520A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E530A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E770A38CA55007BE3E3</string>
+                                                                                       <string>A1E70EB50A38CB4D007BE3E3</string>
+                                                                                       <string>A1E70ED70A38CCB6007BE3E3</string>
+                                                                                       <string>A1E70EFE0A38CD66007BE3E3</string>
+                                                                                       <string>A1E70F0F0A38CE21007BE3E3</string>
+                                                                                       <string>A1E70F9C0A38D41E007BE3E3</string>
+                                                                                       <string>A1E70F9D0A38D41E007BE3E3</string>
+                                                                                       <string>A1E70FC60A38D560007BE3E3</string>
+                                                                                       <string>A1E70FD80A38D573007BE3E3</string>
+                                                                                       <string>A1E70FFA0A38D806007BE3E3</string>
+                                                                                       <string>A1E70FFC0A38D806007BE3E3</string>
+                                                                                       <string>A1E7100C0A38D888007BE3E3</string>
+                                                                                       <string>A1E7100D0A38D888007BE3E3</string>
+                                                                                       <string>A1E710840A3A1CFB007BE3E3</string>
+                                                                                       <string>A1E7108D0A3A1D06007BE3E3</string>
+                                                                                       <string>A1E710930A3A1D22007BE3E3</string>
+                                                                                       <string>A1E710940A3A1D22007BE3E3</string>
+                                                                                       <string>A1E710BC0A3A2415007BE3E3</string>
+                                                                                       <string>A1E710EA0A3A2521007BE3E3</string>
+                                                                                       <string>A1E710EB0A3A2521007BE3E3</string>
+                                                                                       <string>A1E710EC0A3A2521007BE3E3</string>
+                                                                                       <string>A1E710D10A3A2456007BE3E3</string>
+                                                                               </array>
+                                                                               <key>prevStack</key>
+                                                                               <array>
+                                                                                       <string>A1E70E100A38C765007BE3E3</string>
+                                                                                       <string>A1E70E110A38C765007BE3E3</string>
+                                                                                       <string>A1E70E120A38C765007BE3E3</string>
+                                                                                       <string>A1E70E130A38C765007BE3E3</string>
+                                                                                       <string>A1E70E140A38C765007BE3E3</string>
+                                                                                       <string>A1E70E150A38C765007BE3E3</string>
+                                                                                       <string>A1E70E160A38C765007BE3E3</string>
+                                                                                       <string>A1E70E180A38C765007BE3E3</string>
+                                                                                       <string>A1E70E1B0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E1E0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E1F0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E200A38C765007BE3E3</string>
+                                                                                       <string>A1E70E250A38C765007BE3E3</string>
+                                                                                       <string>A1E70E260A38C765007BE3E3</string>
+                                                                                       <string>A1E70E290A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2A0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2B0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2D0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2E0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E380A38C778007BE3E3</string>
+                                                                                       <string>A1E70E410A38C78C007BE3E3</string>
+                                                                                       <string>A1E70E450A38C791007BE3E3</string>
+                                                                                       <string>A1E70E560A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E580A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E6F0A38CA08007BE3E3</string>
+                                                                                       <string>A1E70E7D0A38CA55007BE3E3</string>
+                                                                                       <string>A1E70EAB0A38CB24007BE3E3</string>
+                                                                                       <string>A1E70EC30A38CC14007BE3E3</string>
+                                                                                       <string>A1E70EE20A38CCD6007BE3E3</string>
+                                                                                       <string>A1E70FFF0A38D806007BE3E3</string>
+                                                                                       <string>A1E710110A38D888007BE3E3</string>
+                                                                                       <string>A1E710140A38D888007BE3E3</string>
+                                                                                       <string>A1E710BE0A3A2415007BE3E3</string>
+                                                                                       <string>A1E710C80A3A2441007BE3E3</string>
+                                                                                       <string>A1E710D30A3A2456007BE3E3</string>
+                                                                                       <string>A1E710E10A3A247D007BE3E3</string>
+                                                                                       <string>A1E710E20A3A247D007BE3E3</string>
+                                                                                       <string>A1E710ED0A3A2521007BE3E3</string>
+                                                                                       <string>A1E710EE0A3A2521007BE3E3</string>
+                                                                                       <string>A1E710EF0A3A2521007BE3E3</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>SplitCount</key>
+                                                                       <string>1</string>
+                                                               </dict>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                               <key>XCSharingToken</key>
+                                                               <string>com.apple.Xcode.CommonNavigatorGroupSharingToken</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1050, 553}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>170 278 1340 900 0 0 1920 1178 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>553pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>Proportion</key>
+                                                       <string>301pt</string>
+                                                       <key>Tabs</key>
+                                                       <array>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CA23EDF0692099D00951B8B</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>Detail</string>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{10, 27}, {1050, 274}}</string>
+                                                                               <key>RubberWindowFrame</key>
+                                                                               <string>170 278 1340 900 0 0 1920 1178 </string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>XCDetailModule</string>
+                                                               </dict>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CA23EE00692099D00951B8B</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>Project Find</string>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{10, 27}, {1050, 274}}</string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXProjectFindModule</string>
+                                                               </dict>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CA23EE10692099D00951B8B</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>SCM Results</string>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{10, 31}, {603, 297}}</string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXCVSModule</string>
+                                                               </dict>
+                                                       </array>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>1050pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCModuleDock</string>
+                               <string>PBXNavigatorGroup</string>
+                               <string>XCDockableTabModule</string>
+                               <string>XCDetailModule</string>
+                               <string>PBXProjectFindModule</string>
+                               <string>PBXCVSModule</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>A1E710B00A3A22FE007BE3E3</string>
+                               <string>1CA23ED40692098700951B8B</string>
+                               <string>A1E710B10A3A22FE007BE3E3</string>
+                               <string>A1E70DF50A38C765007BE3E3</string>
+                               <string>A1E710B20A3A22FE007BE3E3</string>
+                               <string>1CA23EDF0692099D00951B8B</string>
+                               <string>1CA23EE00692099D00951B8B</string>
+                               <string>1CA23EE10692099D00951B8B</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.default</string>
+               </dict>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>XCToolbarPerspectiveControl</string>
+                               <string>NSToolbarSeparatorItem</string>
+                               <string>active-target-popup</string>
+                               <string>active-executable-popup</string>
+                               <string>active-buildstyle-popup</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>build</string>
+                               <string>clean</string>
+                               <string>NSToolbarSeparatorItem</string>
+                               <string>run</string>
+                               <string>debug</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string></string>
+                       <key>IconName</key>
+                       <string>BuildTabIcon</string>
+                       <key>Identifier</key>
+                       <string>perspective.build</string>
+                       <key>IsVertical</key>
+                       <false/>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXBottomSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CA23EE50692099D00951B8B</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Files</string>
+                                               <key>PBXProjectStructureProvided</key>
+                                               <string>yes</string>
+                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                       <array>
+                                                               <real>184</real>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                       <array>
+                                                               <string>MainColumn</string>
+                                                       </array>
+                                               </dict>
+                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                               <dict>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                       <array/>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                       <array>
+                                                               <array>
+                                                                       <integer>0</integer>
+                                                               </array>
+                                                       </array>
+                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                       <string>{{0, 0}, {184, 841}}</string>
+                                               </dict>
+                                               <key>PBXTopSmartGroupGIDs</key>
+                                               <array/>
+                                               <key>XCIncludePerspectivesSwitch</key>
+                                               <false/>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {201, 859}}</string>
+                                               <key>GroupTreeTableConfiguration</key>
+                                               <array>
+                                                       <string>MainColumn</string>
+                                                       <real>184</real>
+                                               </array>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXSmartGroupTreeModule</string>
+                                       <key>Proportion</key>
+                                       <string>201pt</string>
+                               </dict>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>A1E70DF50A38C765007BE3E3</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>CredentialsCache.h</string>
+                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                               <dict>
+                                                                       <key>Split0</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>A1E70DF60A38C765007BE3E3</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>CredentialsCache.h</string>
+                                                                               <key>_historyCapacity</key>
+                                                                               <integer>0</integer>
+                                                                               <key>bookmark</key>
+                                                                               <string>A1E710F50A3A253F007BE3E3</string>
+                                                                               <key>history</key>
+                                                                               <array>
+                                                                                       <string>A1E70DF70A38C765007BE3E3</string>
+                                                                                       <string>A1E70DF80A38C765007BE3E3</string>
+                                                                                       <string>A1E70DF90A38C765007BE3E3</string>
+                                                                                       <string>A1E70DFA0A38C765007BE3E3</string>
+                                                                                       <string>A1E70DFB0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E010A38C765007BE3E3</string>
+                                                                                       <string>A1E70E020A38C765007BE3E3</string>
+                                                                                       <string>A1E70E060A38C765007BE3E3</string>
+                                                                                       <string>A1E70E090A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0A0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0B0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E0C0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E3D0A38C78C007BE3E3</string>
+                                                                                       <string>A1E70E430A38C791007BE3E3</string>
+                                                                                       <string>A1E70E770A38CA55007BE3E3</string>
+                                                                                       <string>A1E70ECB0A38CC4C007BE3E3</string>
+                                                                                       <string>A1E70F440A38D252007BE3E3</string>
+                                                                                       <string>A1E70F450A38D252007BE3E3</string>
+                                                                                       <string>A1E70F8B0A38D3B4007BE3E3</string>
+                                                                                       <string>A1E70FC60A38D560007BE3E3</string>
+                                                                                       <string>A1E70FC80A38D560007BE3E3</string>
+                                                                                       <string>A1E70FC90A38D560007BE3E3</string>
+                                                                                       <string>A1E70FEE0A38D7C0007BE3E3</string>
+                                                                                       <string>A1E70FEF0A38D7C0007BE3E3</string>
+                                                                                       <string>A1E70FF00A38D7C0007BE3E3</string>
+                                                                                       <string>A1E70FFC0A38D806007BE3E3</string>
+                                                                                       <string>A1E7100D0A38D888007BE3E3</string>
+                                                                                       <string>A1E7103C0A38DE0B007BE3E3</string>
+                                                                                       <string>A1E7105A0A39ED89007BE3E3</string>
+                                                                                       <string>A1E710890A3A1D04007BE3E3</string>
+                                                                                       <string>A1E7109C0A3A1D2B007BE3E3</string>
+                                                                                       <string>A1E710CA0A3A244D007BE3E3</string>
+                                                                                       <string>A1E710CB0A3A244D007BE3E3</string>
+                                                                                       <string>A1E710D80A3A2465007BE3E3</string>
+                                                                                       <string>A1E710E30A3A247D007BE3E3</string>
+                                                                               </array>
+                                                                               <key>prevStack</key>
+                                                                               <array>
+                                                                                       <string>A1E70E100A38C765007BE3E3</string>
+                                                                                       <string>A1E70E110A38C765007BE3E3</string>
+                                                                                       <string>A1E70E120A38C765007BE3E3</string>
+                                                                                       <string>A1E70E130A38C765007BE3E3</string>
+                                                                                       <string>A1E70E140A38C765007BE3E3</string>
+                                                                                       <string>A1E70E150A38C765007BE3E3</string>
+                                                                                       <string>A1E70E160A38C765007BE3E3</string>
+                                                                                       <string>A1E70E170A38C765007BE3E3</string>
+                                                                                       <string>A1E70E180A38C765007BE3E3</string>
+                                                                                       <string>A1E70E1E0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E1F0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E250A38C765007BE3E3</string>
+                                                                                       <string>A1E70E260A38C765007BE3E3</string>
+                                                                                       <string>A1E70E290A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2A0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2B0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2D0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E2E0A38C765007BE3E3</string>
+                                                                                       <string>A1E70E380A38C778007BE3E3</string>
+                                                                                       <string>A1E70E410A38C78C007BE3E3</string>
+                                                                                       <string>A1E70E450A38C791007BE3E3</string>
+                                                                                       <string>A1E70E560A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E580A38C9FD007BE3E3</string>
+                                                                                       <string>A1E70E7D0A38CA55007BE3E3</string>
+                                                                                       <string>A1E70EAB0A38CB24007BE3E3</string>
+                                                                                       <string>A1E70EC30A38CC14007BE3E3</string>
+                                                                                       <string>A1E70EE20A38CCD6007BE3E3</string>
+                                                                                       <string>A1E70FCD0A38D560007BE3E3</string>
+                                                                                       <string>A1E70FFF0A38D806007BE3E3</string>
+                                                                                       <string>A1E710140A38D888007BE3E3</string>
+                                                                                       <string>A1E710400A38DE0B007BE3E3</string>
+                                                                                       <string>A1E70E6F0A38CA08007BE3E3</string>
+                                                                                       <string>A1E710CD0A3A244D007BE3E3</string>
+                                                                                       <string>A1E710E20A3A247D007BE3E3</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>SplitCount</key>
+                                                                       <string>1</string>
+                                                               </dict>
+                                                               <key>StatusBarVisibility</key>
+                                                               <true/>
+                                                               <key>XCSharingToken</key>
+                                                               <string>com.apple.Xcode.CommonNavigatorGroupSharingToken</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {1134, 480}}</string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>480pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>Proportion</key>
+                                                       <string>374pt</string>
+                                                       <key>Tabs</key>
+                                                       <array>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>XCMainBuildResultsModuleGUID</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>Build</string>
+                                                                               <key>XCBuildResultsTrigger_Collapse</key>
+                                                                               <integer>1021</integer>
+                                                                               <key>XCBuildResultsTrigger_Open</key>
+                                                                               <integer>1010</integer>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{10, 27}, {1134, 347}}</string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXBuildResultsModule</string>
+                                                               </dict>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>LauncherConfigVersion</key>
+                                                                               <string>3</string>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CA23EE80692099D00951B8B</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>Run</string>
+                                                                               <key>Runner</key>
+                                                                               <dict>
+                                                                                       <key>HorizontalSplitView</key>
+                                                                                       <dict>
+                                                                                               <key>_collapsingFrameDimension</key>
+                                                                                               <real>0.0</real>
+                                                                                               <key>_indexOfCollapsedView</key>
+                                                                                               <integer>0</integer>
+                                                                                               <key>_percentageOfCollapsedView</key>
+                                                                                               <real>0.0</real>
+                                                                                               <key>isCollapsed</key>
+                                                                                               <string>yes</string>
+                                                                                               <key>sizes</key>
+                                                                                               <array>
+                                                                                                       <string>{{0, 0}, {365, 167}}</string>
+                                                                                                       <string>{{0, 176}, {365, 267}}</string>
+                                                                                               </array>
+                                                                                       </dict>
+                                                                                       <key>VerticalSplitView</key>
+                                                                                       <dict>
+                                                                                               <key>_collapsingFrameDimension</key>
+                                                                                               <real>0.0</real>
+                                                                                               <key>_indexOfCollapsedView</key>
+                                                                                               <integer>0</integer>
+                                                                                               <key>_percentageOfCollapsedView</key>
+                                                                                               <real>0.0</real>
+                                                                                               <key>isCollapsed</key>
+                                                                                               <string>yes</string>
+                                                                                               <key>sizes</key>
+                                                                                               <array>
+                                                                                                       <string>{{0, 0}, {405, 443}}</string>
+                                                                                                       <string>{{414, 0}, {514, 443}}</string>
+                                                                                               </array>
+                                                                                       </dict>
+                                                                               </dict>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{0, 0}, {0, 0}}</string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXRunSessionModule</string>
+                                                               </dict>
+                                                       </array>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>1134pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Build</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCModuleDock</string>
+                               <string>PBXNavigatorGroup</string>
+                               <string>XCDockableTabModule</string>
+                               <string>PBXBuildResultsModule</string>
+                               <string>PBXRunSessionModule</string>
+                               <string>XCConsole</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>A1E710B40A3A22FF007BE3E3</string>
+                               <string>1CA23EE50692099D00951B8B</string>
+                               <string>A1E710B50A3A22FF007BE3E3</string>
+                               <string>A1E70DF50A38C765007BE3E3</string>
+                               <string>A1E710B60A3A22FF007BE3E3</string>
+                               <string>XCMainBuildResultsModuleGUID</string>
+                               <string>1CA23EE80692099D00951B8B</string>
+                               <string>A1E710B70A3A22FF007BE3E3</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.buildAndRun</string>
+               </dict>
+               <dict>
+                       <key>ChosenToolbarItems</key>
+                       <array>
+                               <string>XCToolbarPerspectiveControl</string>
+                               <string>NSToolbarSeparatorItem</string>
+                               <string>build-and-debug</string>
+                               <string>debug</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                               <string>debugger-fix-and-continue</string>
+                               <string>debugger-restart-executable</string>
+                               <string>debugger-pause</string>
+                               <string>debugger-continue</string>
+                               <string>debugger-step-over</string>
+                               <string>debugger-step-into</string>
+                               <string>debugger-step-out</string>
+                               <string>debugger-step-instruction</string>
+                               <string>NSToolbarFlexibleSpaceItem</string>
+                       </array>
+                       <key>ControllerClassBaseName</key>
+                       <string>PBXDebugSessionModule</string>
+                       <key>IconName</key>
+                       <string>DebugTabIcon</string>
+                       <key>Identifier</key>
+                       <string>perspective.debug</string>
+                       <key>IsVertical</key>
+                       <integer>1</integer>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CCC7628064C1048000F2A68</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Debugger Console</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>Frame</key>
+                                               <string>{{0, 0}, {810, 0}}</string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXDebugCLIModule</string>
+                                       <key>Proportion</key>
+                                       <string>0%</string>
+                               </dict>
+                               <dict>
+                                       <key>ContentConfiguration</key>
+                                       <dict>
+                                               <key>Debugger</key>
+                                               <dict>
+                                                       <key>HorizontalSplitView</key>
+                                                       <dict>
+                                                               <key>_collapsingFrameDimension</key>
+                                                               <real>0.0</real>
+                                                               <key>_indexOfCollapsedView</key>
+                                                               <integer>0</integer>
+                                                               <key>_percentageOfCollapsedView</key>
+                                                               <real>0.0</real>
+                                                               <key>isCollapsed</key>
+                                                               <string>yes</string>
+                                                               <key>sizes</key>
+                                                               <array>
+                                                                       <string>{{0, 0}, {395, 213}}</string>
+                                                                       <string>{{395, 0}, {415, 213}}</string>
+                                                               </array>
+                                                       </dict>
+                                                       <key>VerticalSplitView</key>
+                                                       <dict>
+                                                               <key>_collapsingFrameDimension</key>
+                                                               <real>0.0</real>
+                                                               <key>_indexOfCollapsedView</key>
+                                                               <integer>0</integer>
+                                                               <key>_percentageOfCollapsedView</key>
+                                                               <real>0.0</real>
+                                                               <key>isCollapsed</key>
+                                                               <string>yes</string>
+                                                               <key>sizes</key>
+                                                               <array>
+                                                                       <string>{{0, 0}, {810, 213}}</string>
+                                                                       <string>{{0, 213}, {810, 225}}</string>
+                                                               </array>
+                                                       </dict>
+                                               </dict>
+                                               <key>LauncherConfigVersion</key>
+                                               <string>8</string>
+                                               <key>PBXProjectModuleGUID</key>
+                                               <string>1CCC7629064C1048000F2A68</string>
+                                               <key>PBXProjectModuleLabel</key>
+                                               <string>Debug</string>
+                                       </dict>
+                                       <key>GeometryConfiguration</key>
+                                       <dict>
+                                               <key>DebugConsoleDrawerSize</key>
+                                               <string>{100, 120}</string>
+                                               <key>DebugConsoleVisible</key>
+                                               <string>None</string>
+                                               <key>DebugConsoleWindowFrame</key>
+                                               <string>{{200, 200}, {500, 300}}</string>
+                                               <key>DebugSTDIOWindowFrame</key>
+                                               <string>{{200, 200}, {500, 300}}</string>
+                                               <key>Frame</key>
+                                               <string>{{0, 7}, {810, 438}}</string>
+                                       </dict>
+                                       <key>Module</key>
+                                       <string>PBXDebugSessionModule</string>
+                                       <key>Proportion</key>
+                                       <string>443pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debug</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>XCModuleDock</string>
+                               <string>XCModuleDock</string>
+                               <string>PBXDebugCLIModule</string>
+                               <string>PBXDebugSessionModule</string>
+                               <string>XCConsole</string>
+                       </array>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1CC8E6A5069209BD00BB180A</string>
+                               <string>1CC8E6A6069209BD00BB180A</string>
+                               <string>1CCC7628064C1048000F2A68</string>
+                               <string>1CCC7629064C1048000F2A68</string>
+                               <string>1CC8E6A7069209BD00BB180A</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debug</string>
+               </dict>
+       </array>
+       <key>PerspectivesBarVisible</key>
+       <true/>
+       <key>ShelfIsVisible</key>
+       <false/>
+       <key>SourceDescription</key>
+       <string>file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecification.xcperspec'</string>
+       <key>StatusbarIsVisible</key>
+       <true/>
+       <key>TimeStamp</key>
+       <real>171582783.00723499</real>
+       <key>ToolbarDisplayMode</key>
+       <integer>1</integer>
+       <key>ToolbarIsVisible</key>
+       <true/>
+       <key>ToolbarSizeMode</key>
+       <integer>1</integer>
+       <key>Type</key>
+       <string>Perspectives</string>
+       <key>UpdateMessage</key>
+       <string></string>
+       <key>WindowJustification</key>
+       <integer>5</integer>
+       <key>WindowOrderList</key>
+       <array>
+               <string>/Volumes/Ra-Tilt/Users/lxs/KfM/CCAPI/src/lib/ccapi/mac/CCAPI.xcodeproj</string>
+       </array>
+       <key>WindowString</key>
+       <string>170 278 1340 900 0 0 1920 1178 </string>
+       <key>WindowTools</key>
+       <array>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.find</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Dock</key>
+                                                       <array>
+                                                               <dict>
+                                                                       <key>ContentConfiguration</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1CDD528C0622207200134675</string>
+                                                                               <key>PBXProjectModuleLabel</key>
+                                                                               <string>&lt;No Editor&gt;</string>
+                                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                                               <dict>
+                                                                                       <key>Split0</key>
+                                                                                       <dict>
+                                                                                               <key>PBXProjectModuleGUID</key>
+                                                                                               <string>1CD0528D0623707200166675</string>
+                                                                                       </dict>
+                                                                                       <key>SplitCount</key>
+                                                                                       <string>1</string>
+                                                                               </dict>
+                                                                               <key>StatusBarVisibility</key>
+                                                                               <integer>1</integer>
+                                                                       </dict>
+                                                                       <key>GeometryConfiguration</key>
+                                                                       <dict>
+                                                                               <key>Frame</key>
+                                                                               <string>{{0, 0}, {781, 167}}</string>
+                                                                               <key>RubberWindowFrame</key>
+                                                                               <string>62 385 781 470 0 0 1440 878 </string>
+                                                                       </dict>
+                                                                       <key>Module</key>
+                                                                       <string>PBXNavigatorGroup</string>
+                                                                       <key>Proportion</key>
+                                                                       <string>781pt</string>
+                                                               </dict>
+                                                       </array>
+                                                       <key>Proportion</key>
+                                                       <string>50%</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <integer>1</integer>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528E0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Project Find</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{8, 0}, {773, 254}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>62 385 781 470 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXProjectFindModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>50%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>428pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Project Find</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXProjectFindModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>1</integer>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C530D57069F1CE1000CFCEE</string>
+                               <string>1C530D58069F1CE1000CFCEE</string>
+                               <string>1C530D59069F1CE1000CFCEE</string>
+                               <string>1CDD528C0622207200134675</string>
+                               <string>1C530D5A069F1CE1000CFCEE</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>1CD0528E0623707200166675</string>
+                       </array>
+                       <key>WindowString</key>
+                       <string>62 385 781 470 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1C530D57069F1CE1000CFCEE</string>
+                       <key>WindowToolIsVisible</key>
+                       <integer>0</integer>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.run</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>LauncherConfigVersion</key>
+                                                               <string>3</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD0528B0623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Run - cocoapp112 - cocoapp112</string>
+                                                               <key>Runner</key>
+                                                               <dict>
+                                                                       <key>HorizontalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {365, 167}}</string>
+                                                                                       <string>{{0, 176}, {365, 267}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                                       <key>VerticalSplitView</key>
+                                                                       <dict>
+                                                                               <key>_collapsingFrameDimension</key>
+                                                                               <real>0.0</real>
+                                                                               <key>_indexOfCollapsedView</key>
+                                                                               <integer>0</integer>
+                                                                               <key>_percentageOfCollapsedView</key>
+                                                                               <real>0.0</real>
+                                                                               <key>isCollapsed</key>
+                                                                               <string>yes</string>
+                                                                               <key>sizes</key>
+                                                                               <array>
+                                                                                       <string>{{0, 0}, {405, 443}}</string>
+                                                                                       <string>{{414, 0}, {514, 443}}</string>
+                                                                               </array>
+                                                                       </dict>
+                                                               </dict>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {456, 192}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>741 130 456 234 0 0 1280 1002 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXRunSessionModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>192pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>192pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Run Log</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXRunSessionModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>1</integer>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C78EAAF065D492600B07095</string>
+                               <string>1C78EAB0065D492600B07095</string>
+                               <string>1CD0528B0623707200166675</string>
+                               <string>1C78EAB1065D492600B07095</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.run</string>
+                       <key>WindowString</key>
+                       <string>741 130 456 234 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.scm</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1C78EAB2065D492600B07095</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>&lt;No Editor&gt;</string>
+                                                               <key>PBXSplitModuleInNavigatorKey</key>
+                                                               <dict>
+                                                                       <key>Split0</key>
+                                                                       <dict>
+                                                                               <key>PBXProjectModuleGUID</key>
+                                                                               <string>1C78EAB3065D492600B07095</string>
+                                                                       </dict>
+                                                                       <key>SplitCount</key>
+                                                                       <string>1</string>
+                                                               </dict>
+                                                               <key>StatusBarVisibility</key>
+                                                               <integer>1</integer>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {452, 0}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>743 379 452 308 0 0 1280 1002 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>0pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <integer>1</integer>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CD052920623707200166675</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>SCM</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>ConsoleFrame</key>
+                                                               <string>{{0, 259}, {452, 0}}</string>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 7}, {452, 259}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>743 379 452 308 0 0 1280 1002 </string>
+                                                               <key>TableConfiguration</key>
+                                                               <array>
+                                                                       <string>Status</string>
+                                                                       <real>30</real>
+                                                                       <string>FileName</string>
+                                                                       <real>199</real>
+                                                                       <string>Path</string>
+                                                                       <real>197.09500122070312</real>
+                                                               </array>
+                                                               <key>TableFrame</key>
+                                                               <string>{{0, 0}, {452, 250}}</string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXCVSModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>262pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>266pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>SCM</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXCVSModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>1</integer>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C78EAB4065D492600B07095</string>
+                               <string>1C78EAB5065D492600B07095</string>
+                               <string>1C78EAB2065D492600B07095</string>
+                               <string>1CD052920623707200166675</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.scm</string>
+                       <key>WindowString</key>
+                       <string>743 379 452 308 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.breakpoints</string>
+                       <key>IsVertical</key>
+                       <integer>0</integer>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <integer>1</integer>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXBottomSmartGroupGIDs</key>
+                                                               <array>
+                                                                       <string>1C77FABC04509CD000000102</string>
+                                                               </array>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CE0B1FE06471DED0097A5F4</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Files</string>
+                                                               <key>PBXProjectStructureProvided</key>
+                                                               <string>no</string>
+                                                               <key>PBXSmartGroupTreeModuleColumnData</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
+                                                                       <array>
+                                                                               <real>168</real>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
+                                                                       <array>
+                                                                               <string>MainColumn</string>
+                                                                       </array>
+                                                               </dict>
+                                                               <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key>
+                                                               <dict>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
+                                                                       <array>
+                                                                               <string>1C77FABC04509CD000000102</string>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
+                                                                       <array>
+                                                                               <array>
+                                                                                       <integer>0</integer>
+                                                                               </array>
+                                                                       </array>
+                                                                       <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
+                                                                       <string>{{0, 0}, {168, 350}}</string>
+                                                               </dict>
+                                                               <key>PBXTopSmartGroupGIDs</key>
+                                                               <array/>
+                                                               <key>XCIncludePerspectivesSwitch</key>
+                                                               <integer>0</integer>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {185, 368}}</string>
+                                                               <key>GroupTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>MainColumn</string>
+                                                                       <real>168</real>
+                                                               </array>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>315 424 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXSmartGroupTreeModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>185pt</string>
+                                               </dict>
+                                               <dict>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA1AED706398EBD00589147</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Detail</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>Frame</key>
+                                                               <string>{{190, 0}, {554, 368}}</string>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>315 424 744 409 0 0 1440 878 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>XCDetailModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>554pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>368pt</string>
+                               </dict>
+                       </array>
+                       <key>MajorVersion</key>
+                       <integer>2</integer>
+                       <key>MinorVersion</key>
+                       <integer>0</integer>
+                       <key>Name</key>
+                       <string>Breakpoints</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXSmartGroupTreeModule</string>
+                               <string>XCDetailModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>1</integer>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1CDDB66807F98D9800BB5817</string>
+                               <string>1CDDB66907F98D9800BB5817</string>
+                               <string>1CE0B1FE06471DED0097A5F4</string>
+                               <string>1CA1AED706398EBD00589147</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.breakpoints</string>
+                       <key>WindowString</key>
+                       <string>315 424 744 409 0 0 1440 878 </string>
+                       <key>WindowToolGUID</key>
+                       <string>1CDDB66807F98D9800BB5817</string>
+                       <key>WindowToolIsVisible</key>
+                       <integer>1</integer>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.debugAnimator</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>PBXNavigatorGroup</string>
+                                                       <key>Proportion</key>
+                                                       <string>100%</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>100%</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Debug Visualizer</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXNavigatorGroup</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>1</integer>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.debugAnimator</string>
+                       <key>WindowString</key>
+                       <string>100 100 700 500 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.bookmarks</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>Module</key>
+                                                       <string>PBXBookmarksModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>166pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>166pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Bookmarks</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXBookmarksModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>0</integer>
+                       <key>WindowString</key>
+                       <string>538 42 401 187 0 0 1280 1002 </string>
+               </dict>
+               <dict>
+                       <key>Identifier</key>
+                       <string>windowTool.classBrowser</string>
+                       <key>Layout</key>
+                       <array>
+                               <dict>
+                                       <key>Dock</key>
+                                       <array>
+                                               <dict>
+                                                       <key>BecomeActive</key>
+                                                       <integer>1</integer>
+                                                       <key>ContentConfiguration</key>
+                                                       <dict>
+                                                               <key>OptionsSetName</key>
+                                                               <string>Hierarchy, all classes</string>
+                                                               <key>PBXProjectModuleGUID</key>
+                                                               <string>1CA6456E063B45B4001379D8</string>
+                                                               <key>PBXProjectModuleLabel</key>
+                                                               <string>Class Browser - NSObject</string>
+                                                       </dict>
+                                                       <key>GeometryConfiguration</key>
+                                                       <dict>
+                                                               <key>ClassesFrame</key>
+                                                               <string>{{0, 0}, {369, 96}}</string>
+                                                               <key>ClassesTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXClassNameColumnIdentifier</string>
+                                                                       <real>208</real>
+                                                                       <string>PBXClassBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>Frame</key>
+                                                               <string>{{0, 0}, {616, 353}}</string>
+                                                               <key>MembersFrame</key>
+                                                               <string>{{0, 105}, {369, 395}}</string>
+                                                               <key>MembersTreeTableConfiguration</key>
+                                                               <array>
+                                                                       <string>PBXMemberTypeIconColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                                       <string>PBXMemberNameColumnIdentifier</string>
+                                                                       <real>216</real>
+                                                                       <string>PBXMemberTypeColumnIdentifier</string>
+                                                                       <real>94</real>
+                                                                       <string>PBXMemberBookColumnIdentifier</string>
+                                                                       <real>22</real>
+                                                               </array>
+                                                               <key>PBXModuleWindowStatusBarHidden2</key>
+                                                               <integer>1</integer>
+                                                               <key>RubberWindowFrame</key>
+                                                               <string>597 125 616 374 0 0 1280 1002 </string>
+                                                       </dict>
+                                                       <key>Module</key>
+                                                       <string>PBXClassBrowserModule</string>
+                                                       <key>Proportion</key>
+                                                       <string>354pt</string>
+                                               </dict>
+                                       </array>
+                                       <key>Proportion</key>
+                                       <string>354pt</string>
+                               </dict>
+                       </array>
+                       <key>Name</key>
+                       <string>Class Browser</string>
+                       <key>ServiceClasses</key>
+                       <array>
+                               <string>PBXClassBrowserModule</string>
+                       </array>
+                       <key>StatusbarIsVisible</key>
+                       <integer>0</integer>
+                       <key>TableOfContents</key>
+                       <array>
+                               <string>1C78EABA065D492600B07095</string>
+                               <string>1C78EABB065D492600B07095</string>
+                               <string>1CA6456E063B45B4001379D8</string>
+                       </array>
+                       <key>ToolbarConfiguration</key>
+                       <string>xcode.toolbar.config.classbrowser</string>
+                       <key>WindowString</key>
+                       <string>597 125 616 374 0 0 1280 1002 </string>
+               </dict>
+       </array>
+</dict>
+</plist>
diff --git a/src/lib/ccapi/mac/CCAPI.xcodeproj/project.pbxproj b/src/lib/ccapi/mac/CCAPI.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..38a73b4
--- /dev/null
@@ -0,0 +1,599 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 42;
+       objects = {
+
+/* Begin PBXBuildFile section */
+               A1E70D480A38B5D5007BE3E3 /* cacheapi.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */; };
+               A1E70D490A38B5D5007BE3E3 /* ccache.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */; };
+               A1E70D4A0A38B5D5007BE3E3 /* ccache_iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */; };
+               A1E70D4B0A38B5D5007BE3E3 /* ccapiv2.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */; };
+               A1E70D4C0A38B5D5007BE3E3 /* ccstring.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D060A38B5BB007BE3E3 /* ccstring.c */; };
+               A1E70D4D0A38B5D5007BE3E3 /* context.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D080A38B5BB007BE3E3 /* context.c */; };
+               A1E70D4E0A38B5D5007BE3E3 /* credentials.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D0A0A38B5BB007BE3E3 /* credentials.c */; };
+               A1E70D4F0A38B5D5007BE3E3 /* credentials_iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */; };
+               A1E70D510A38B60C007BE3E3 /* generic_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */; };
+               A1E70D520A38B60C007BE3E3 /* marshall.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */; };
+               A1E70D530A38B60C007BE3E3 /* msg.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D140A38B5BB007BE3E3 /* msg.c */; };
+               A1E70D890A38BB47007BE3E3 /* ccs_ccache.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */; };
+               A1E70D8A0A38BB47007BE3E3 /* ccs_context.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D290A38B5BB007BE3E3 /* ccs_context.c */; };
+               A1E70D8B0A38BB47007BE3E3 /* ccs_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */; };
+               A1E70D8C0A38BB47007BE3E3 /* rpc_auth.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */; };
+               A1E70D8D0A38BB47007BE3E3 /* serv_ops.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */; };
+               A1E70D8E0A38BB4F007BE3E3 /* generic_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */; };
+               A1E70D8F0A38BB4F007BE3E3 /* marshall.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */; };
+               A1E70D900A38BB4F007BE3E3 /* msg.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D140A38B5BB007BE3E3 /* msg.c */; };
+               A1E70D9B0A38BBE2007BE3E3 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D930A38BB67007BE3E3 /* main.c */; };
+               A1E70D9F0A38BCAD007BE3E3 /* mig.defs in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */; };
+               A1E70DA00A38BCAD007BE3E3 /* mig.defs in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               A1E70DEA0A38C710007BE3E3 /* kipc_client.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */; };
+               A1E70DEB0A38C710007BE3E3 /* kipc_common.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */; };
+               A1E70DEC0A38C710007BE3E3 /* kipc_session.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */; };
+               A1E70DED0A38C71D007BE3E3 /* kipc_common.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */; };
+               A1E70DEE0A38C71D007BE3E3 /* kipc_server.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */; };
+               A1E70DEF0A38C71D007BE3E3 /* kipc_session.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */; };
+               A1E70DF00A38C71D007BE3E3 /* notify.defs in Sources */ = {isa = PBXBuildFile; fileRef = A1E70DE80A38C6FD007BE3E3 /* notify.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+               A1E70D000A38B5BB007BE3E3 /* cacheapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cacheapi.c; sourceTree = "<group>"; };
+               A1E70D010A38B5BB007BE3E3 /* ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccache.c; sourceTree = "<group>"; };
+               A1E70D020A38B5BB007BE3E3 /* ccache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccache.h; sourceTree = "<group>"; };
+               A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccache_iterator.c; sourceTree = "<group>"; };
+               A1E70D040A38B5BB007BE3E3 /* ccache_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccache_iterator.h; sourceTree = "<group>"; };
+               A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccapiv2.c; sourceTree = "<group>"; };
+               A1E70D060A38B5BB007BE3E3 /* ccstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccstring.c; sourceTree = "<group>"; };
+               A1E70D070A38B5BB007BE3E3 /* ccstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccstring.h; sourceTree = "<group>"; };
+               A1E70D080A38B5BB007BE3E3 /* context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = context.c; sourceTree = "<group>"; };
+               A1E70D090A38B5BB007BE3E3 /* context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = "<group>"; };
+               A1E70D0A0A38B5BB007BE3E3 /* credentials.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = credentials.c; sourceTree = "<group>"; };
+               A1E70D0B0A38B5BB007BE3E3 /* credentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = credentials.h; sourceTree = "<group>"; };
+               A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = credentials_iterator.c; sourceTree = "<group>"; };
+               A1E70D0D0A38B5BB007BE3E3 /* credentials_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = credentials_iterator.h; sourceTree = "<group>"; };
+               A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D120A38B5BB007BE3E3 /* generic_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = generic_lists.c; sourceTree = "<group>"; };
+               A1E70D130A38B5BB007BE3E3 /* marshall.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = marshall.c; sourceTree = "<group>"; };
+               A1E70D140A38B5BB007BE3E3 /* msg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msg.c; sourceTree = "<group>"; };
+               A1E70D150A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D170A38B5BB007BE3E3 /* implementation-notes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "implementation-notes.txt"; sourceTree = "<group>"; };
+               A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cc_rpc.h; sourceTree = "<group>"; };
+               A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialsCache.h; sourceTree = "<group>"; };
+               A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialsCache2.h; sourceTree = "<group>"; };
+               A1E70D1C0A38B5BB007BE3E3 /* datastore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datastore.h; sourceTree = "<group>"; };
+               A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = generic_lists.h; sourceTree = "<group>"; };
+               A1E70D1E0A38B5BB007BE3E3 /* marshall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marshall.h; sourceTree = "<group>"; };
+               A1E70D1F0A38B5BB007BE3E3 /* msg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msg.h; sourceTree = "<group>"; };
+               A1E70D200A38B5BB007BE3E3 /* msg_headers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msg_headers.h; sourceTree = "<group>"; };
+               A1E70D210A38B5BB007BE3E3 /* rpc_auth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpc_auth.h; sourceTree = "<group>"; };
+               A1E70D260A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NTMakefile; path = ../NTMakefile; sourceTree = SOURCE_ROOT; };
+               A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_ccache.c; sourceTree = "<group>"; };
+               A1E70D290A38B5BB007BE3E3 /* ccs_context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_context.c; sourceTree = "<group>"; };
+               A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_lists.c; sourceTree = "<group>"; };
+               A1E70D2C0A38B5BB007BE3E3 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+               A1E70D2D0A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rpc_auth.c; sourceTree = "<group>"; };
+               A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = serv_ops.c; sourceTree = "<group>"; };
+               A1E70D300A38B5BB007BE3E3 /* serv_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serv_ops.h; sourceTree = "<group>"; };
+               A1E70D330A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D340A38B5BB007BE3E3 /* t_ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_ccache.c; sourceTree = "<group>"; };
+               A1E70D350A38B5BB007BE3E3 /* t_context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_context.c; sourceTree = "<group>"; };
+               A1E70D360A38B5BB007BE3E3 /* t_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_lists.c; sourceTree = "<group>"; };
+               A1E70D370A38B5BB007BE3E3 /* t_msg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_msg.c; sourceTree = "<group>"; };
+               A1E70D380A38B5BB007BE3E3 /* t_server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_server.c; sourceTree = "<group>"; };
+               A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cacheapi.def; sourceTree = "<group>"; };
+               A1E70D3B0A38B5BB007BE3E3 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = "<group>"; };
+               A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dllmain.c; sourceTree = "<group>"; };
+               A1E70D3D0A38B5BC007BE3E3 /* ntccrpc.acf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ntccrpc.acf; sourceTree = "<group>"; };
+               A1E70D3E0A38B5BC007BE3E3 /* ntccrpc.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ntccrpc.idl; sourceTree = "<group>"; };
+               A1E70D3F0A38B5BC007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D410A38B5BC007BE3E3 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = "<group>"; };
+               A1E70D420A38B5BC007BE3E3 /* cstest.acf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cstest.acf; sourceTree = "<group>"; };
+               A1E70D430A38B5BC007BE3E3 /* cstest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cstest.idl; sourceTree = "<group>"; };
+               A1E70D440A38B5BC007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
+               A1E70D450A38B5BC007BE3E3 /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = "<group>"; };
+               A1E70D460A38B5BC007BE3E3 /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = "<group>"; };
+               A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = CCacheServer.app; sourceTree = BUILT_PRODUCTS_DIR; };
+               A1E70D910A38BB67007BE3E3 /* CCacheServer.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CCacheServer.plist; sourceTree = "<group>"; };
+               A1E70D920A38BB67007BE3E3 /* CCacheServerInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CCacheServerInfo.plist; sourceTree = "<group>"; };
+               A1E70D930A38BB67007BE3E3 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+               A1E70D9E0A38BCAD007BE3E3 /* mig.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = mig.defs; sourceTree = "<group>"; };
+               A1E70DB10A38C01E007BE3E3 /* mig_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mig_types.h; sourceTree = "<group>"; };
+               A1E70DE00A38C6FD007BE3E3 /* kipc_client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kipc_client.h; sourceTree = "<group>"; };
+               A1E70DE10A38C6FD007BE3E3 /* kipc_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kipc_common.h; sourceTree = "<group>"; };
+               A1E70DE20A38C6FD007BE3E3 /* kipc_server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kipc_server.h; sourceTree = "<group>"; };
+               A1E70DE30A38C6FD007BE3E3 /* kipc_session.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kipc_session.h; sourceTree = "<group>"; };
+               A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kipc_client.c; sourceTree = "<group>"; };
+               A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kipc_common.c; sourceTree = "<group>"; };
+               A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kipc_server.c; sourceTree = "<group>"; };
+               A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kipc_session.c; sourceTree = "<group>"; };
+               A1E70DE80A38C6FD007BE3E3 /* notify.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = notify.defs; sourceTree = "<group>"; };
+               A1E70DE90A38C6FD007BE3E3 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+               D2AAC046055464E500DB518D /* libCCAPI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCCAPI.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               A1E70D5B0A38B796007BE3E3 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               D289987405E68DCB004EDB86 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               08FB7794FE84155DC02AAC07 /* CCAPI */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70CFF0A38B5BB007BE3E3 /* client */,
+                               A1E70D110A38B5BB007BE3E3 /* common */,
+                               A1E70D160A38B5BB007BE3E3 /* doc */,
+                               A1E70D180A38B5BB007BE3E3 /* include */,
+                               A1E70D260A38B5BB007BE3E3 /* NTMakefile */,
+                               A1E70D270A38B5BB007BE3E3 /* server */,
+                               A1E70D320A38B5BB007BE3E3 /* unit-test */,
+                               A1E70D390A38B5BB007BE3E3 /* windows */,
+                               1AB674ADFE9D54B511CA2CBB /* Products */,
+                       );
+                       name = CCAPI;
+                       sourceTree = "<group>";
+               };
+               1AB674ADFE9D54B511CA2CBB /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               D2AAC046055464E500DB518D /* libCCAPI.a */,
+                               A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               A1E70CFF0A38B5BB007BE3E3 /* client */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D000A38B5BB007BE3E3 /* cacheapi.c */,
+                               A1E70D010A38B5BB007BE3E3 /* ccache.c */,
+                               A1E70D020A38B5BB007BE3E3 /* ccache.h */,
+                               A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */,
+                               A1E70D040A38B5BB007BE3E3 /* ccache_iterator.h */,
+                               A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */,
+                               A1E70D060A38B5BB007BE3E3 /* ccstring.c */,
+                               A1E70D070A38B5BB007BE3E3 /* ccstring.h */,
+                               A1E70D080A38B5BB007BE3E3 /* context.c */,
+                               A1E70D090A38B5BB007BE3E3 /* context.h */,
+                               A1E70D0A0A38B5BB007BE3E3 /* credentials.c */,
+                               A1E70D0B0A38B5BB007BE3E3 /* credentials.h */,
+                               A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */,
+                               A1E70D0D0A38B5BB007BE3E3 /* credentials_iterator.h */,
+                               A1E70D0E0A38B5BB007BE3E3 /* mac */,
+                               A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */,
+                               A1E70D100A38B5BB007BE3E3 /* windows */,
+                       );
+                       name = client;
+                       path = ../client;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D0E0A38B5BB007BE3E3 /* mac */ = {
+                       isa = PBXGroup;
+                       children = (
+                       );
+                       path = mac;
+                       sourceTree = "<group>";
+               };
+               A1E70D100A38B5BB007BE3E3 /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                       );
+                       path = windows;
+                       sourceTree = "<group>";
+               };
+               A1E70D110A38B5BB007BE3E3 /* common */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D7E0A38BAC5007BE3E3 /* mac */,
+                               A1E70D120A38B5BB007BE3E3 /* generic_lists.c */,
+                               A1E70D130A38B5BB007BE3E3 /* marshall.c */,
+                               A1E70D140A38B5BB007BE3E3 /* msg.c */,
+                               A1E70D150A38B5BB007BE3E3 /* NTMakefile */,
+                       );
+                       name = common;
+                       path = ../common;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D160A38B5BB007BE3E3 /* doc */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D170A38B5BB007BE3E3 /* implementation-notes.txt */,
+                       );
+                       name = doc;
+                       path = ../doc;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D180A38B5BB007BE3E3 /* include */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */,
+                               A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */,
+                               A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */,
+                               A1E70D1C0A38B5BB007BE3E3 /* datastore.h */,
+                               A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */,
+                               A1E70D1E0A38B5BB007BE3E3 /* marshall.h */,
+                               A1E70D1F0A38B5BB007BE3E3 /* msg.h */,
+                               A1E70D200A38B5BB007BE3E3 /* msg_headers.h */,
+                               A1E70D210A38B5BB007BE3E3 /* rpc_auth.h */,
+                       );
+                       name = include;
+                       path = ../include;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D270A38B5BB007BE3E3 /* server */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */,
+                               A1E70D290A38B5BB007BE3E3 /* ccs_context.c */,
+                               A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */,
+                               A1E70D2B0A38B5BB007BE3E3 /* mac */,
+                               A1E70D2C0A38B5BB007BE3E3 /* main.c */,
+                               A1E70D2D0A38B5BB007BE3E3 /* NTMakefile */,
+                               A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */,
+                               A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */,
+                               A1E70D300A38B5BB007BE3E3 /* serv_ops.h */,
+                               A1E70D310A38B5BB007BE3E3 /* windows */,
+                       );
+                       name = server;
+                       path = ../server;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D2B0A38B5BB007BE3E3 /* mac */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D910A38BB67007BE3E3 /* CCacheServer.plist */,
+                               A1E70D920A38BB67007BE3E3 /* CCacheServerInfo.plist */,
+                               A1E70D930A38BB67007BE3E3 /* main.c */,
+                       );
+                       path = mac;
+                       sourceTree = "<group>";
+               };
+               A1E70D310A38B5BB007BE3E3 /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                       );
+                       path = windows;
+                       sourceTree = "<group>";
+               };
+               A1E70D320A38B5BB007BE3E3 /* unit-test */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D330A38B5BB007BE3E3 /* NTMakefile */,
+                               A1E70D340A38B5BB007BE3E3 /* t_ccache.c */,
+                               A1E70D350A38B5BB007BE3E3 /* t_context.c */,
+                               A1E70D360A38B5BB007BE3E3 /* t_lists.c */,
+                               A1E70D370A38B5BB007BE3E3 /* t_msg.c */,
+                               A1E70D380A38B5BB007BE3E3 /* t_server.c */,
+                       );
+                       name = "unit-test";
+                       path = "../unit-test";
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D390A38B5BB007BE3E3 /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */,
+                               A1E70D3B0A38B5BB007BE3E3 /* client.c */,
+                               A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */,
+                               A1E70D3D0A38B5BC007BE3E3 /* ntccrpc.acf */,
+                               A1E70D3E0A38B5BC007BE3E3 /* ntccrpc.idl */,
+                               A1E70D3F0A38B5BC007BE3E3 /* NTMakefile */,
+                               A1E70D400A38B5BC007BE3E3 /* rpcsstest */,
+                               A1E70D460A38B5BC007BE3E3 /* server.c */,
+                       );
+                       name = windows;
+                       path = ../windows;
+                       sourceTree = SOURCE_ROOT;
+               };
+               A1E70D400A38B5BC007BE3E3 /* rpcsstest */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70D410A38B5BC007BE3E3 /* client.c */,
+                               A1E70D420A38B5BC007BE3E3 /* cstest.acf */,
+                               A1E70D430A38B5BC007BE3E3 /* cstest.idl */,
+                               A1E70D440A38B5BC007BE3E3 /* NTMakefile */,
+                               A1E70D450A38B5BC007BE3E3 /* server.c */,
+                       );
+                       path = rpcsstest;
+                       sourceTree = "<group>";
+               };
+               A1E70D7E0A38BAC5007BE3E3 /* mac */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70DDE0A38C6FD007BE3E3 /* KerberosIPC */,
+                               A1E70D9E0A38BCAD007BE3E3 /* mig.defs */,
+                               A1E70DB10A38C01E007BE3E3 /* mig_types.h */,
+                       );
+                       path = mac;
+                       sourceTree = "<group>";
+               };
+               A1E70DDE0A38C6FD007BE3E3 /* KerberosIPC */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70DDF0A38C6FD007BE3E3 /* Kerberos */,
+                               A1E70DE40A38C6FD007BE3E3 /* kipc_client.c */,
+                               A1E70DE50A38C6FD007BE3E3 /* kipc_common.c */,
+                               A1E70DE60A38C6FD007BE3E3 /* kipc_server.c */,
+                               A1E70DE70A38C6FD007BE3E3 /* kipc_session.c */,
+                               A1E70DE80A38C6FD007BE3E3 /* notify.defs */,
+                               A1E70DE90A38C6FD007BE3E3 /* README */,
+                       );
+                       path = KerberosIPC;
+                       sourceTree = "<group>";
+               };
+               A1E70DDF0A38C6FD007BE3E3 /* Kerberos */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A1E70DE00A38C6FD007BE3E3 /* kipc_client.h */,
+                               A1E70DE10A38C6FD007BE3E3 /* kipc_common.h */,
+                               A1E70DE20A38C6FD007BE3E3 /* kipc_server.h */,
+                               A1E70DE30A38C6FD007BE3E3 /* kipc_session.h */,
+                       );
+                       path = Kerberos;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+               D2AAC043055464E500DB518D /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+               A1E70D5C0A38B796007BE3E3 /* CCacheServer */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = A1E70D600A38B797007BE3E3 /* Build configuration list for PBXNativeTarget "CCacheServer" */;
+                       buildPhases = (
+                               A1E70D590A38B796007BE3E3 /* Resources */,
+                               A1E70D5A0A38B796007BE3E3 /* Sources */,
+                               A1E70D5B0A38B796007BE3E3 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = CCacheServer;
+                       productName = CCacheServer;
+                       productReference = A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */;
+                       productType = "com.apple.product-type.application";
+               };
+               D2AAC045055464E500DB518D /* CCAPI */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "CCAPI" */;
+                       buildPhases = (
+                               D2AAC043055464E500DB518D /* Headers */,
+                               D2AAC044055464E500DB518D /* Sources */,
+                               D289987405E68DCB004EDB86 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = CCAPI;
+                       productName = CCAPI;
+                       productReference = D2AAC046055464E500DB518D /* libCCAPI.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               08FB7793FE84155DC02AAC07 /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "CCAPI" */;
+                       hasScannedForEncodings = 1;
+                       mainGroup = 08FB7794FE84155DC02AAC07 /* CCAPI */;
+                       projectDirPath = "";
+                       targets = (
+                               D2AAC045055464E500DB518D /* CCAPI */,
+                               A1E70D5C0A38B796007BE3E3 /* CCacheServer */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+               A1E70D590A38B796007BE3E3 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               A1E70D5A0A38B796007BE3E3 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               A1E70DA00A38BCAD007BE3E3 /* mig.defs in Sources */,
+                               A1E70DF00A38C71D007BE3E3 /* notify.defs in Sources */,
+                               A1E70D9B0A38BBE2007BE3E3 /* main.c in Sources */,
+                               A1E70D890A38BB47007BE3E3 /* ccs_ccache.c in Sources */,
+                               A1E70D8A0A38BB47007BE3E3 /* ccs_context.c in Sources */,
+                               A1E70D8B0A38BB47007BE3E3 /* ccs_lists.c in Sources */,
+                               A1E70D8C0A38BB47007BE3E3 /* rpc_auth.c in Sources */,
+                               A1E70D8D0A38BB47007BE3E3 /* serv_ops.c in Sources */,
+                               A1E70D8E0A38BB4F007BE3E3 /* generic_lists.c in Sources */,
+                               A1E70D8F0A38BB4F007BE3E3 /* marshall.c in Sources */,
+                               A1E70D900A38BB4F007BE3E3 /* msg.c in Sources */,
+                               A1E70DED0A38C71D007BE3E3 /* kipc_common.c in Sources */,
+                               A1E70DEE0A38C71D007BE3E3 /* kipc_server.c in Sources */,
+                               A1E70DEF0A38C71D007BE3E3 /* kipc_session.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               D2AAC044055464E500DB518D /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               A1E70D9F0A38BCAD007BE3E3 /* mig.defs in Sources */,
+                               A1E70D480A38B5D5007BE3E3 /* cacheapi.c in Sources */,
+                               A1E70D490A38B5D5007BE3E3 /* ccache.c in Sources */,
+                               A1E70D4A0A38B5D5007BE3E3 /* ccache_iterator.c in Sources */,
+                               A1E70D4B0A38B5D5007BE3E3 /* ccapiv2.c in Sources */,
+                               A1E70D4C0A38B5D5007BE3E3 /* ccstring.c in Sources */,
+                               A1E70D4D0A38B5D5007BE3E3 /* context.c in Sources */,
+                               A1E70D4E0A38B5D5007BE3E3 /* credentials.c in Sources */,
+                               A1E70D4F0A38B5D5007BE3E3 /* credentials_iterator.c in Sources */,
+                               A1E70D510A38B60C007BE3E3 /* generic_lists.c in Sources */,
+                               A1E70D520A38B60C007BE3E3 /* marshall.c in Sources */,
+                               A1E70D530A38B60C007BE3E3 /* msg.c in Sources */,
+                               A1E70DEA0A38C710007BE3E3 /* kipc_client.c in Sources */,
+                               A1E70DEB0A38C710007BE3E3 /* kipc_common.c in Sources */,
+                               A1E70DEC0A38C710007BE3E3 /* kipc_session.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+               1DEB91EC08733DB70010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               HEADER_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       ../client,
+                                       ../client/mac,
+                                       ../common,
+                                       ../common/mac,
+                                       ../common/mac/KerberosIPC,
+                               );
+                               PRODUCT_NAME = CCAPI;
+                       };
+                       name = Debug;
+               };
+               1DEB91ED08733DB70010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       ../client,
+                                       ../client/mac,
+                                       ../common,
+                                       ../common/mac,
+                                       ../common/mac/KerberosIPC,
+                               );
+                               PRODUCT_NAME = CCAPI;
+                       };
+                       name = Release;
+               };
+               1DEB91F008733DB70010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = (
+                                       i386,
+                                       ppc,
+                               );
+                               COPY_PHASE_STRIP = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               PREBINDING = NO;
+                               ZERO_LINK = YES;
+                       };
+                       name = Debug;
+               };
+               1DEB91F108733DB70010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = "$(NATIVE_ARCH)";
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 3;
+                               PREBINDING = NO;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+               A1E70D610A38B797007BE3E3 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       ../server,
+                                       ../server/mac,
+                                       ../common,
+                                       ../common/mac,
+                                       ../common/mac/KerberosIPC,
+                               );
+                               INFOPLIST_FILE = ../server/mac/CCacheServerInfo.plist;
+                               INSTALL_PATH = /System/Library/CoreServices;
+                               PRODUCT_NAME = CCacheServer;
+                               WRAPPER_EXTENSION = app;
+                       };
+                       name = Debug;
+               };
+               A1E70D620A38B797007BE3E3 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       ../server,
+                                       ../server/mac,
+                                       ../common,
+                                       ../common/mac,
+                                       ../common/mac/KerberosIPC,
+                               );
+                               INFOPLIST_FILE = ../server/mac/CCacheServerInfo.plist;
+                               INSTALL_PATH = /System/Library/CoreServices;
+                               PRODUCT_NAME = CCacheServer;
+                               WRAPPER_EXTENSION = app;
+                       };
+                       name = Release;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "CCAPI" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB91EC08733DB70010E9CD /* Debug */,
+                               1DEB91ED08733DB70010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "CCAPI" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB91F008733DB70010E9CD /* Debug */,
+                               1DEB91F108733DB70010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               A1E70D600A38B797007BE3E3 /* Build configuration list for PBXNativeTarget "CCacheServer" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A1E70D610A38B797007BE3E3 /* Debug */,
+                               A1E70D620A38B797007BE3E3 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/src/lib/ccapi/marshall.c b/src/lib/ccapi/marshall.c
deleted file mode 100644 (file)
index 7027d65..0000000
+++ /dev/null
@@ -1,378 +0,0 @@
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-/* marshall.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <CredentialsCache.h>
-#include "msg.h"
-#include "msg_headers.h"
-#include "marshall.h"
-
-cc_int32
-cci_creds_v4_marshall( cc_credentials_v4_t * creds, 
-                       char ** flat, 
-                       cc_uint32 * len)
-{
-    cc_msg_t *  msg;
-    ccmsg_creds_v4_t * header;
-    cc_uint32   blob_pos;
-    cc_int32    code;
-
-    if ( creds == NULL || flat == NULL || len == NULL )
-        return ccErrBadParam;
-
-    header = (ccmsg_creds_v4_t *)malloc(sizeof(ccmsg_creds_v4_t));
-    if ( header == NULL )
-        return ccErrNoMem;
-
-    code = cci_msg_new(ccmsg_CREDS_V4, &msg);
-
-    code = cci_msg_add_header(msg, header, sizeof(ccmsg_creds_v4_t));
-
-    code = cci_msg_add_data_blob(msg, creds, sizeof(cc_credentials_v4_t), &blob_pos);
-
-    header->offset = blob_pos;
-    header->len    = sizeof(cc_credentials_v4_t);
-
-    code = cci_msg_flatten( msg, NULL );
-
-    *flat = msg->flat;
-    *len  = msg->flat_len;
-    msg->flat = NULL;
-    msg->flat_len = 0;
-
-    cci_msg_destroy(msg);
-
-    return ccNoError;
-}
-
-cc_int32
-cci_creds_v4_unmarshall( char * flat, 
-                         cc_uint32 len,
-                         cc_credentials_union * creds)
-{
-    cc_msg_t * msg; 
-    ccmsg_creds_v4_t * header;
-    cc_int32   code;
-
-    if ( flat == NULL || len == 0 || creds == NULL )
-        return ccErrBadParam;
-
-    code = cci_msg_unflatten( flat, len, &msg );
-
-    header = (ccmsg_creds_v4_t *)msg->header;
-
-    creds->version = cc_credentials_v4;
-    code = cci_msg_retrieve_blob(msg, header->offset, header->len, &creds->credentials.credentials_v4);
-
-    cci_msg_destroy(msg);
-
-    return ccNoError;
-}
-
-
-cc_int32
-cci_creds_cc_data_array_count_entries( cc_data ** array, cc_uint32 * pcount)
-{
-    cc_uint32 count;
-
-    if (array == NULL) {
-        *pcount = 0;
-        return ccNoError;
-    }
-
-    for ( count=0; array[count] != NULL ; count++) ;
-
-    *pcount = count;
-    return ccNoError;
-}
-
-cc_int32
-cci_creds_v5_compute_flat_size( cc_credentials_v5_t * creds, cc_uint32 * plen)
-{
-    cc_uint32 len;
-    cc_uint32 i, count;
-
-    len = sizeof(struct cci_flat_creds_v5);
-
-    if (creds->client)
-        len += strlen(creds->client) + 1;
-
-    if (creds->server)
-        len += strlen(creds->server) + 1;
-
-    len += creds->keyblock.length;
-
-    cci_creds_cc_data_array_count_entries( creds->addresses, &count );
-    len += count * sizeof(cc_flat_data);
-    for ( i=0; i<count; i++ ) {
-        len += creds->addresses[i]->length;
-    }
-
-    len += creds->ticket.length;
-    len += creds->second_ticket.length;
-
-    cci_creds_cc_data_array_count_entries( creds->authdata, &count );
-    len += count * sizeof(cc_flat_data);
-    for ( i=0; i<count; i++ ) {
-        len += creds->authdata[i]->length;
-    }
-
-    *plen = len;
-    return ccNoError;
-}
-
-cc_int32
-cci_creds_v5_marshall( cc_credentials_v5_t * creds, 
-                       char ** pflat, 
-                       cc_uint32 * plen)
-{
-    cc_uint32 len;
-    char * flat;
-    struct cci_flat_creds_v5 * header;
-    cc_uint32 offset;
-    cc_uint32 i;
-
-    if ( creds == NULL || pflat == NULL || plen == NULL )
-        return ccErrBadParam;
-
-    cci_creds_v5_compute_flat_size(creds, &len);
-
-    flat = (char *)malloc(len);
-    if ( flat == NULL )
-        return ccErrNoMem;
-    memset(flat, 0, len);
-
-    offset = sizeof(struct cci_flat_creds_v5);
-    header = (struct cci_flat_creds_v5 *)flat;
-    header->version = FLAT_CREDS_V5_VERSION;
-    if (creds->client) {
-        header->client.length = strlen(creds->client) + 1;
-        header->client.data = offset;
-        memcpy(flat + offset, creds->client, header->client.length);
-        offset += header->client.length;
-    }
-
-    if (creds->server) {
-        header->server.length = strlen(creds->server) + 1;
-        header->server.data = offset;
-        memcpy(flat + offset, creds->server, header->server.length);
-        offset += header->server.length;
-    }
-
-    header->keyblock.type = creds->keyblock.type;
-    if (creds->keyblock.length) {
-        header->keyblock.length = creds->keyblock.length;
-        header->keyblock.data = offset;
-        memcpy(flat + offset, creds->keyblock.data, header->keyblock.length);
-        offset += header->keyblock.length;
-    }           
-
-    header->authtime = creds->authtime;
-    header->starttime = creds->starttime;
-    header->endtime = creds->endtime;
-    header->renew_till = creds->renew_till;
-    header->is_skey = creds->is_skey;
-    header->ticket_flags = creds->ticket_flags;
-
-    cci_creds_cc_data_array_count_entries( creds->addresses, &header->address_count );
-    if ( header->address_count ) {
-        cc_flat_data * addresses = (cc_flat_data *)flat + offset;
-        header->addresses = offset;
-        offset += header->address_count * sizeof(cc_flat_data);
-
-        for ( i=0; i<header->address_count; i++ ) {
-            addresses[i].type = creds->addresses[i]->type;
-            if (creds->addresses[i]->length) {
-                addresses[i].length = creds->addresses[i]->length;
-                addresses[i].data = offset;
-                memcpy(flat + offset, creds->addresses[i]->data, addresses[i].length);
-                offset += addresses[i].length;
-            }
-        }
-    }
-
-    header->ticket.type = creds->ticket.type;
-    if (creds->ticket.length) {
-        header->ticket.length = creds->ticket.length;
-        header->ticket.data = offset;
-        memcpy(flat + offset, creds->ticket.data, header->ticket.length);
-        offset += header->ticket.length;
-    }           
-
-    header->second_ticket.type = creds->second_ticket.type;
-    if (creds->second_ticket.length) {
-        header->second_ticket.length = creds->second_ticket.length;
-        header->second_ticket.data = offset;
-        memcpy(flat + offset, creds->second_ticket.data, header->second_ticket.length);
-        offset += header->second_ticket.length;
-    }           
-
-    cci_creds_cc_data_array_count_entries( creds->authdata, &header->authdata_count );
-    if ( header->authdata_count ) {
-        cc_flat_data * authdata = (cc_flat_data *)flat + offset;
-        header->authdata = offset;
-        offset += header->authdata_count * sizeof(cc_flat_data);
-
-        for ( i=0; i<header->authdata_count; i++ ) {
-            authdata[i].type = creds->authdata[i]->type;
-            if (creds->authdata[i]->length) {
-                authdata[i].length = creds->authdata[i]->length;
-                authdata[i].data = offset;
-                memcpy(flat + offset, creds->authdata[i]->data, authdata[i].length);
-                offset += authdata[i].length;
-            }
-        }
-    }
-
-    *pflat = flat;
-    *plen = len;
-    return ccNoError;
-}
-
-
-// TODO: a much better job of checking for out of memory errors
-//       and validating that we do not read beyond the flat input
-//       data buffer
-
-cc_int32
-cci_creds_v5_unmarshall( char * flat, 
-                         cc_uint32 len,
-                         cc_credentials_union * creds_union)
-{
-    struct cci_flat_creds_v5 * header;
-    cc_credentials_v5_t * creds;
-    cc_flat_data * flat_data;
-    cc_uint32  i;
-    cc_int32   code;
-
-    if ( flat == NULL || len == 0 || creds_union == NULL )
-        return ccErrBadParam;
-
-    creds_union->version = cc_credentials_v5;
-
-    header = (struct cci_flat_creds_v5 *)flat;
-
-    if ( header->version != FLAT_CREDS_V5_VERSION )
-        return ccErrBadParam;
-
-    creds = (cc_credentials_v5_t *)malloc(sizeof(cc_credentials_v5_t));
-    if ( creds == NULL )
-        return ccErrNoMem;
-    memset(creds, 0, sizeof(ccmsg_creds_v5_t));
-
-    if ( header->client.length ) {
-        creds->client = (char *)malloc(header->client.length);
-        memcpy(creds->client, flat + header->client.data, header->client.length);
-    }
-
-    if ( header->server.length ) {
-        creds->server = (char *)malloc(header->server.length);
-        memcpy(creds->server, flat + header->server.data, header->server.length);
-    }
-
-    creds->keyblock.type = header->keyblock.type;
-    if ( header->keyblock.length ) {
-        creds->keyblock.length = header->keyblock.length;
-        creds->keyblock.data = malloc(creds->keyblock.length);
-        memcpy(creds->keyblock.data, flat + header->keyblock.data, creds->keyblock.length);
-    }
-
-    creds->authtime = header->authtime;
-    creds->starttime = header->starttime;
-    creds->endtime = header->endtime;
-    creds->renew_till = header->renew_till;
-    creds->is_skey = header->is_skey;
-    creds->ticket_flags = header->ticket_flags;
-
-    creds->addresses = (cc_data **) malloc((header->address_count + 1) * sizeof(cc_data *));
-    flat_data = (cc_flat_data *)flat + header->addresses;
-    for ( i=0 ; i < header->address_count ; i++ ) {
-        creds->addresses[i] = (cc_data *)malloc(sizeof(cc_data));
-        creds->addresses[i]->type = flat_data[i].type;
-        creds->addresses[i]->length = flat_data[i].length;
-        if ( flat_data[i].length ) {
-            creds->addresses[i]->data = malloc(flat_data[i].length);
-            memcpy(creds->addresses[i]->data, flat + flat_data[i].data, flat_data[i].length);
-        } else {
-            creds->addresses[i]->data = NULL;
-        }
-    }
-    creds->addresses[i] = NULL;
-
-    creds->ticket.type = header->ticket.type;
-    if ( header->ticket.length ) {
-        creds->ticket.length = header->ticket.length;
-        creds->ticket.data = malloc(creds->ticket.length);
-        memcpy(creds->ticket.data, flat + header->ticket.data, creds->ticket.length);
-    }
-
-    creds->second_ticket.type = header->second_ticket.type;
-    if ( header->second_ticket.length ) {
-        creds->second_ticket.length = header->second_ticket.length;
-        creds->second_ticket.data = malloc(creds->second_ticket.length);
-        memcpy(creds->second_ticket.data, flat + header->second_ticket.data, creds->second_ticket.length);
-    }
-
-    creds->authdata = (cc_data **) malloc((header->authdata_count + 1) * sizeof(cc_data *));
-    flat_data = (cc_flat_data *)flat + header->authdata;
-    for ( i=0 ; i < header->authdata_count ; i++ ) {
-        creds->authdata[i] = (cc_data *)malloc(sizeof(cc_data));
-        creds->authdata[i]->type = flat_data[i].type;
-        creds->authdata[i]->length = flat_data[i].length;
-        if ( flat_data[i].length ) {
-            creds->authdata[i]->data = malloc(flat_data[i].length);
-            memcpy(creds->authdata[i]->data, flat + flat_data[i].data, flat_data[i].length);
-        } else {
-            creds->authdata[i]->data = NULL;
-        }
-    }
-    creds->authdata[i] = NULL;
-
-    creds_union->credentials.credentials_v5 = creds;
-
-    return ccNoError;
-}
-
index 671b6905f24961f5b5ab2372a5db79d55791e360..564097c5344d01f4e8274ca459b2f76d1f3a393d 100644 (file)
@@ -1,30 +1,21 @@
-# Makefile for the CCAPI Generic Server
+# Makefile for the CCAPI Server Library
 
 !INCLUDE <WIN32.MAK>
 
-CFLAGS = -I../include
+CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)
 
-CCAPI_LIB = ../lib/ccapi.lib
-WINLIBS = user32.lib advapi32.lib
-CCSOBJS = context.obj ccache.obj lists.obj rpc_auth.obj serv_ops.obj
+CC_SERVER_OBJS = ccs_context.obj ccs_ccache.obj ccs_lists.obj rpc_auth.obj serv_ops.obj
 
-all: t_lists.exe t_msg.exe t_ccache.exe t_context.exe ccapi_server.exe
+CC_SERVER_LIB = cc_server.lib
 
-t_lists.exe: t_lists.obj $(CCSOBJS) $(CCAPI_LIB)
-        link -out:$@ t_lists.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS)
+CC_COMMON_LIB = ../common/cc_common.lib
 
-t_msg.exe: t_msg.obj $(CCSOBJS) $(CCAPI_LIB)
-        link -out:$@ t_msg.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS)
+$(CC_SERVER_LIB): $(CC_SERVER_OBJS)
+        $(implib) /NOLOGO /OUT:$@ $**
 
-t_ccache.exe: t_ccache.obj $(CCSOBJS) $(CCAPI_LIB)
-        link -out:$@ t_ccache.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS)
-
-t_context.exe: t_context.obj $(CCSOBJS) $(CCAPI_LIB)
-        link -out:$@ t_context.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS)
-
-ccapi_server.exe: main.obj $(CCSOBJS) $(CCAPI_LIB)
-        link -out:$@ main.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS)
+all: $(CC_SERVER_LIB)
 
 clean: 
-       del *.obj *.exe
+       del *.obj *.lib
 
\ No newline at end of file
similarity index 83%
rename from src/lib/ccapi/server/ccache.c
rename to src/lib/ccapi/server/ccs_ccache.c
index 2c3a745afef010c9d131866ba88beb85203eda14..d632ee349413280d3aa45ddbb4f7eded3a4e5a9e 100644 (file)
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-/*
- * Manages ccache objects.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-/**
- * ccache_new()
- * 
- * Purpose: Allocate and initialize new credentials cache for the specified principal
- *          and version
- * 
- * Return:  ccNoError - success
- *          ccErrInvalidString - name or principal is NULL
- *          ccErrBadCredentialsVersion - unsupported creds type
- *          ccErrBadParam - outCcachepp is NULL
- *          ccErrNoMem - malloc failed
- */
-cc_int32
-cci_ccache_new( char *name, char *principal, int cred_vers, 
-                cc_server_ccache_t** outCCachepp)
-{
-    cc_server_ccache_t* ccache;
-
-    if (name == NULL || principal == NULL)
-        return ccErrInvalidString;
-
-    if (cred_vers != cc_credentials_v4 && cred_vers != cc_credentials_v5 && 
-         cred_vers != cc_credentials_v4_v5)
-        return ccErrBadCredentialsVersion;
-
-    if (outCCachepp == NULL)
-        return ccErrBadParam;
-
-    ccache = (cc_server_ccache_t*)malloc(sizeof(cc_server_ccache_t));
-    if (ccache == NULL)
-        return ccErrNoMem;
-
-    ccache->name = name;
-    ccache->principal_v4 = NULL;
-    ccache->principal_v5 = NULL;
-    ccache->changed = time(NULL);
-    ccache->kdc_offset = 0;
-    ccache->last_default = 0;
-    cci_generic_list_new(&ccache->active_iterators);
-    cci_credentials_list_new(&ccache->creds);
-    ccache->is_default = 0;
-    ccache->kdc_set = 0;
-    ccache->versions = cred_vers;
-    ccache->mycontext = NULL;
-
-    cci_ccache_set_principal(ccache, cred_vers, principal);
-    *outCCachepp = ccache;
-    return ccNoError;
-}
-
-/**
- * cci_ccache_check_version()
- * 
- * Purpose: Check to see if the ccache and the creds have compatible versions. 
- * 
- * Return:  ccNoError and compat = 1 if they are compatible 
- *          ccNoError and compat = 0 if they are not compatible
- * 
- * Errors:  ccErrInvalidCCache - ccache is NULL
- *          ccErrBadParam - either creds or compat are NULL
- */
-cc_int32 
-cci_ccache_check_version( const cc_server_ccache_t *ccache,
-                          const cc_credentials_union* creds,
-                          cc_uint32* compat)
-{
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    if (creds == NULL || compat == NULL)
-        return ccErrBadParam;
-
-    if (ccache->versions == cc_credentials_v4_v5)
-        *compat = 1;
-    else if (ccache->versions == creds->version)
-        *compat = 1;
-    else
-        *compat = 0;
-
-    return ccNoError;
-}
-
-/** 
-cci_ccache_check_principal()
-
-Check to see if the client principal from the credentials matches
-the principal associated with the cache.
-
-* Return:  ccNoError and compat = 1 if they are compatible 
-*          ccNoError and compat = 0 if they are not compatible
-* 
-* Errors:  ccErrInvalidCCache - ccache is NULL
-*          ccErrBadParam - either creds or compat are NULL
-*          ccErrBadCredentialVersion - unsupported credential type
-*/
-cc_int32 
-cci_ccache_check_principal( const cc_server_ccache_t *ccache,
-                            const cc_credentials_union* creds,
-                            cc_uint32* compat)
-{
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    if (creds == NULL || compat == NULL)
-        return ccErrBadParam;
-
-    if (creds->version == cc_credentials_v4) {
-        if (strcmp(creds->credentials.credentials_v4->principal, ccache->principal_v4) == 0) 
-            *compat = 1;
-        else 
-            *compat = 0;
-    } else if (creds->version == cc_credentials_v5) {
-        if (strcmp(creds->credentials.credentials_v5->client, ccache->principal_v5) == 0)
-            *compat = 1;
-        else 
-            *compat = 0;
-    } else {        
-        return ccErrBadCredentialsVersion;
-    }
-    return ccNoError;
-}
-
-
-/** 
- * cci_ccache_store_creds()
- *
- * Purpose: Stores the provided credentials into the provided cache.  Validates the
- *          ability of the cache to store credentials of the given version and client
- *          principal.
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors: ccErrNoMem
- *         ccErrBadCredentialsVersion
- *         ccErrBadInvalidCredentials
- *         ccErrInvalidCache
- *         ccErrBadParam
- */
-cc_int32 
-cci_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) 
-{
-    cc_server_credentials_t* stored_cred=NULL;
-    cc_uint32 valid_version, valid_principal;
-    cc_int32 code;
-
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-    
-    if (credentials == NULL)
-        return ccErrBadParam;
-
-    code = cci_ccache_check_version(ccache, credentials, &valid_version);
-    if (code != ccNoError) {
-        /* pass error on to caller */
-        goto bad;
-    }
-    code = cci_ccache_check_principal(ccache, credentials, &valid_principal);
-    if (code != ccNoError) {
-        /* pass error on to caller */
-        goto bad;
-    }
-    if (valid_version && valid_principal) {
-        stored_cred = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));
-        if (stored_cred == NULL) {
-            code = ccErrNoMem;
-            goto bad;
-        }
-        memcpy(&stored_cred->creds, credentials, sizeof(cc_credentials_union));
-
-        if (credentials->version == cc_credentials_v4) {
-            stored_cred->creds.credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
-            if (stored_cred->creds.credentials.credentials_v4 == NULL) {
-                code = ccErrNoMem;
-                goto bad;
-            }
-
-            memcpy(stored_cred->creds.credentials.credentials_v4, credentials->credentials.credentials_v4, sizeof(cc_credentials_v4_t));
-        } else if (credentials->version == cc_credentials_v5) {
-            stored_cred->creds.credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));
-            if (stored_cred->creds.credentials.credentials_v5 == NULL) {
-                code = ccErrNoMem;
-                goto bad;
-            }
-
-            memcpy(stored_cred->creds.credentials.credentials_v5, credentials->credentials.credentials_v5, sizeof(cc_credentials_v5_t));
-        } else {
-            code = ccErrBadCredentialsVersion;
-            goto bad;
-        }
-
-        code = cci_credentials_list_append(ccache->creds, stored_cred, NULL);
-        if ( code != ccNoError ) {
-            /* pass error on to caller */
-            goto bad;
-        }
-        if (ccache->creds->head->data == (cc_uint8 *)stored_cred) 
-            stored_cred->is_default = 1; /*we're first on the list, so we're default*/
-
-        cci_ccache_changed(ccache);
-        return ccNoError;
-    } else {
-#ifdef DEBUG
-        printf("vers: %d\tprincipal: %d\n",
-                valid_version, valid_principal);
-#endif /* DEBUG */
-        code = ccErrInvalidCredentials;
-        goto bad;
-    }
-
-  bad:
-    if (stored_cred)
-        free(stored_cred);
-    return code;      /* error */
-}
-
-/**
- * cci_ccache_changed()
- *
- * Purpose: Updates the last update time for the ccache and its associated context.
- *          Provides a location from which interested parties should be notified
- *          of cache updates.
- *
- * Return:  none
- *
- * Errors:  none
- */
-void 
-cci_ccache_changed(cc_server_ccache_t* ccache) 
-{
-    ccache->changed = time(NULL);
-    if (ccache->mycontext != NULL)
-        ccache->mycontext->changed = time(NULL);
-
-    /* XXX - notify registered listeners when implemented */
-}
-
-/**
- * cci_ccache_rem_creds()
- *
- * Purpose: Removes the specified credential object from the specified cache if
- *          it exists
- *
- * Return:  0 on success (credential is not in the cache)
- *         -1 on error
- *
- * Errors: ccErrBadParam, ccErrNoMem (from cc_credentials_list_iterator)
- *
- * Verify: does the memory associated with stored_cred->creds need to be freed?
- *
- */
-cc_int32 
-cci_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) 
-{
-    cc_credentials_iterate_t* credentials_iterator=NULL, *active;
-    cc_generic_iterate_t* generic_iterator=NULL;
-    cc_credentials_list_node_t* credentials_node;
-    cc_generic_list_node_t* generic_node;
-    cc_server_credentials_t* stored_cred;
-    cc_int8 changed = 0;
-    cc_int32 code = 0;
-
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    if (credentials == NULL)
-        return ccErrBadParam;
-
-    code = cci_credentials_list_iterator(ccache->creds, &credentials_iterator);
-    if (code != ccNoError) {
-        /* pass error to caller */
-        goto cleanup;
-    }
-
-    while (cci_credentials_iterate_has_next(credentials_iterator)) {
-        code = cci_credentials_iterate_next(credentials_iterator, &credentials_node);
-        stored_cred = (cc_server_credentials_t*)credentials_node->data;
-        if (memcmp(&stored_cred->creds,credentials,sizeof(cc_credentials_union)) == 0) {
-            /* XXX - do we need to free(stored_cred->creds) ? */
-            free(credentials_node->data);
-            changed = 1;
-               
-            /*If any iterator's next points to the deleted node, make it point to the next node*/
-            code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);
-            while (cci_generic_iterate_has_next(generic_iterator)) {
-                code = cci_generic_iterate_next(generic_iterator, &generic_node);                      
-                active = (cc_credentials_iterate_t*)generic_node->data;
-                if (active->next == credentials_node) 
-                    active->next = active->next->next;
-            }
-            code = cci_generic_free_iterator(generic_iterator);
-            generic_iterator = NULL;
-
-            if (credentials_node == ccache->creds->head) { /*removing the default, must make next cred default*/
-                code = cci_credentials_list_remove_element(ccache->creds, credentials_node);
-
-                if (ccache->creds->head != NULL)
-                    ((cc_server_credentials_t*)ccache->creds->head->data)->is_default = 1;
-            } else {
-                code = cci_credentials_list_remove_element(ccache->creds, credentials_node);
-            }
-            break;
-        }
-    }
-
-  cleanup:
-    if (changed)
-        cci_ccache_changed(ccache);
-    if (credentials_iterator)
-        cci_credentials_free_iterator(credentials_iterator);
-    if (generic_iterator)
-        cci_generic_free_iterator(generic_iterator);
-    return code;
-}
-
-/**
- * cci_ccache_move()
- * 
- * Purpose: Destroys the existing contents of the destination and copies
- *          all credentials from the source to the destination
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors:  ccBadNoMem
- *
- */
-
-cc_int32 
-cci_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination) 
-{
-    cc_generic_list_node_t* node;
-    cc_generic_iterate_t* iterator;
-    cc_credentials_iterate_t* cur;
-    cc_int32 code;
-
-    if (source == NULL || destination == NULL)
-        return ccErrBadParam;
-       
-    code = cci_credentials_list_destroy(destination->creds);
-    if ( code != ccNoError )
-        return code;
-
-    code = cci_credentials_list_copy(source->creds, &destination->creds);
-    if ( code != ccNoError ) 
-        return code;
-
-    destination->versions = source->versions;
-    destination->kdc_offset = source->kdc_offset;
-    destination->last_default = 0;
-
-    /*reset all active iterators to point to the head of the new creds list*/
-    if (destination->active_iterators->head != NULL) {
-        code = cci_generic_list_iterator(destination->active_iterators, &iterator);
-        while (cci_generic_iterate_has_next(iterator)) {
-            code = cci_generic_iterate_next(iterator, &node);
-            cur = (cc_credentials_iterate_t*)node->data;
-            cur->next = destination->creds->head;
-        }
-        code = cci_generic_free_iterator(iterator);
-    }
-
-    cci_ccache_changed(destination);
-    return code;
-}
-
-/**
- * cci_ccache_get_kdc_time_offset()
- * 
- * Purpose: Retrieves the kdc_time_offset from the ccache if set
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors:  ccErrBadParam, ccErrTimeOffsetNotSet
- *
- */
-cc_int32 
-cci_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time_t* offset) 
-{
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-    
-    if (offset == NULL)
-        return ccErrBadParam;
-
-    if (!ccache->kdc_set)
-        return ccErrTimeOffsetNotSet;
-
-    *offset = ccache->kdc_offset;
-    return ccNoError;
-}
-
-/**
- * cci_ccache_set_kdc_time_offset()
- *
- * Purpose: Sets the kdc time offset in the designated ccache
- * 
- * Return:  0 on success
- *         -1 on error
- * 
- * Errors: ccErrBadParam
- *
- */
-cc_int32 
-cci_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time_t offset) 
-{
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    ccache->kdc_offset = offset;
-    ccache->kdc_set = 1;
-    cci_ccache_changed(ccache);
-
-    return ccNoError;
-}
-
-/**
- * cci_ccache_clear_kdc_time_offset()
- *
- * Purpose: Clear the kdc time offset in the designated ccache
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors: ccErrBadParam
- */
-cc_int32 
-cci_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache) 
-{
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    ccache->kdc_offset = 0;
-    ccache->kdc_set = 0;
-    cci_ccache_changed(ccache);
-
-    return ccNoError;
-}
-
-/**
- * cci_ccache_new_iterator()
- *
- * Purpose: Retrieve an iterator for the designated cache
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors: ccErrBadParam, ccBadNoMem
- */
-cc_int32 
-cci_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator)
-{
-    cc_int32 code;
-
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-
-    if (iterator == NULL)
-        return ccErrBadParam;
-
-    code = cci_credentials_list_iterator(ccache->creds, iterator);
-    if (code != ccNoError)
-        return code;
-
-    code = cci_generic_list_prepend(ccache->active_iterators, *iterator, sizeof(cc_credentials_iterate_t), NULL);
-    if (code != ccNoError)
-        return code;
-
-    return ccNoError;
-}
-
-/**
- * cci_ccache_get_principal()
- * 
- * Purpose: Retrieves the client principal associated with the designated cache.
- *          The value is returned 
- * Return:
- *
- * Errors:
- */
-cc_int32 
-cci_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal) 
-{
-    char *p = NULL;
-    
-    switch ( version ) {
-    case cc_credentials_v4:
-        p = ccache->principal_v4;
-        break;
-    case cc_credentials_v5:
-        p = ccache->principal_v5;
-        break;
-    default:
-        return ccErrBadCredentialsVersion;
-    }
-
-    *principal = (char *)malloc(strlen(p)+1);
-    if ( *principal == NULL )
-        return ccErrNoMem;
-
-    strcpy(*principal, p);
-    return ccNoError;
-}
-
-/**
- * Purpose: Releases the memory associated with a ccache principal
- * 
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_ccache_free_principal(char * principal)
-{
-    if ( principal == NULL )
-        return ccErrBadParam;
-
-    free(principal);
-    return ccNoError;
-}
-
-/**
- * ccache_set_principal()
- *
- * Purpose: Assigns a principal to the designated ccache and credential version.
- *          If the api version is 2, the cache is cleared of all existing
- *          credentials.
- *
- * Return:  0 on success
- *         -1 on error
- *
- * Errors: ccErrNoMem, ccErrBadCredentialsVersion
- */
-cc_int32 
-cci_ccache_set_principal( cc_server_ccache_t* ccache, cc_int32 cred_version, 
-                          char* principal)
-{
-    cc_generic_iterate_t* generic_iterator;
-    cc_generic_list_node_t* generic_node;
-    cc_ccache_iterate_t* ccache_iterator;
-    cc_int32 code = ccNoError;
-
-    if (ccache == NULL)
-        return ccErrInvalidCCache;
-    
-    if (principal == NULL)
-        return ccErrInvalidString;
-
-    switch (cred_version) {
-    case cc_credentials_v4:
-    case cc_credentials_v4_v5:
-        ccache->principal_v4 = (char *)malloc(strlen(principal) + 1);
-        if (ccache->principal_v4 == NULL)
-            return ccErrNoMem;
-        strcpy(ccache->principal_v4, principal);
-        if (cred_version != cc_credentials_v4_v5)
-            break;
-        /* fall-through if we are v4_v5 */
-    case cc_credentials_v5:
-        ccache->principal_v5 = (char *)malloc(strlen(principal) + 1);
-        if (ccache->principal_v5 == NULL) {
-            if (cred_version == cc_credentials_v4_v5) {
-                free(ccache->principal_v4);
-                ccache->principal_v4 = NULL;
-            }
-            return ccErrNoMem;
-        }
-        strcpy(ccache->principal_v5, principal);
-        break;
-    default:
-        return ccErrBadCredentialsVersion;
-    }
-
-    /*For API version 2 clients set_principal implies a flush of all creds*/
-    if (ccache->mycontext != NULL && ccache->mycontext->api_version == ccapi_version_2) {
-        cci_credentials_list_destroy(ccache->creds);
-        cci_credentials_list_new(&ccache->creds);
-
-        /*clean up active_iterators*/
-        code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);
-        if (code == ccNoError) {
-            while (cci_generic_iterate_has_next(generic_iterator)) {
-                code = cci_generic_iterate_next(generic_iterator, &generic_node);
-                ccache_iterator = (cc_ccache_iterate_t*)generic_node->data;
-                ccache_iterator->next = NULL;
-            }
-        }
-    }
-
-    cci_ccache_changed(ccache);
-
-    return code;
-}
-
-/**
- * cci_ccache_destroy()
- *
- * Purpose: Destroys an existing ccache 
- *
- * Return:  0 on success
- *         -1 on errors
- *
- * Errors:  ccErrBadParam
- */
-cc_int32 
-cci_ccache_destroy(cc_server_ccache_t* ccache) 
-{
-    cc_int32 code;
-
-    if ( ccache == NULL )
-        return ccErrInvalidCCache;
-
-    code = cci_generic_list_destroy(ccache->active_iterators);
-    code = cci_credentials_list_destroy(ccache->creds);
-
-    if (ccache->mycontext != NULL)
-        code = cci_context_rem_ccache(ccache->mycontext, ccache);
-
-    return code;
-}
-
-/**
- * cci_ccache_compare()
- *
- * Purpose: Returns a boolean value indicating if two caches are identical
- *          Implemented as pointer equivalence.
- *
- * Return:  1 if TRUE
- *          0 if FALSE
- *
- * Errors:  No errors
- */
-cc_int32 
-cci_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result) 
-{
-    if ( ccache1 == NULL || ccache2 == NULL )
-        return ccErrInvalidCCache;
-
-    if (ccache1 == ccache2)
-        *result = 1;
-    else 
-        *result = 0;
-
-    return ccNoError;
-}
-
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+/*\r
+ * Manages ccache objects.\r
+ *\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <time.h>\r
+#include "CredentialsCache.h"\r
+#include "datastore.h"\r
+\r
+/**\r
+ * ccache_new()\r
+ * \r
+ * Purpose: Allocate and initialize new credentials cache for the specified principal\r
+ *          and version\r
+ * \r
+ * Return:  ccNoError - success\r
+ *          ccErrInvalidString - name or principal is NULL\r
+ *          ccErrBadCredentialsVersion - unsupported creds type\r
+ *          ccErrBadParam - outCcachepp is NULL\r
+ *          ccErrNoMem - malloc failed\r
+ */\r
+cc_int32\r
+ccs_ccache_new( char *name, char *principal, int cred_vers, \r
+                cc_server_ccache_t** outCCachepp)\r
+{\r
+    cc_server_ccache_t* ccache;\r
+\r
+    if (name == NULL || principal == NULL)\r
+        return ccErrInvalidString;\r
+\r
+    if (cred_vers != cc_credentials_v4 && cred_vers != cc_credentials_v5 && \r
+         cred_vers != cc_credentials_v4_v5)\r
+        return ccErrBadCredentialsVersion;\r
+\r
+    if (outCCachepp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    ccache = (cc_server_ccache_t*)malloc(sizeof(cc_server_ccache_t));\r
+    if (ccache == NULL)\r
+        return ccErrNoMem;\r
+\r
+    ccache->name = name;\r
+    ccache->principal_v4 = NULL;\r
+    ccache->principal_v5 = NULL;\r
+    ccache->changed = time(NULL);\r
+    ccache->kdc_offset = 0;\r
+    ccache->last_default = 0;\r
+    cci_generic_list_new(&ccache->active_iterators);\r
+    ccs_credentials_list_new(&ccache->creds);\r
+    ccache->is_default = 0;\r
+    ccache->kdc_set = 0;\r
+    ccache->versions = cred_vers;\r
+    ccache->mycontext = NULL;\r
+\r
+    ccs_ccache_set_principal(ccache, cred_vers, principal);\r
+    *outCCachepp = ccache;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_check_version()\r
+ * \r
+ * Purpose: Check to see if the ccache and the creds have compatible versions. \r
+ * \r
+ * Return:  ccNoError and compat = 1 if they are compatible \r
+ *          ccNoError and compat = 0 if they are not compatible\r
+ * \r
+ * Errors:  ccErrInvalidCCache - ccache is NULL\r
+ *          ccErrBadParam - either creds or compat are NULL\r
+ */\r
+cc_int32 \r
+ccs_ccache_check_version( const cc_server_ccache_t *ccache,\r
+                          const cc_credentials_union* creds,\r
+                          cc_uint32* compat)\r
+{\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    if (creds == NULL || compat == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (ccache->versions == cc_credentials_v4_v5)\r
+        *compat = 1;\r
+    else if (ccache->versions == creds->version)\r
+        *compat = 1;\r
+    else\r
+        *compat = 0;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/** \r
+ccs_ccache_check_principal()\r
+\r
+Check to see if the client principal from the credentials matches\r
+the principal associated with the cache.\r
+\r
+* Return:  ccNoError and compat = 1 if they are compatible \r
+*          ccNoError and compat = 0 if they are not compatible\r
+* \r
+* Errors:  ccErrInvalidCCache - ccache is NULL\r
+*          ccErrBadParam - either creds or compat are NULL\r
+*          ccErrBadCredentialVersion - unsupported credential type\r
+*/\r
+cc_int32 \r
+ccs_ccache_check_principal( const cc_server_ccache_t *ccache,\r
+                            const cc_credentials_union* creds,\r
+                            cc_uint32* compat)\r
+{\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    if (creds == NULL || compat == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (creds->version == cc_credentials_v4) {\r
+        if (strcmp(creds->credentials.credentials_v4->principal, ccache->principal_v4) == 0) \r
+            *compat = 1;\r
+        else \r
+            *compat = 0;\r
+    } else if (creds->version == cc_credentials_v5) {\r
+        if (strcmp(creds->credentials.credentials_v5->client, ccache->principal_v5) == 0)\r
+            *compat = 1;\r
+        else \r
+            *compat = 0;\r
+    } else {        \r
+        return ccErrBadCredentialsVersion;\r
+    }\r
+    return ccNoError;\r
+}\r
+\r
+\r
+/** \r
+ * ccs_ccache_store_creds()\r
+ *\r
+ * Purpose: Stores the provided credentials into the provided cache.  Validates the\r
+ *          ability of the cache to store credentials of the given version and client\r
+ *          principal.\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors: ccErrNoMem\r
+ *         ccErrBadCredentialsVersion\r
+ *         ccErrBadInvalidCredentials\r
+ *         ccErrInvalidCache\r
+ *         ccErrBadParam\r
+ */\r
+cc_int32 \r
+ccs_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) \r
+{\r
+    cc_server_credentials_t* stored_cred=NULL;\r
+    cc_uint32 valid_version, valid_principal;\r
+    cc_int32 code;\r
+\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+    \r
+    if (credentials == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = ccs_ccache_check_version(ccache, credentials, &valid_version);\r
+    if (code != ccNoError) {\r
+        /* pass error on to caller */\r
+        goto bad;\r
+    }\r
+    code = ccs_ccache_check_principal(ccache, credentials, &valid_principal);\r
+    if (code != ccNoError) {\r
+        /* pass error on to caller */\r
+        goto bad;\r
+    }\r
+    if (valid_version && valid_principal) {\r
+        stored_cred = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));\r
+        if (stored_cred == NULL) {\r
+            code = ccErrNoMem;\r
+            goto bad;\r
+        }\r
+        memcpy(&stored_cred->creds, credentials, sizeof(cc_credentials_union));\r
+\r
+        if (credentials->version == cc_credentials_v4) {\r
+            stored_cred->creds.credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));\r
+            if (stored_cred->creds.credentials.credentials_v4 == NULL) {\r
+                code = ccErrNoMem;\r
+                goto bad;\r
+            }\r
+\r
+            memcpy(stored_cred->creds.credentials.credentials_v4, credentials->credentials.credentials_v4, sizeof(cc_credentials_v4_t));\r
+        } else if (credentials->version == cc_credentials_v5) {\r
+            stored_cred->creds.credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));\r
+            if (stored_cred->creds.credentials.credentials_v5 == NULL) {\r
+                code = ccErrNoMem;\r
+                goto bad;\r
+            }\r
+\r
+            memcpy(stored_cred->creds.credentials.credentials_v5, credentials->credentials.credentials_v5, sizeof(cc_credentials_v5_t));\r
+        } else {\r
+            code = ccErrBadCredentialsVersion;\r
+            goto bad;\r
+        }\r
+\r
+        code = ccs_credentials_list_append(ccache->creds, stored_cred, NULL);\r
+        if ( code != ccNoError ) {\r
+            /* pass error on to caller */\r
+            goto bad;\r
+        }\r
+        if (ccache->creds->head->data == (cc_uint8 *)stored_cred) \r
+            stored_cred->is_default = 1; /*we're first on the list, so we're default*/\r
+\r
+        ccs_ccache_changed(ccache);\r
+        return ccNoError;\r
+    } else {\r
+#ifdef DEBUG\r
+        printf("vers: %d\tprincipal: %d\n",\r
+                valid_version, valid_principal);\r
+#endif /* DEBUG */\r
+        code = ccErrInvalidCredentials;\r
+        goto bad;\r
+    }\r
+\r
+  bad:\r
+    if (stored_cred)\r
+        free(stored_cred);\r
+    return code;      /* error */\r
+}\r
+\r
+/**\r
+ * ccs_ccache_changed()\r
+ *\r
+ * Purpose: Updates the last update time for the ccache and its associated context.\r
+ *          Provides a location from which interested parties should be notified\r
+ *          of cache updates.\r
+ *\r
+ * Return:  none\r
+ *\r
+ * Errors:  none\r
+ */\r
+void \r
+ccs_ccache_changed(cc_server_ccache_t* ccache) \r
+{\r
+    ccache->changed = time(NULL);\r
+    if (ccache->mycontext != NULL)\r
+        ccache->mycontext->changed = time(NULL);\r
+\r
+    /* XXX - notify registered listeners when implemented */\r
+}\r
+\r
+/**\r
+ * ccs_ccache_rem_creds()\r
+ *\r
+ * Purpose: Removes the specified credential object from the specified cache if\r
+ *          it exists\r
+ *\r
+ * Return:  0 on success (credential is not in the cache)\r
+ *         -1 on error\r
+ *\r
+ * Errors: ccErrBadParam, ccErrNoMem (from cc_credentials_list_iterator)\r
+ *\r
+ * Verify: does the memory associated with stored_cred->creds need to be freed?\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) \r
+{\r
+    cc_credentials_iterate_t* credentials_iterator=NULL, *active;\r
+    cc_generic_iterate_t* generic_iterator=NULL;\r
+    cc_credentials_list_node_t* credentials_node;\r
+    cc_generic_list_node_t* generic_node;\r
+    cc_server_credentials_t* stored_cred;\r
+    cc_int8 changed = 0;\r
+    cc_int32 code = 0;\r
+\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    if (credentials == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = ccs_credentials_list_iterator(ccache->creds, &credentials_iterator);\r
+    if (code != ccNoError) {\r
+        /* pass error to caller */\r
+        goto cleanup;\r
+    }\r
+\r
+    while (ccs_credentials_iterate_has_next(credentials_iterator)) {\r
+        code = ccs_credentials_iterate_next(credentials_iterator, &credentials_node);\r
+        stored_cred = (cc_server_credentials_t*)credentials_node->data;\r
+        if (memcmp(&stored_cred->creds,credentials,sizeof(cc_credentials_union)) == 0) {\r
+            /* XXX - do we need to free(stored_cred->creds) ? */\r
+            free(credentials_node->data);\r
+            changed = 1;\r
+               \r
+            /*If any iterator's next points to the deleted node, make it point to the next node*/\r
+            code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);\r
+            while (cci_generic_iterate_has_next(generic_iterator)) {\r
+                code = cci_generic_iterate_next(generic_iterator, &generic_node);                      \r
+                active = (cc_credentials_iterate_t*)generic_node->data;\r
+                if (active->next == credentials_node) \r
+                    active->next = active->next->next;\r
+            }\r
+            code = cci_generic_free_iterator(generic_iterator);\r
+            generic_iterator = NULL;\r
+\r
+            if (credentials_node == ccache->creds->head) { /*removing the default, must make next cred default*/\r
+                code = ccs_credentials_list_remove_element(ccache->creds, credentials_node);\r
+\r
+                if (ccache->creds->head != NULL)\r
+                    ((cc_server_credentials_t*)ccache->creds->head->data)->is_default = 1;\r
+            } else {\r
+                code = ccs_credentials_list_remove_element(ccache->creds, credentials_node);\r
+            }\r
+            break;\r
+        }\r
+    }\r
+\r
+  cleanup:\r
+    if (changed)\r
+        ccs_ccache_changed(ccache);\r
+    if (credentials_iterator)\r
+        ccs_credentials_free_iterator(credentials_iterator);\r
+    if (generic_iterator)\r
+        cci_generic_free_iterator(generic_iterator);\r
+    return code;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_move()\r
+ * \r
+ * Purpose: Destroys the existing contents of the destination and copies\r
+ *          all credentials from the source to the destination\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors:  ccBadNoMem\r
+ *\r
+ */\r
+\r
+cc_int32 \r
+ccs_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination) \r
+{\r
+    cc_generic_list_node_t* node;\r
+    cc_generic_iterate_t* iterator;\r
+    cc_credentials_iterate_t* cur;\r
+    cc_int32 code;\r
+\r
+    if (source == NULL || destination == NULL)\r
+        return ccErrBadParam;\r
+       \r
+    code = ccs_credentials_list_destroy(destination->creds);\r
+    if ( code != ccNoError )\r
+        return code;\r
+\r
+    code = ccs_credentials_list_copy(source->creds, &destination->creds);\r
+    if ( code != ccNoError ) \r
+        return code;\r
+\r
+    destination->versions = source->versions;\r
+    destination->kdc_offset = source->kdc_offset;\r
+    destination->last_default = 0;\r
+\r
+    /*reset all active iterators to point to the head of the new creds list*/\r
+    if (destination->active_iterators->head != NULL) {\r
+        code = cci_generic_list_iterator(destination->active_iterators, &iterator);\r
+        while (cci_generic_iterate_has_next(iterator)) {\r
+            code = cci_generic_iterate_next(iterator, &node);\r
+            cur = (cc_credentials_iterate_t*)node->data;\r
+            cur->next = destination->creds->head;\r
+        }\r
+        code = cci_generic_free_iterator(iterator);\r
+    }\r
+\r
+    ccs_ccache_changed(destination);\r
+    return code;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_get_kdc_time_offset()\r
+ * \r
+ * Purpose: Retrieves the kdc_time_offset from the ccache if set\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors:  ccErrBadParam, ccErrTimeOffsetNotSet\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64* offset) \r
+{\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+    \r
+    if (offset == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (!ccache->kdc_set)\r
+        return ccErrTimeOffsetNotSet;\r
+\r
+    *offset = ccache->kdc_offset;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_set_kdc_time_offset()\r
+ *\r
+ * Purpose: Sets the kdc time offset in the designated ccache\r
+ * \r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ * \r
+ * Errors: ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64 offset) \r
+{\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    ccache->kdc_offset = offset;\r
+    ccache->kdc_set = 1;\r
+    ccs_ccache_changed(ccache);\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_clear_kdc_time_offset()\r
+ *\r
+ * Purpose: Clear the kdc time offset in the designated ccache\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors: ccErrBadParam\r
+ */\r
+cc_int32 \r
+ccs_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache) \r
+{\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    ccache->kdc_offset = 0;\r
+    ccache->kdc_set = 0;\r
+    ccs_ccache_changed(ccache);\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_new_iterator()\r
+ *\r
+ * Purpose: Retrieve an iterator for the designated cache\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors: ccErrBadParam, ccBadNoMem\r
+ */\r
+cc_int32 \r
+ccs_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator)\r
+{\r
+    cc_int32 code;\r
+\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+\r
+    if (iterator == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = ccs_credentials_list_iterator(ccache->creds, iterator);\r
+    if (code != ccNoError)\r
+        return code;\r
+\r
+    code = cci_generic_list_prepend(ccache->active_iterators, *iterator, sizeof(cc_credentials_iterate_t), NULL);\r
+    if (code != ccNoError)\r
+        return code;\r
+\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_get_principal()\r
+ * \r
+ * Purpose: Retrieves the client principal associated with the designated cache.\r
+ *          The value is returned \r
+ * Return:\r
+ *\r
+ * Errors:\r
+ */\r
+cc_int32 \r
+ccs_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal) \r
+{\r
+    char *p = NULL;\r
+    \r
+    switch ( version ) {\r
+    case cc_credentials_v4:\r
+        p = ccache->principal_v4;\r
+        break;\r
+    case cc_credentials_v5:\r
+        p = ccache->principal_v5;\r
+        break;\r
+    default:\r
+        return ccErrBadCredentialsVersion;\r
+    }\r
+\r
+    *principal = (char *)malloc(strlen(p)+1);\r
+    if ( *principal == NULL )\r
+        return ccErrNoMem;\r
+\r
+    strcpy(*principal, p);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * Purpose: Releases the memory associated with a ccache principal\r
+ * \r
+ * Return:\r
+ *\r
+ * Errors:\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_free_principal(char * principal)\r
+{\r
+    if ( principal == NULL )\r
+        return ccErrBadParam;\r
+\r
+    free(principal);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccache_set_principal()\r
+ *\r
+ * Purpose: Assigns a principal to the designated ccache and credential version.\r
+ *          If the api version is 2, the cache is cleared of all existing\r
+ *          credentials.\r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on error\r
+ *\r
+ * Errors: ccErrNoMem, ccErrBadCredentialsVersion\r
+ */\r
+cc_int32 \r
+ccs_ccache_set_principal( cc_server_ccache_t* ccache, cc_int32 cred_version, \r
+                          char* principal)\r
+{\r
+    cc_generic_iterate_t* generic_iterator;\r
+    cc_generic_list_node_t* generic_node;\r
+    cc_ccache_iterate_t* ccache_iterator;\r
+    cc_int32 code = ccNoError;\r
+\r
+    if (ccache == NULL)\r
+        return ccErrInvalidCCache;\r
+    \r
+    if (principal == NULL)\r
+        return ccErrInvalidString;\r
+\r
+    switch (cred_version) {\r
+    case cc_credentials_v4:\r
+    case cc_credentials_v4_v5:\r
+        ccache->principal_v4 = (char *)malloc(strlen(principal) + 1);\r
+        if (ccache->principal_v4 == NULL)\r
+            return ccErrNoMem;\r
+        strcpy(ccache->principal_v4, principal);\r
+        if (cred_version != cc_credentials_v4_v5)\r
+            break;\r
+        /* fall-through if we are v4_v5 */\r
+    case cc_credentials_v5:\r
+        ccache->principal_v5 = (char *)malloc(strlen(principal) + 1);\r
+        if (ccache->principal_v5 == NULL) {\r
+            if (cred_version == cc_credentials_v4_v5) {\r
+                free(ccache->principal_v4);\r
+                ccache->principal_v4 = NULL;\r
+            }\r
+            return ccErrNoMem;\r
+        }\r
+        strcpy(ccache->principal_v5, principal);\r
+        break;\r
+    default:\r
+        return ccErrBadCredentialsVersion;\r
+    }\r
+\r
+    /*For API version 2 clients set_principal implies a flush of all creds*/\r
+    if (ccache->mycontext != NULL && ccache->mycontext->api_version == ccapi_version_2) {\r
+        ccs_credentials_list_destroy(ccache->creds);\r
+        ccs_credentials_list_new(&ccache->creds);\r
+\r
+        /*clean up active_iterators*/\r
+        code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);\r
+        if (code == ccNoError) {\r
+            while (cci_generic_iterate_has_next(generic_iterator)) {\r
+                code = cci_generic_iterate_next(generic_iterator, &generic_node);\r
+                ccache_iterator = (cc_ccache_iterate_t*)generic_node->data;\r
+                ccache_iterator->next = NULL;\r
+            }\r
+        }\r
+    }\r
+\r
+    ccs_ccache_changed(ccache);\r
+\r
+    return code;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_destroy()\r
+ *\r
+ * Purpose: Destroys an existing ccache \r
+ *\r
+ * Return:  0 on success\r
+ *         -1 on errors\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32 \r
+ccs_ccache_destroy(cc_server_ccache_t* ccache) \r
+{\r
+    cc_int32 code;\r
+\r
+    if ( ccache == NULL )\r
+        return ccErrInvalidCCache;\r
+\r
+    code = cci_generic_list_destroy(ccache->active_iterators);\r
+    code = ccs_credentials_list_destroy(ccache->creds);\r
+\r
+    if (ccache->mycontext != NULL)\r
+        code = ccs_context_rem_ccache(ccache->mycontext, ccache);\r
+\r
+    return code;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_compare()\r
+ *\r
+ * Purpose: Returns a boolean value indicating if two caches are identical\r
+ *          Implemented as pointer equivalence.\r
+ *\r
+ * Return:  1 if TRUE\r
+ *          0 if FALSE\r
+ *\r
+ * Errors:  No errors\r
+ */\r
+cc_int32 \r
+ccs_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result) \r
+{\r
+    if ( ccache1 == NULL || ccache2 == NULL )\r
+        return ccErrInvalidCCache;\r
+\r
+    if (ccache1 == ccache2)\r
+        *result = 1;\r
+    else \r
+        *result = 0;\r
+\r
+    return ccNoError;\r
+}\r
+\r
similarity index 76%
rename from src/lib/ccapi/server/context.c
rename to src/lib/ccapi/server/ccs_context.c
index f405a4defbefb792a4c3d80ae9b58fb1f4143c96..a168147940c422dcdaff828f6c327470489fc7db 100644 (file)
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-/*
- * Functions to manipulate datastore layer contexts.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-int cc_myversion = 5;
-char cc_vendor[] = "MIT C lang CCache V5";
-char cc_default_ccache_name[] = "krb5cc";
-
-
-cc_int32
-cci_context_new( int api_version, cc_auth_info_t* auth_info, 
-                 cc_session_info_t* session_info, cc_server_context_t** outContextpp )
-{
-    cc_server_context_t* ctx;
-       
-    if ( outContextpp == NULL )
-        return ccErrBadParam;
-
-       ctx = (cc_server_context_t*)malloc(sizeof(cc_server_context_t));
-    if (ctx == NULL)
-        return ccErrNoMem;
-               
-    cci_ccache_list_new(&ctx->ccaches);
-    cci_generic_list_new(&ctx->active_iterators);      
-    ctx->api_version = api_version;
-    ctx->auth_info = auth_info;
-    ctx->session_info = session_info;
-    ctx->changed = time(NULL);
-
-    *outContextpp = ctx;
-    return ccNoError;
-}
-
-cc_int32
-cci_context_get_default_ccache_name(cc_server_context_t* ctx, char ** outNamepp) 
-{
-    cc_server_ccache_t* default_ccache;
-
-    if (outNamepp == NULL)
-        return ccErrBadParam;
-    
-    if (ctx == NULL)
-        return ccErrInvalidContext;
-
-    if (ctx->ccaches->head != NULL) {
-        default_ccache = (cc_server_ccache_t*)ctx->ccaches->head->data;
-        *outNamepp = default_ccache->name;
-    } else {
-        *outNamepp = cc_default_ccache_name;
-    }
-    return ccNoError;
-}
-
-
-cc_int32
-cci_context_find_ccache( cc_server_context_t* ctx, char *name, 
-                         cc_server_ccache_t** outCcachepp )
-{
-    cc_ccache_iterate_t* ccache_iterator;
-    cc_ccache_list_node_t* ccache_node;
-    cc_server_ccache_t* ccache;
-       cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-    
-    if (name == NULL)
-        return ccErrInvalidString;
-
-    if (outCcachepp == NULL)
-        return ccErrBadParam;
-
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
-        ccache = (cc_server_ccache_t *)ccache_node->data;
-        if (strcmp(ccache->name, name) == 0)  {
-            free(ccache_iterator);
-            *outCcachepp = ccache;
-            return ccNoError;
-        }
-    }
-    free(ccache_iterator);
-    return ccErrCCacheNotFound;
-}       
-
-cc_int32
-cci_context_open_ccache( cc_server_context_t* ctx, char *name, 
-                         cc_server_ccache_t** outCcachepp )
-{
-    return cci_context_find_ccache(ctx, name, outCcachepp);
-}
-
-
-cc_int32
-cci_context_create_ccache( cc_server_context_t* ctx, char *name, int creds_version, 
-                           char *principal, cc_server_ccache_t** outCcachepp )
-{
-    cc_server_ccache_t* ccache;
-    cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-    
-    if (outCcachepp == NULL)
-        return ccErrBadParam;
-
-    if (name == NULL || principal == NULL)
-        return ccErrInvalidString;
-
-    if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && 
-         creds_version != cc_credentials_v4_v5)
-        return ccErrBadCredentialsVersion;
-       
-    code = cci_context_find_ccache(ctx, name, &ccache);
-    if (code == ccNoError) {
-        code = cci_ccache_set_principal(ccache, creds_version, principal);
-    } else {
-        code = cci_ccache_new(name, principal, creds_version, &ccache);
-        if (code != ccNoError)
-            return code;       /*let caller deal with error*/
-
-        ccache->mycontext = ctx;
-        ctx->changed = time(NULL);
-        cci_ccache_list_append(ctx->ccaches, ccache, NULL);
-
-        if (ctx->ccaches->head->data == (cc_uint8 *)ccache) {
-            ccache->is_default = 1;
-        }
-    }
-    *outCcachepp = ccache;
-    return ccNoError;
-}
-
-cc_int32
-cci_context_create_default_ccache( cc_server_context_t* ctx, int creds_version, 
-                                   char *principal, cc_server_ccache_t** outCcachepp )
-{
-    cc_server_ccache_t* ccache, *old_default;
-    cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-    
-    if (outCcachepp == NULL)
-        return ccErrBadParam;
-
-    if (principal == NULL)
-        return ccErrInvalidString;
-
-    if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && 
-         creds_version != cc_credentials_v4_v5)
-        return ccErrBadCredentialsVersion;
-       
-    code = cci_context_find_ccache(ctx, cc_default_ccache_name, &ccache);
-    if (code == ccNoError) {
-        cci_ccache_set_principal(ccache, creds_version, principal);
-    } else {
-        code = cci_ccache_new(cc_default_ccache_name, principal, creds_version, &ccache);
-        if (code != ccNoError)
-            return code;       /*let caller deal with error*/
-
-        ccache->mycontext = ctx;
-        ccache->is_default = 1;
-        ctx->changed = time(NULL);
-       
-        if (ctx->ccaches->head != NULL) {
-            old_default = (cc_server_ccache_t *)ctx->ccaches->head->data;
-            old_default->is_default = 0;
-            old_default->last_default = time(NULL);
-        }
-
-        cci_ccache_list_prepend(ctx->ccaches, ccache, NULL);
-    }
-    *outCcachepp = ccache;
-    return ccNoError;
-}
-
-cc_int32
-cci_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t** iterpp) 
-{
-    cc_ccache_iterate_t* ccache_iterator;
-    cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-    
-    if (iterpp == NULL)
-        return ccErrBadParam;
-
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
-    if (code != ccNoError)
-        return code;
-    cci_generic_list_prepend(ctx->active_iterators, ccache_iterator, sizeof(cc_ccache_iterate_t), NULL);
-
-    *iterpp = ccache_iterator;
-    return ccNoError;
-}
-
-cc_int32 
-cci_context_compare(cc_server_context_t* a, cc_server_context_t* b) 
-{
-    if (a == b)
-        return 1;
-    else
-        return 0;
-}
-
-cc_int32 
-cci_context_destroy(cc_server_context_t* ctx) 
-{
-    cc_ccache_iterate_t* ccache_iterator;
-    cc_ccache_list_node_t* ccache_node;
-    cc_server_ccache_t* ccache;
-    cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-
-    cci_generic_list_destroy(ctx->active_iterators);
-       
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
-        ccache = (cc_server_ccache_t *)ccache_node->data;
-        ccache_node->data = NULL;
-        cci_ccache_destroy(ccache);
-    }
-    cci_ccache_list_destroy(ctx->ccaches);
-
-    return ccNoError;
-}
-
-cc_int32 
-cci_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache) 
-{
-    cc_ccache_iterate_t* ccache_iterator;
-    cc_ccache_iterate_t* active_ccache_iterator;
-    cc_ccache_list_node_t* ccache_node;
-    cc_server_ccache_t* list_ccache;
-    cc_generic_list_node_t* gen_node;
-    cc_generic_iterate_t* gen_iterator;
-    cc_int32 code;
-
-    if (ctx == NULL) 
-        return ccErrInvalidContext;
-
-    if (ccache == NULL) 
-        return ccErrInvalidCCache;
-
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
-        list_ccache = (cc_server_ccache_t *)ccache_node->data;
-
-        if (list_ccache == ccache) {
-            code = cci_generic_list_iterator(ctx->active_iterators, &gen_iterator);
-            while (cci_generic_iterate_has_next(gen_iterator)) {
-                code = cci_generic_iterate_next(gen_iterator, &gen_node);
-                active_ccache_iterator = (cc_server_ccache_t *)gen_node->data;
-                if (active_ccache_iterator->next == ccache_node) {
-                    active_ccache_iterator->next = active_ccache_iterator->next->next;
-                }
-            }
-            free(gen_iterator);
-            code = cci_ccache_list_remove_element(ctx->ccaches, ccache_node);
-            break;
-        }
-    }
-    free(ccache_iterator);
-    return ccNoError;
-}
-
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+/*\r
+ * Functions to manipulate datastore layer contexts.\r
+ *\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <time.h>\r
+#include <string.h>\r
+\r
+#include "CredentialsCache.h"\r
+#include "datastore.h"\r
+\r
+int cc_myversion = 5;\r
+char cc_vendor[] = "MIT C lang CCache V5";\r
+char cc_default_ccache_name[] = "krb5cc";\r
+\r
+\r
+cc_int32\r
+ccs_context_new( int api_version, cc_auth_info_t* auth_info, \r
+                 cc_session_info_t* session_info, cc_server_context_t** outContextpp )\r
+{\r
+    cc_server_context_t* ctx;\r
+       \r
+    if ( outContextpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+       ctx = (cc_server_context_t*)malloc(sizeof(cc_server_context_t));\r
+    if (ctx == NULL)\r
+        return ccErrNoMem;\r
+               \r
+    ccs_ccache_list_new(&ctx->ccaches);\r
+    cci_generic_list_new(&ctx->active_iterators);      \r
+    ctx->api_version = api_version;\r
+    ctx->auth_info = auth_info;\r
+    ctx->session_info = session_info;\r
+    ctx->changed = time(NULL);\r
+\r
+    *outContextpp = ctx;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+ccs_context_get_default_ccache_name(cc_server_context_t* ctx, char ** outNamepp) \r
+{\r
+    cc_server_ccache_t* default_ccache;\r
+\r
+    if (outNamepp == NULL)\r
+        return ccErrBadParam;\r
+    \r
+    if (ctx == NULL)\r
+        return ccErrInvalidContext;\r
+\r
+    if (ctx->ccaches->head != NULL) {\r
+        default_ccache = (cc_server_ccache_t*)ctx->ccaches->head->data;\r
+        *outNamepp = default_ccache->name;\r
+    } else {\r
+        *outNamepp = cc_default_ccache_name;\r
+    }\r
+    return ccNoError;\r
+}\r
+\r
+\r
+cc_int32\r
+ccs_context_find_ccache( cc_server_context_t* ctx, char *name, \r
+                         cc_server_ccache_t** outCcachepp )\r
+{\r
+    cc_ccache_iterate_t* ccache_iterator;\r
+    cc_ccache_list_node_t* ccache_node;\r
+    cc_server_ccache_t* ccache;\r
+       cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+    \r
+    if (name == NULL)\r
+        return ccErrInvalidString;\r
+\r
+    if (outCcachepp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
+        ccache = (cc_server_ccache_t *)ccache_node->data;\r
+        if (strcmp(ccache->name, name) == 0)  {\r
+            free(ccache_iterator);\r
+            *outCcachepp = ccache;\r
+            return ccNoError;\r
+        }\r
+    }\r
+    free(ccache_iterator);\r
+    return ccErrCCacheNotFound;\r
+}       \r
+\r
+cc_int32\r
+ccs_context_open_ccache( cc_server_context_t* ctx, char *name, \r
+                         cc_server_ccache_t** outCcachepp )\r
+{\r
+    return ccs_context_find_ccache(ctx, name, outCcachepp);\r
+}\r
+\r
+\r
+cc_int32\r
+ccs_context_create_ccache( cc_server_context_t* ctx, char *name, int creds_version, \r
+                           char *principal, cc_server_ccache_t** outCcachepp )\r
+{\r
+    cc_server_ccache_t* ccache;\r
+    cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+    \r
+    if (outCcachepp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (name == NULL || principal == NULL)\r
+        return ccErrInvalidString;\r
+\r
+    if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && \r
+         creds_version != cc_credentials_v4_v5)\r
+        return ccErrBadCredentialsVersion;\r
+       \r
+    code = ccs_context_find_ccache(ctx, name, &ccache);\r
+    if (code == ccNoError) {\r
+        code = ccs_ccache_set_principal(ccache, creds_version, principal);\r
+    } else {\r
+        code = ccs_ccache_new(name, principal, creds_version, &ccache);\r
+        if (code != ccNoError)\r
+            return code;       /*let caller deal with error*/\r
+\r
+        ccache->mycontext = ctx;\r
+        ctx->changed = time(NULL);\r
+        ccs_ccache_list_append(ctx->ccaches, ccache, NULL);\r
+\r
+        if (ctx->ccaches->head->data == (cc_uint8 *)ccache) {\r
+            ccache->is_default = 1;\r
+        }\r
+    }\r
+    *outCcachepp = ccache;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+ccs_context_create_default_ccache( cc_server_context_t* ctx, int creds_version, \r
+                                   char *principal, cc_server_ccache_t** outCcachepp )\r
+{\r
+    cc_server_ccache_t* ccache, *old_default;\r
+    cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+    \r
+    if (outCcachepp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    if (principal == NULL)\r
+        return ccErrInvalidString;\r
+\r
+    if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && \r
+         creds_version != cc_credentials_v4_v5)\r
+        return ccErrBadCredentialsVersion;\r
+       \r
+    code = ccs_context_find_ccache(ctx, cc_default_ccache_name, &ccache);\r
+    if (code == ccNoError) {\r
+        ccs_ccache_set_principal(ccache, creds_version, principal);\r
+    } else {\r
+        code = ccs_ccache_new(cc_default_ccache_name, principal, creds_version, &ccache);\r
+        if (code != ccNoError)\r
+            return code;       /*let caller deal with error*/\r
+\r
+        ccache->mycontext = ctx;\r
+        ccache->is_default = 1;\r
+        ctx->changed = time(NULL);\r
+       \r
+        if (ctx->ccaches->head != NULL) {\r
+            old_default = (cc_server_ccache_t *)ctx->ccaches->head->data;\r
+            old_default->is_default = 0;\r
+            old_default->last_default = time(NULL);\r
+        }\r
+\r
+        ccs_ccache_list_prepend(ctx->ccaches, ccache, NULL);\r
+    }\r
+    *outCcachepp = ccache;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32\r
+ccs_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t** iterpp) \r
+{\r
+    cc_ccache_iterate_t* ccache_iterator;\r
+    cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+    \r
+    if (iterpp == NULL)\r
+        return ccErrBadParam;\r
+\r
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
+    if (code != ccNoError)\r
+        return code;\r
+    cci_generic_list_prepend(ctx->active_iterators, ccache_iterator, sizeof(cc_ccache_iterate_t), NULL);\r
+\r
+    *iterpp = ccache_iterator;\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32 \r
+ccs_context_compare(cc_server_context_t* a, cc_server_context_t* b) \r
+{\r
+    if (a == b)\r
+        return 1;\r
+    else\r
+        return 0;\r
+}\r
+\r
+cc_int32 \r
+ccs_context_destroy(cc_server_context_t* ctx) \r
+{\r
+    cc_ccache_iterate_t* ccache_iterator;\r
+    cc_ccache_list_node_t* ccache_node;\r
+    cc_server_ccache_t* ccache;\r
+    cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+\r
+    cci_generic_list_destroy(ctx->active_iterators);\r
+       \r
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
+        ccache = (cc_server_ccache_t *)ccache_node->data;\r
+        ccache_node->data = NULL;\r
+        ccs_ccache_destroy(ccache);\r
+    }\r
+    ccs_ccache_list_destroy(ctx->ccaches);\r
+\r
+    return ccNoError;\r
+}\r
+\r
+cc_int32 \r
+ccs_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache) \r
+{\r
+    cc_ccache_iterate_t* ccache_iterator;\r
+    cc_ccache_iterate_t* active_ccache_iterator;\r
+    cc_ccache_list_node_t* ccache_node;\r
+    cc_server_ccache_t* list_ccache;\r
+    cc_generic_list_node_t* gen_node;\r
+    cc_generic_iterate_t* gen_iterator;\r
+    cc_int32 code;\r
+\r
+    if (ctx == NULL) \r
+        return ccErrInvalidContext;\r
+\r
+    if (ccache == NULL) \r
+        return ccErrInvalidCCache;\r
+\r
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
+        list_ccache = (cc_server_ccache_t *)ccache_node->data;\r
+\r
+        if (list_ccache == ccache) {\r
+            code = cci_generic_list_iterator(ctx->active_iterators, &gen_iterator);\r
+            while (cci_generic_iterate_has_next(gen_iterator)) {\r
+                code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
+                active_ccache_iterator = (cc_ccache_iterate_t *)gen_node->data;\r
+                if (active_ccache_iterator->next == ccache_node) {\r
+                    active_ccache_iterator->next = active_ccache_iterator->next->next;\r
+                }\r
+            }\r
+            free(gen_iterator);\r
+            code = ccs_ccache_list_remove_element(ctx->ccaches, ccache_node);\r
+            break;\r
+        }\r
+    }\r
+    free(ccache_iterator);\r
+    return ccNoError;\r
+}\r
+\r
similarity index 56%
rename from src/lib/ccapi/server/lists.c
rename to src/lib/ccapi/server/ccs_lists.c
index 882ecb7a0643ab054988adbfcbad2623b76b2ead..779c17b7a0c5876c176b5fa8667d44a358d40645 100644 (file)
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-
-/*
- * Lists implementation.
- * 
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-/**
- * cci_generic_iterate_has_next()
- *
- * Purpose: Determine if an iterator has a next element
- *
- * Return:  1 if another element exists
- *          0 if no additional elements exist
- *
- * Errors:  None
- *
- */
-cc_int32 
-cci_generic_iterate_has_next(cc_generic_iterate_t *iterate) 
-{
-    return ((iterate == NULL || iterate->next == NULL) ? 0 : 1);
-}
-
-/**
- * cci_generic_iterate_next()
- *
- * Purpose: Retrieve the next element from an iterator and advance
- *          the iterator
- *
- * Return:  non-NULL, the next element in the iterator
- *          NULL, the iterator list is empty or iterator is invalid
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_generic_iterate_next(cc_generic_iterate_t *iterator, cc_generic_list_node_t** nodepp) 
-{
-    cc_generic_list_node_t* ret;
-    
-    if (iterator == NULL || nodepp == NULL)
-        return ccErrBadParam;
-
-    ret = iterator->next;
-    if (iterator->next != NULL)
-        iterator->next = iterator->next->next;
-
-    *nodepp = ret;
-    return ccNoError;
-}
-
-/**
- * cci_context_iterate_has_next()
- *
- * Purpose: Determine if a context iterator has a next element
- *
- * Return:  1 if another element exists
- *          0 if no additional elements exist
- */
-cc_int32 
-cci_context_iterate_has_next(cc_context_iterate_t *iterate) 
-{
-    if ( iterate == NULL )
-        return 0;
-    
-    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);
-}
-
-/**
- * cci_context_iterate_next()
- *
- * Purpose: Retrieve the next element from a context iterator and advance
- *          the iterator
- *
- * Return:  non-NULL, the next element in the iterator
- *          NULL, the iterator list is empty or iterator is invalid
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_context_iterate_next(cc_context_iterate_t *iterate, cc_context_list_node_t ** nodepp)
-{
-    if ( iterate == NULL || nodepp == NULL)
-        return ccErrBadParam;
-    
-    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate,(cc_context_list_node_t**)nodepp);
-}
-
-/**
- * cci_ccache_iterate_has_next()
- *
- * Purpose: Determine if a cache iterator has a next element
- *
- * Return:  1 if another element exists
- *          0 if no additional elements exist
- *         -1 if error
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32 
-cci_ccache_iterate_has_next(cc_ccache_iterate_t *iterate) 
-{
-    if ( iterate == NULL )
-        return 0;
-    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);
-}
-
-/**
- * cci_ccache_iterate_next()
- * 
- * Purpose: Retrieve the next element from a ccache iterator and advance
- *          the iterator
- *
- * Return:  non-NULL, the next element in the iterator
- *          NULL, the iterator list is empty or iterator is invalid
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_ccache_iterate_next(cc_ccache_iterate_t *iterate, cc_ccache_list_node_t ** nodepp)
-{
-    if ( iterate == NULL || nodepp == NULL)
-        return ccErrBadParam;
-    
-    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_ccache_list_node_t**)nodepp);
-}
-
-/**
- * cci_credentials_iterate_has_next()
- *
- * Purpose: Determine if a credentials iterator has a next element
- *
- * Return:  1 if another element exists
- *          0 if no additional elements exist
- *         -1 if error
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32 
-cci_credentials_iterate_has_next(cc_credentials_iterate_t *iterate) 
-{
-    if ( iterate == NULL )
-        return 0;
-    
-    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);
-}
-
-/**
- * cci_credentials_iterate_next()
- * 
- * Purpose: Retrieve the next element from a credentials iterator and advance
- *          the iterator
- *
- * Return:  non-NULL, the next element in the iterator
- *          NULL, the iterator list is empty or iterator is invalid
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t** nodepp) 
-{
-    if ( iterate == NULL || nodepp == NULL )
-        return ccErrBadParam;
-    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_credentials_list_node_t**)nodepp);
-}
-
-/**
- * cci_generic_list_new()
- *
- * Purpose: Allocate new generic list
- *
- * Return:  non-NULL, an empty list
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_generic_list_new(cc_generic_list_head_t ** listpp) 
-{
-    cc_generic_list_head_t* ret = (cc_generic_list_head_t *)malloc(sizeof(cc_generic_list_head_t));
-    if (ret == NULL)
-        return ccErrNoMem;
-       
-       ret->type = generic;
-    ret->head = ret->tail = NULL;
-    *listpp = ret;
-
-    return ccNoError;
-}
-
-/**
- * cci_generic_list_append()
- *
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) 
-{
-    cc_generic_list_node_t* new_node;
-
-    if ( data == NULL || len == 0 )
-        return ccErrBadParam;
-
-    new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));
-    if (new_node == NULL)
-        return ccErrNoMem;
-
-    new_node->data = malloc(len);
-    if ( new_node->data == NULL ) {
-        free(new_node);
-        return ccErrNoMem;         
-    }
-    
-    memcpy(new_node->data,data,len);
-    new_node->len = len;
-
-    if (head->head == NULL) { /*empty list*/
-        head->head = new_node;
-        head->tail = new_node;
-           new_node->next = new_node->prev = NULL;
-    } else {
-        new_node->prev = head->tail;
-        head->tail->next = new_node;
-        head->tail = new_node;
-               new_node->next = NULL;
-    }
-       if (nodepp != NULL)
-           *nodepp = new_node;
-    return ccNoError;
-}
-
-/**
- * cci_generic_list_prepend()
- *
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data'
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem, ccErrBadParam
- *
- */
-cc_int32 
-cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) 
-{
-    cc_generic_list_node_t* new_node;
-
-    if ( data == NULL || len == 0 )
-        return ccErrBadParam;
-
-    new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));
-    if (new_node == NULL)
-        return ccErrNoMem;
-
-    new_node->data = malloc(len);
-    if ( new_node->data == NULL ) {
-        free(new_node);
-        return ccErrNoMem;
-    }
-    
-    memcpy(new_node->data,data,len);
-    new_node->len = len;
-       
-    if (head->head == NULL) { /*empty list*/
-        head->head = new_node;
-        head->tail = new_node;
-        new_node->prev = new_node->next = NULL;
-    } else {
-        new_node->next = head->head;
-        head->head->prev = new_node;
-        new_node->prev = NULL;
-        head->head = new_node;
-    }
-
-       if (nodepp != NULL)
-               *nodepp = new_node;
-
-    return ccNoError;
-}
-
-/**
- * cci_generic_list_remove_element()
- *
- * Purpose: Remove a node from the list
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32 
-cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem) 
-{
-    if (head->head == NULL || rem == NULL)
-        return ccErrBadParam;
-
-    if (head->head == rem && head->tail == rem) { /*removing only element of list*/
-        head->head = head->tail = NULL;
-    } else if (head->head == rem) { /*removing head*/
-        head->head = head->head->next;
-    } else if (head->tail == rem) { /*removing tail*/
-        head->tail = head->tail->prev;
-        head->tail->next = NULL;
-    } else {
-        rem->prev->next = rem->next;
-        rem->next->prev = rem->prev;
-    }
-    free(rem);
-    return ccNoError;
-}
-
-/**
- * cci_generic_free_element()
- *
- * Purpose: Free the memory associated with a node
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_generic_free_element(cc_generic_list_node_t* node)
-{
-    if ( node == NULL )
-        return ccErrBadParam;
-
-    if ( node->data ) {
-        free(node->data);
-        node->data = NULL;
-    }
-    node->len = 0;
-    node->next = node->prev = NULL;
-    free(node);
-    return ccNoError;
-}
-
-
-/**
- * cci_generic_list_destroy()
- *
- * Purpose: Deallocate a list and all of its contents
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- */
-cc_int32
-cci_generic_list_destroy(cc_generic_list_head_t* head) 
-{
-    cc_generic_list_node_t *cur, *next;
-    cc_int32 ret = ccNoError;
-
-    if ( head == NULL )
-        return ccErrBadParam;
-       
-    for (cur = head->head; ret == ccNoError && cur != NULL; cur = next) {
-        next = cur->next;
-        ret = cci_generic_free_element(cur);
-    }       
-    free(head);
-    return(ret);
-}
-
-/**
- * cci_context_list_destroy()
- *
- * Purpose: Deallocate a list and all of its contents
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- */
-cc_int32
-cci_context_list_destroy(cc_context_list_head_t* head) 
-{
-    return cci_generic_list_destroy((cc_generic_list_head_t*)head);
-}
-
-/**
- * cci_ccache_list_destroy()
- *
- * Purpose: Deallocate a list and all of its contents
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- */
-cc_int32
-cci_ccache_list_destroy(cc_ccache_list_head_t* head) 
-{
-    return cci_generic_list_destroy((cc_generic_list_head_t*)head);
-}
-
-/**
- * cci_credentials_list_destroy()
- *
- * Purpose: Deallocate a list and all of its contents
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- */
-cc_int32
-cci_credentials_list_destroy(cc_credentials_list_head_t* head) 
-{
-    return cci_generic_list_destroy((cc_generic_list_head_t*)head);
-}
-
-/**
- * cci_generic_list_copy()
- *
- * Purpose: Copy a list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrBadParam, ccErrNoMem
- *
- */
-cc_int32
-cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t** headpp) 
-{
-    cc_generic_list_head_t* copy;
-    cc_generic_list_node_t *src_node, *dst_node;
-    cc_int32 code;
-
-    if (head == NULL || headpp == NULL)
-        return ccErrBadParam;
-
-    code = cci_generic_list_new(&copy);
-    if (code != ccNoError)
-        return code;
-
-    for (src_node = head->head; src_node != NULL; src_node = src_node->next) {
-        code = cci_generic_list_append(copy, src_node->data, src_node->len, &dst_node);
-        if (code != ccNoError) {
-            cci_generic_list_destroy(copy);
-            return code;
-        }
-    }
-    *headpp = copy;
-    return ccNoError;
-}
-
-/**
- * cci_context_list_copy()
- *
- * Purpose: Copy a list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrBadParam, ccErrNoMem
- *
- */
-cc_int32
-cci_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t** headpp ) 
-{
-    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_context_list_head_t **)headpp);
-}
-
-/**
- * cci_ccache_list_copy()
- *
- * Purpose: Copy a list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrBadParam, ccErrNoMem
- */
-cc_int32
-cci_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t** headpp)
-{
-    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_ccache_list_head_t **)headpp);
-}
-
-/**
- * cci_credentials_list_copy()
- *
- * Purpose: Copy a list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrBadParam, ccErrNoMem
- *
- */
-cc_int32
-cci_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t** headpp) 
-{
-    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_credentials_list_head_t **)headpp);
-}
-
-
-/**
- * cci_generic_list_iterator()
- *
- * Purpose: Allocate an iterator for the specified list
- *
- * Return:  non-NULL, an iterator
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t** headpp) 
-{
-    cc_generic_iterate_t* iterator;
-
-    if ( head == NULL || headpp == NULL )
-        return ccErrBadParam;
-
-    iterator = (cc_generic_iterate_t*)malloc(sizeof(cc_generic_iterate_t));
-    if (iterator == NULL)
-        return ccErrNoMem;
-    
-    iterator->next = head->head;
-    *headpp = iterator;
-    return ccNoError;
-}
-
-/**
- * cci_generic_free_iterator()
- *
- * Purpose: Deallocate memory associated with an iterator
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_generic_free_iterator(cc_generic_iterate_t* iterator)
-{
-    if ( iterator == NULL )
-        return ccErrBadParam;
-
-    iterator->next = NULL;
-    free(iterator);
-    return ccNoError;
-}
-
-
-/**
- * cci_context_list_new()
- *
- * Purpose: Allocate a new context list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_context_list_new(cc_context_list_head_t ** headpp) 
-{
-    cc_context_list_head_t *ret;
-    
-    if ( headpp == NULL )
-        return ccErrBadParam;
-
-    ret = (cc_context_list_head_t *)malloc(sizeof(cc_context_list_head_t));
-    if (ret == NULL)
-        return ccErrNoMem;
-    ret->head = ret->tail = NULL;
-    *headpp = ret;
-    return ccNoError;
-}
-
-/**
- * cci_context_list_append()
- *
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp) 
-{
-    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);
-}
-
-/**
- * cci_context_list_prepend()
- *
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp ) 
-{
-    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);
-}
-
-/**
- * cci_context_list_remove_element
- *
- * Purpose: Remove a node from the list
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- */
-cc_int32
-cci_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem) 
-{
-    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);
-}
-
-/**
- * cci_context_list_iterator()
- *
- * Purpose: Allocate an iterator for the specified list
- *
- * Return:  non-NULL, an iterator
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_context_list_iterator(cc_context_list_head_t *head, cc_context_iterate_t** iterpp) 
-{
-    cc_context_iterate_t* iterator;
-    
-    if ( head == NULL || iterpp == NULL )
-        return ccErrBadParam;
-
-    iterator = (cc_context_iterate_t*)malloc(sizeof(cc_context_iterate_t));
-    if (iterator == NULL)
-        return ccErrNoMem;
-
-    iterator->next = head->head;
-    *iterpp = iterator;
-    return ccNoError;
-}
-
-/**
- * cci_context_free_iterator()
- *
- * Purpose: Deallocate memory associated with an iterator
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_context_free_iterator(cc_context_iterate_t* iterator)
-{
-    if ( iterator == NULL )
-        return ccErrBadParam;
-
-    iterator->next = NULL;
-    free(iterator);
-    return ccNoError;
-}
-
-/**
- * cci_ccache_list_new()
- *
- * Purpose: Allocate a new ccache list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- */
-cc_int32
-cci_ccache_list_new(cc_ccache_list_head_t ** listpp)
-{
-    cc_ccache_list_head_t *ret;
-    
-    if ( listpp == NULL )
-        return ccErrBadParam;
-
-    ret = (cc_ccache_list_head_t *)malloc(sizeof(cc_ccache_list_head_t));
-    if (ret == NULL)
-        return ccErrNoMem;
-
-    ret->head = ret->tail = NULL;
-    *listpp = ret;
-    return ccNoError;
-}
-
-/**
- * cci_ccache_list_append()
- *
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) 
-{
-    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);
-}
-
-/**
- * cci_ccache_list_prepend()
- *
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) 
-{
-    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);
-}
-
-/**
- * cci_ccache_list_remove_element()
- *
- * Purpose: Remove a node from the list
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem) 
-{
-    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);
-}
-
-/**
- * cci_ccache_list_iterator()
- *
- * Purpose: Allocate an iterator for the specified list
- *
- * Return:  non-NULL, an iterator
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_ccache_list_iterator(cc_ccache_list_head_t *head, cc_ccache_iterate_t** iterpp) 
-{
-    cc_ccache_iterate_t* iterator;
-    
-    if ( head == NULL || iterpp == NULL )
-        return ccErrBadParam;
-
-    iterator = (cc_ccache_iterate_t*)malloc(sizeof(cc_ccache_iterate_t));
-    if (iterator == NULL)
-        return ccErrNoMem;
-
-    iterator->next = head->head;
-    *iterpp = iterator;
-    return ccNoError;
-}
-
-/**
- * cci_ccache_free_iterator()
- *
- * Purpose: Deallocate memory associated with an iterator
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_ccache_free_iterator(cc_ccache_iterate_t* iterator)
-{
-    if ( iterator == NULL )
-        return ccErrBadParam;
-
-    iterator->next = NULL;
-    free(iterator);
-    return ccNoError;
-}
-
-/**
- * cci_credentials_list_new()
- *
- * Purpose: Allocate a new ccache list
- *
- * Return:  non-NULL, a new list
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_credentials_list_new(cc_credentials_list_head_t ** list) 
-{
-    if ( list == NULL )
-        return ccErrBadParam;
-
-    *list = (cc_credentials_list_head_t *)malloc(sizeof(cc_credentials_list_head_t));
-    if (*list == NULL)
-        return ccErrNoMem;
-
-    (*list)->head = (*list)->tail = NULL;
-    return ccNoError;
-}
-
-/**
- * cci_credentials_list_append()
- *
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp ) 
-{
-    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);
-}
-
-/**
- * cci_credentials_list_prepend()
- *
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' 
- *
- * Return:  non-NULL, a pointer to the newly allocated node
- *          NULL, failure
- *
- * Errors:  ccErrNoMem,ccErrBadParam
- *
- */
-cc_int32
-cci_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp) 
-{
-    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);
-}
-
-/**
- * cci_credentials_list_remove_element()
- *
- * Purpose: Remove a node from the list
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32 
-cci_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem) 
-{
-    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);
-}
-
-/**
- * cci_credentials_list_iterator()
- *
- * Purpose: Allocate an iterator for the specified list
- *
- * Return:  non-NULL, an iterator
- *          NULL, failure
- *
- * Errors:  ccErrNoMem
- *
- */
-cc_int32
-cci_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t** iterpp) 
-{
-    cc_credentials_iterate_t* iterator;
-    
-    if ( head == NULL || iterpp == NULL )
-        return ccErrBadParam;
-
-    iterator = (cc_credentials_iterate_t*)malloc(sizeof(cc_credentials_iterate_t));
-    if (iterator == NULL)
-        return ccErrNoMem;
-
-    iterator->next = head->head;
-    *iterpp = iterator;
-    return ccNoError;
-}
-
-/**
- * cci_credentials_free_iterator()
- *
- * Purpose: Deallocate memory associated with an iterator
- *
- * Return:  0, success
- *         -1, failure
- *
- * Errors:  ccErrBadParam
- *
- */
-cc_int32
-cci_credentials_free_iterator(cc_credentials_iterate_t* iterator)
-{
-    if ( iterator == NULL )
-        return ccErrBadParam;
-
-    iterator->next = NULL;
-    free(iterator);
-    return ccNoError;
-}
-
+/* $Copyright:\r
+ *\r
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
+ * \r
+ * All rights reserved.\r
+ * \r
+ * Export of this software from the United States of America may require a\r
+ * specific license from the United States Government.  It is the\r
+ * responsibility of any person or organization contemplating export to\r
+ * obtain such a license before exporting.\r
+ * \r
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
+ * this software and its documentation for any purpose and without fee is\r
+ * hereby granted, provided that the above copyright notice appear in all\r
+ * copies and that both that copyright notice and this permission notice\r
+ * appear in supporting documentation, and that the name of M.I.T. not be\r
+ * used in advertising or publicity pertaining to distribution of the\r
+ * software without specific, written prior permission.  Furthermore if you\r
+ * modify this software you must label your software as modified software\r
+ * and not distribute it in such a fashion that it might be confused with\r
+ * the original MIT software. M.I.T. makes no representations about the\r
+ * suitability of this software for any purpose.  It is provided "as is"\r
+ * without express or implied warranty.\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+ * \r
+ * Individual source code files are copyright MIT, Cygnus Support,\r
+ * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
+ * \r
+ * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
+ * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
+ * (MIT).  No commercial use of these trademarks may be made without prior\r
+ * written permission of MIT.\r
+ * \r
+ * "Commercial use" means use of a name in a product or other for-profit\r
+ * manner.  It does NOT prevent a commercial firm from referring to the MIT\r
+ * trademarks in order to convey information (although in doing so,\r
+ * recognition of their trademark status should be given).\r
+ * $\r
+ */\r
+\r
+\r
+/*\r
+ * Lists implementation.\r
+ * \r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <memory.h>\r
+\r
+#include "CredentialsCache.h"\r
+#include "datastore.h"\r
+\r
+/**\r
+ * ccs_context_iterate_has_next()\r
+ *\r
+ * Purpose: Determine if a context iterator has a next element\r
+ *\r
+ * Return:  1 if another element exists\r
+ *          0 if no additional elements exist\r
+ */\r
+cc_int32 \r
+ccs_context_iterate_has_next(cc_context_iterate_t *iterate) \r
+{\r
+    if ( iterate == NULL )\r
+        return 0;\r
+    \r
+    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
+}\r
+\r
+/**\r
+ * ccs_context_iterate_next()\r
+ *\r
+ * Purpose: Retrieve the next element from a context iterator and advance\r
+ *          the iterator\r
+ *\r
+ * Return:  non-NULL, the next element in the iterator\r
+ *          NULL, the iterator list is empty or iterator is invalid\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_iterate_next(cc_context_iterate_t *iterate, cc_context_list_node_t ** nodepp)\r
+{\r
+    if ( iterate == NULL || nodepp == NULL)\r
+        return ccErrBadParam;\r
+    \r
+    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate,(cc_context_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_iterate_has_next()\r
+ *\r
+ * Purpose: Determine if a cache iterator has a next element\r
+ *\r
+ * Return:  1 if another element exists\r
+ *          0 if no additional elements exist\r
+ *         -1 if error\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_ccache_iterate_has_next(cc_ccache_iterate_t *iterate) \r
+{\r
+    if ( iterate == NULL )\r
+        return 0;\r
+    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_iterate_next()\r
+ * \r
+ * Purpose: Retrieve the next element from a ccache iterator and advance\r
+ *          the iterator\r
+ *\r
+ * Return:  non-NULL, the next element in the iterator\r
+ *          NULL, the iterator list is empty or iterator is invalid\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_iterate_next(cc_ccache_iterate_t *iterate, cc_ccache_list_node_t ** nodepp)\r
+{\r
+    if ( iterate == NULL || nodepp == NULL)\r
+        return ccErrBadParam;\r
+    \r
+    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_ccache_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_iterate_has_next()\r
+ *\r
+ * Purpose: Determine if a credentials iterator has a next element\r
+ *\r
+ * Return:  1 if another element exists\r
+ *          0 if no additional elements exist\r
+ *         -1 if error\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_credentials_iterate_has_next(cc_credentials_iterate_t *iterate) \r
+{\r
+    if ( iterate == NULL )\r
+        return 0;\r
+    \r
+    return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_iterate_next()\r
+ * \r
+ * Purpose: Retrieve the next element from a credentials iterator and advance\r
+ *          the iterator\r
+ *\r
+ * Return:  non-NULL, the next element in the iterator\r
+ *          NULL, the iterator list is empty or iterator is invalid\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t** nodepp) \r
+{\r
+    if ( iterate == NULL || nodepp == NULL )\r
+        return ccErrBadParam;\r
+    return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_credentials_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_context_list_destroy()\r
+ *\r
+ * Purpose: Deallocate a list and all of its contents\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32\r
+ccs_context_list_destroy(cc_context_list_head_t* head) \r
+{\r
+    return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_destroy()\r
+ *\r
+ * Purpose: Deallocate a list and all of its contents\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32\r
+ccs_ccache_list_destroy(cc_ccache_list_head_t* head) \r
+{\r
+    return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_destroy()\r
+ *\r
+ * Purpose: Deallocate a list and all of its contents\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32\r
+ccs_credentials_list_destroy(cc_credentials_list_head_t* head) \r
+{\r
+    return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
+}\r
+\r
+/**\r
+ * ccs_context_list_copy()\r
+ *\r
+ * Purpose: Copy a list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrBadParam, ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t** headpp ) \r
+{\r
+    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_context_list_head_t **)headpp);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_copy()\r
+ *\r
+ * Purpose: Copy a list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrBadParam, ccErrNoMem\r
+ */\r
+cc_int32\r
+ccs_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t** headpp)\r
+{\r
+    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_ccache_list_head_t **)headpp);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_copy()\r
+ *\r
+ * Purpose: Copy a list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrBadParam, ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t** headpp) \r
+{\r
+    return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_credentials_list_head_t **)headpp);\r
+}\r
+\r
+\r
+/**\r
+ * ccs_context_list_new()\r
+ *\r
+ * Purpose: Allocate a new context list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_list_new(cc_context_list_head_t ** headpp) \r
+{\r
+    cc_context_list_head_t *ret;\r
+    \r
+    if ( headpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    ret = (cc_context_list_head_t *)malloc(sizeof(cc_context_list_head_t));\r
+    if (ret == NULL)\r
+        return ccErrNoMem;\r
+    ret->head = ret->tail = NULL;\r
+       ret->type = context;\r
+    *headpp = ret;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_context_list_append()\r
+ *\r
+ * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp) \r
+{\r
+    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_context_list_prepend()\r
+ *\r
+ * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp ) \r
+{\r
+    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_context_list_remove_element\r
+ *\r
+ * Purpose: Remove a node from the list\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ */\r
+cc_int32\r
+ccs_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem) \r
+{\r
+    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
+}\r
+\r
+/**\r
+ * ccs_context_list_iterator()\r
+ *\r
+ * Purpose: Allocate an iterator for the specified list\r
+ *\r
+ * Return:  non-NULL, an iterator\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_list_iterator(cc_context_list_head_t *head, cc_context_iterate_t** iterpp) \r
+{\r
+    cc_context_iterate_t* iterator;\r
+    \r
+    if ( head == NULL || iterpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator = (cc_context_iterate_t*)malloc(sizeof(cc_context_iterate_t));\r
+    if (iterator == NULL)\r
+        return ccErrNoMem;\r
+\r
+    iterator->next = head->head;\r
+    *iterpp = iterator;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_context_free_iterator()\r
+ *\r
+ * Purpose: Deallocate memory associated with an iterator\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_context_free_iterator(cc_context_iterate_t* iterator)\r
+{\r
+    if ( iterator == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator->next = NULL;\r
+    free(iterator);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_new()\r
+ *\r
+ * Purpose: Allocate a new ccache list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ */\r
+cc_int32\r
+ccs_ccache_list_new(cc_ccache_list_head_t ** listpp)\r
+{\r
+    cc_ccache_list_head_t *ret;\r
+    \r
+    if ( listpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    ret = (cc_ccache_list_head_t *)malloc(sizeof(cc_ccache_list_head_t));\r
+    if (ret == NULL)\r
+        return ccErrNoMem;\r
+\r
+    ret->head = ret->tail = NULL;\r
+    *listpp = ret;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_append()\r
+ *\r
+ * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) \r
+{\r
+    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_prepend()\r
+ *\r
+ * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) \r
+{\r
+    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_remove_element()\r
+ *\r
+ * Purpose: Remove a node from the list\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem) \r
+{\r
+    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
+}\r
+\r
+/**\r
+ * ccs_ccache_list_iterator()\r
+ *\r
+ * Purpose: Allocate an iterator for the specified list\r
+ *\r
+ * Return:  non-NULL, an iterator\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_list_iterator(cc_ccache_list_head_t *head, cc_ccache_iterate_t** iterpp) \r
+{\r
+    cc_ccache_iterate_t* iterator;\r
+    \r
+    if ( head == NULL || iterpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator = (cc_ccache_iterate_t*)malloc(sizeof(cc_ccache_iterate_t));\r
+    if (iterator == NULL)\r
+        return ccErrNoMem;\r
+\r
+    iterator->next = head->head;\r
+    *iterpp = iterator;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_ccache_free_iterator()\r
+ *\r
+ * Purpose: Deallocate memory associated with an iterator\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_ccache_free_iterator(cc_ccache_iterate_t* iterator)\r
+{\r
+    if ( iterator == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator->next = NULL;\r
+    free(iterator);\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_new()\r
+ *\r
+ * Purpose: Allocate a new ccache list\r
+ *\r
+ * Return:  non-NULL, a new list\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_list_new(cc_credentials_list_head_t ** list) \r
+{\r
+    if ( list == NULL )\r
+        return ccErrBadParam;\r
+\r
+    *list = (cc_credentials_list_head_t *)malloc(sizeof(cc_credentials_list_head_t));\r
+    if (*list == NULL)\r
+        return ccErrNoMem;\r
+\r
+    (*list)->head = (*list)->tail = NULL;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_append()\r
+ *\r
+ * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp ) \r
+{\r
+    return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_prepend()\r
+ *\r
+ * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
+ *\r
+ * Return:  non-NULL, a pointer to the newly allocated node\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem,ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp) \r
+{\r
+    return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_remove_element()\r
+ *\r
+ * Purpose: Remove a node from the list\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32 \r
+ccs_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem) \r
+{\r
+    return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
+}\r
+\r
+/**\r
+ * ccs_credentials_list_iterator()\r
+ *\r
+ * Purpose: Allocate an iterator for the specified list\r
+ *\r
+ * Return:  non-NULL, an iterator\r
+ *          NULL, failure\r
+ *\r
+ * Errors:  ccErrNoMem\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t** iterpp) \r
+{\r
+    cc_credentials_iterate_t* iterator;\r
+    \r
+    if ( head == NULL || iterpp == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator = (cc_credentials_iterate_t*)malloc(sizeof(cc_credentials_iterate_t));\r
+    if (iterator == NULL)\r
+        return ccErrNoMem;\r
+\r
+    iterator->next = head->head;\r
+    *iterpp = iterator;\r
+    return ccNoError;\r
+}\r
+\r
+/**\r
+ * ccs_credentials_free_iterator()\r
+ *\r
+ * Purpose: Deallocate memory associated with an iterator\r
+ *\r
+ * Return:  0, success\r
+ *         -1, failure\r
+ *\r
+ * Errors:  ccErrBadParam\r
+ *\r
+ */\r
+cc_int32\r
+ccs_credentials_free_iterator(cc_credentials_iterate_t* iterator)\r
+{\r
+    if ( iterator == NULL )\r
+        return ccErrBadParam;\r
+\r
+    iterator->next = NULL;\r
+    free(iterator);\r
+    return ccNoError;\r
+}\r
+\r
diff --git a/src/lib/ccapi/server/mac/CCacheServer.plist b/src/lib/ccapi/server/mac/CCacheServer.plist
new file mode 100644 (file)
index 0000000..987cf71
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>ServiceName</key>
+        <string>edu.mit.Kerberos.CCacheServer.ipcService</string>
+        <key>Command</key>
+        <string>/System/Library/CoreServices/CCacheServer.app/Contents/MacOS/CCacheServer</string>
+        <key>OnDemand</key>
+        <true/>
+</dict>
+</plist>
diff --git a/src/lib/ccapi/server/mac/CCacheServerInfo.plist b/src/lib/ccapi/server/mac/CCacheServerInfo.plist
new file mode 100644 (file)
index 0000000..e03d5f3
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>CCacheServer</string>
+       <key>CFBundleGetInfoString</key>
+       <string>4.1</string>
+       <key>CFBundleIconFile</key>
+       <string></string>
+       <key>CFBundleIdentifier</key>
+       <string>edu.mit.Kerberos.CCacheServer</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>Kerberos Credentials Cache Server</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleSignature</key>
+       <string>CCSa</string>
+       <key>CFBundleVersion</key>
+       <string>0.0.1d1</string>
+        <key>CFBundleShortVersionString</key>
+        <string>5.5</string>
+        <key>CFBundleGetInfoString</key>
+        <string>5.5 Copyright MIT</string>
+        <key>KfMDisplayVersion</key>
+        <string>5.5 Copyright MIT</string>
+        <key>KfMDisplayCopyright</key>
+        <string>Copyright MIT</string>
+        <key>NSHumanReadableCopyright</key>
+        <string>5.5 Copyright MIT</string>
+       <key>LSBackgroundOnly</key>
+       <string>1</string>
+</dict>
+</plist>
diff --git a/src/lib/ccapi/server/mac/main.c b/src/lib/ccapi/server/mac/main.c
new file mode 100644 (file)
index 0000000..a9da8da
--- /dev/null
@@ -0,0 +1,33 @@
+#include <stdarg.h>
+#include <stdio.h>
+#include <syslog.h>
+#include "CredentialsCache.h"
+#include "msg.h"
+#include "migServer.h"
+
+#include <Kerberos/kipc_server.h>
+
+int main (int argc, const char *argv[])
+{
+    cc_int32 code = 0;
+    int running = 1;
+
+    openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH);
+    syslog (LOG_INFO, "Starting up.");   
+
+    if (!code) {
+        code = ccs_serv_initialize();
+    }
+    
+    if (!code) {
+        code = kipc_server_run_server (ccapi_server);
+    }
+    
+    /* cleanup ccs resources */
+    ccs_serv_cleanup();
+
+    syslog (LOG_NOTICE, "Exiting: %s (%d)", kipc_error_string (code), code);
+
+    /* exit */
+    return code ? 1 : 0;
+}
index dd338e010cbc126e887c97c518bc0b521bdf0b8a..66bc6aee9c0836d3c664946312faf55c8b95d327 100644 (file)
 #include "rpc_auth.h"
 
 cc_int32 
-cci_rpc_is_authorized( cc_auth_info_t* msg_auth, cc_session_info_t* msg_session, cc_auth_info_t* stored_auth, 
+ccs_rpc_is_authorized( cc_auth_info_t* msg_auth, cc_session_info_t* msg_session, cc_auth_info_t* stored_auth, 
                        cc_session_info_t* stored_session, cc_uint32 * authorizedp) 
 {
-    if (msg_auth == stored_auth && msg_session == stored_session)
+    if (msg_auth->len == stored_auth->len && 
+       !memcmp(msg_auth->info, stored_auth->info, msg_auth->len) && 
+       msg_session->len == stored_session->len && 
+       !memcmp(msg_session->info, stored_session->info, msg_session->len))
         *authorizedp = 1;
     else
         *authorizedp = 0;
index 30a108a344592466b6f749c3ece59c5be3619513..52c62f45cca5c221b293e034ab2d4ae505be5091 100644 (file)
@@ -1,6 +1,6 @@
 /* $Copyright:
  *
- * Copyright 2004 by the Massachusetts Institute of Technology.
+ * Copyright 2004-2006 by the Massachusetts Institute of Technology.
  * 
  * All rights reserved.
  * 
@@ -50,6 +50,7 @@
 #include "datastore.h"
 #include "rpc_auth.h"
 #include "msg_headers.h"
+#include "marshall.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -62,33 +63,39 @@ extern int cc_myversion;
 extern char cc_vendor[];
 
 cc_int32 
-cci_serv_initialize(void) 
+ccs_serv_initialize(void) 
 {
     cc_int32 code;
 
-    code = cci_context_list_new(&AllContexts);
+    code = ccs_context_list_new(&AllContexts);
     if ( code != ccNoError )
         return code;
     TypeToOpMapping = (type_to_op_mapping_t*)malloc(sizeof(type_to_op_mapping_t));
     if (TypeToOpMapping == NULL) {
-        cci_context_list_destroy(AllContexts);
+        ccs_context_list_destroy(AllContexts);
         return ccErrNoMem;
     }
 
+#if 0
+    /* These message types are only generated by the server in response
+     * to a request.  They are never received.
+     */
+    TypeToOpMapping->operations[ccmsg_ACK] = ccop_ACK;
+    TypeToOpMapping->operations[ccmsg_NACK] = ccop_NACK;
+#endif
     TypeToOpMapping->operations[ccmsg_INIT] = ccop_INIT;
     TypeToOpMapping->operations[ccmsg_CTX_RELEASE] = ccop_CTX_RELEASE;
     TypeToOpMapping->operations[ccmsg_CTX_GET_CHANGE_TIME] = ccop_CTX_GET_CHANGE_TIME;
     TypeToOpMapping->operations[ccmsg_CTX_GET_DEFAULT_CCACHE_NAME] = ccop_CTX_GET_DEFAULT_CCACHE_NAME;
-    TypeToOpMapping->operations[ccmsg_CTX_COMPARE] = ccop_CTX_COMPARE;
+    TypeToOpMapping->operations[ccmsg_CTX_CCACHE_OPEN] = ccop_CTX_CCACHE_OPEN;
+    TypeToOpMapping->operations[ccmsg_CTX_CCACHE_OPEN_DEFAULT] = ccop_CTX_CCACHE_OPEN_DEFAULT;
+    TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE] = ccop_CTX_CCACHE_CREATE;
+    TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE_DEFAULT] = ccop_CTX_CCACHE_CREATE_DEFAULT;
+    TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE_UNIQUE] = ccop_CTX_CCACHE_CREATE_UNIQUE;
     TypeToOpMapping->operations[ccmsg_CTX_NEW_CCACHE_ITERATOR] = ccop_CTX_NEW_CCACHE_ITERATOR;
     TypeToOpMapping->operations[ccmsg_CTX_LOCK] = ccop_CTX_LOCK;
     TypeToOpMapping->operations[ccmsg_CTX_UNLOCK] = ccop_CTX_UNLOCK;
-    TypeToOpMapping->operations[ccmsg_CTX_CLONE] = ccop_CTX_CLONE;
-    TypeToOpMapping->operations[ccmsg_CCACHE_OPEN] = ccop_CCACHE_OPEN;
-    TypeToOpMapping->operations[ccmsg_CCACHE_OPEN_DEFAULT] = ccop_CCACHE_OPEN_DEFAULT;
-    TypeToOpMapping->operations[ccmsg_CCACHE_CREATE] = ccop_CCACHE_CREATE;
-    TypeToOpMapping->operations[ccmsg_CCACHE_CREATE_DEFAULT] = ccop_CCACHE_CREATE_DEFAULT;
-    TypeToOpMapping->operations[ccmsg_CCACHE_CREATE_UNIQUE] = ccop_CCACHE_CREATE_UNIQUE;
+    TypeToOpMapping->operations[ccmsg_CTX_COMPARE] = ccop_CTX_COMPARE;
     TypeToOpMapping->operations[ccmsg_CCACHE_RELEASE] = ccop_CCACHE_RELEASE;
     TypeToOpMapping->operations[ccmsg_CCACHE_DESTROY] = ccop_CCACHE_DESTROY;
     TypeToOpMapping->operations[ccmsg_CCACHE_SET_DEFAULT] = ccop_CCACHE_SET_DEFAULT;
@@ -96,9 +103,12 @@ cci_serv_initialize(void)
     TypeToOpMapping->operations[ccmsg_CCACHE_GET_NAME] = ccop_CCACHE_GET_NAME;
     TypeToOpMapping->operations[ccmsg_CCACHE_GET_PRINCIPAL] = ccop_CCACHE_GET_PRINCIPAL;
     TypeToOpMapping->operations[ccmsg_CCACHE_SET_PRINCIPAL] = ccop_CCACHE_SET_PRINCIPAL;
-    TypeToOpMapping->operations[ccmsg_CCACHE_CREDS_ITERATOR] = ccop_CCACHE_CREDS_ITERATOR;
+    TypeToOpMapping->operations[ccmsg_CCACHE_NEW_CREDS_ITERATOR] = ccop_CCACHE_NEW_CREDS_ITERATOR;
     TypeToOpMapping->operations[ccmsg_CCACHE_STORE_CREDS] = ccop_CCACHE_STORE_CREDS;
     TypeToOpMapping->operations[ccmsg_CCACHE_REM_CREDS] = ccop_CCACHE_REM_CREDS;
+    TypeToOpMapping->operations[ccmsg_CCACHE_MOVE] = ccop_CCACHE_MOVE;
+    TypeToOpMapping->operations[ccmsg_CCACHE_LOCK] = ccop_CCACHE_LOCK;
+    TypeToOpMapping->operations[ccmsg_CCACHE_UNLOCK] = ccop_CCACHE_UNLOCK;
     TypeToOpMapping->operations[ccmsg_CCACHE_GET_LAST_DEFAULT_TIME] = ccop_CCACHE_GET_LAST_DEFAULT_TIME;
     TypeToOpMapping->operations[ccmsg_CCACHE_GET_CHANGE_TIME] = ccop_CCACHE_GET_CHANGE_TIME;
     TypeToOpMapping->operations[ccmsg_CCACHE_COMPARE] = ccop_CCACHE_COMPARE;
@@ -107,48 +117,61 @@ cci_serv_initialize(void)
     TypeToOpMapping->operations[ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET] = ccop_CCACHE_CLEAR_KDC_TIME_OFFSET;
     TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_RELEASE] = ccop_CCACHE_ITERATOR_RELEASE;
     TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_NEXT] = ccop_CCACHE_ITERATOR_NEXT;
+    TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_CLONE] = ccop_CCACHE_ITERATOR_CLONE;
     TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_RELEASE] = ccop_CREDS_ITERATOR_RELEASE;
     TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_NEXT] = ccop_CREDS_ITERATOR_NEXT;
-    TypeToOpMapping->operations[ccmsg_CREDS_RELEASE] = ccop_CREDS_RELEASE;
+    TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_CLONE] = ccop_CREDS_ITERATOR_CLONE;
 
     return ccNoError;
 };
 
 cc_int32 
-cci_serv_process_msg(cc_msg_t * msg, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
+ccs_serv_cleanup(void) 
+{
+    return ccNoError;
+}
+
+cc_int32 
+ccs_serv_process_msg(cc_msg_t * msg, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
 {
     cc_server_context_t* ctx;
     ccmsg_ctx_only_t* header = (ccmsg_ctx_only_t *)msg->header;
+    cc_uint32 type;
+    cc_uint32 header_len;
+    cc_handle handle; 
     cc_int32 code;
 
     if (msg == NULL || msg->header == NULL || auth_info == NULL || session_info == NULL)
         return ccErrBadParam;
 
     if (AllContexts == NULL) {
-        code = cci_serv_initialize();
+        code = ccs_serv_initialize();
         if ( code != ccNoError )
             return code;
     }
        
-    if (msg->type == ccmsg_INIT) {
-        return TypeToOpMapping->operations[msg->type] (NULL, auth_info, session_info, msg, resp_msg);
+    type = msg->type;
+    if (type == ccmsg_INIT) {
+        return TypeToOpMapping->operations[type] (NULL, auth_info, session_info, msg, resp_msg);
     } else {
-        if (msg->header_len < sizeof(ccmsg_ctx_only_t)) {
+       header_len = msg->header_len;
+        if (header_len < sizeof(ccmsg_ctx_only_t)) {
             return ccErrBadParam;
         }
 
-        code = cci_serv_find_ctx_by_handle(header->ctx, auth_info, session_info, &ctx);
+       handle = ntohll(header->ctx);
+        code = ccs_serv_find_ctx_by_handle(handle, auth_info, session_info, &ctx);
         if (code != ccNoError) {
-            cci_serv_make_nack(ccErrContextNotFound, auth_info, session_info, resp_msg);
+            ccs_serv_make_nack(ccErrContextNotFound, auth_info, session_info, resp_msg);
             return code;
         }
-        return TypeToOpMapping->operations[msg->type] (ctx, auth_info, session_info, msg, resp_msg);
+        return TypeToOpMapping->operations[type] (ctx, auth_info, session_info, msg, resp_msg);
     }
 }
 
 /*deprecated*/
 cc_int32
-cci_serv_find_ctx(cc_auth_info_t* auth_info, cc_session_info_t* session_info,
+ccs_serv_find_ctx(cc_auth_info_t* auth_info, cc_session_info_t* session_info,
                   cc_server_context_t** ctxpp)
 {
     cc_context_iterate_t* ctx_iterator;
@@ -157,35 +180,35 @@ cci_serv_find_ctx(cc_auth_info_t* auth_info, cc_session_info_t* session_info,
     cc_int32 code;
     cc_uint32 authorized;
 
-    code = cci_context_list_iterator(AllContexts, &ctx_iterator);
+    code = ccs_context_list_iterator(AllContexts, &ctx_iterator);
     if (code != ccNoError)
         return code;
 
-    while (cci_context_iterate_has_next(ctx_iterator)) {
-        code = cci_context_iterate_next(ctx_iterator, &ctx_node);
+    while (ccs_context_iterate_has_next(ctx_iterator)) {
+        code = ccs_context_iterate_next(ctx_iterator, &ctx_node);
         if (code != ccNoError) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             return code;
         }
         ctx = (cc_server_context_t *)ctx_node->data;
-        code = cci_rpc_is_authorized(auth_info, session_info, ctx->auth_info, ctx->session_info, &authorized);
+        code = ccs_rpc_is_authorized(auth_info, session_info, ctx->auth_info, ctx->session_info, &authorized);
         if (code != ccNoError) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             return code;
         }
 
         if (authorized) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             *ctxpp = ctx;
             return ccNoError;
         }
     }
-    cci_context_free_iterator(ctx_iterator);
+    ccs_context_free_iterator(ctx_iterator);
     return ccIteratorEnd;
 }
 
 cc_int32
-cci_serv_find_ctx_by_handle(cc_handle ctx_num, cc_auth_info_t* auth, cc_session_info_t* session, cc_server_context_t** ctxpp) 
+ccs_serv_find_ctx_by_handle(cc_handle ctx_num, cc_auth_info_t* auth, cc_session_info_t* session, cc_server_context_t** ctxpp) 
 {
     cc_server_context_t* input_ctx = (cc_server_context_t*)ctx_num;
     cc_context_iterate_t* ctx_iterator;
@@ -194,36 +217,36 @@ cci_serv_find_ctx_by_handle(cc_handle ctx_num, cc_auth_info_t* auth, cc_session_
     cc_uint32 authorized;
     cc_int32 code;
 
-    code = cci_context_list_iterator(AllContexts, &ctx_iterator);
+    code = ccs_context_list_iterator(AllContexts, &ctx_iterator);
     if (code != ccNoError)
         return code;
 
-    while (cci_context_iterate_has_next(ctx_iterator)) {
-        code = cci_context_iterate_next(ctx_iterator, &ctx_node);
+    while (ccs_context_iterate_has_next(ctx_iterator)) {
+        code = ccs_context_iterate_next(ctx_iterator, &ctx_node);
         ctx = (cc_server_context_t *)ctx_node->data;
         if (code != ccNoError) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             return code;
         }
 
-        code = cci_rpc_is_authorized(auth, session, ctx->auth_info, ctx->session_info, &authorized);
+        code = ccs_rpc_is_authorized(auth, session, ctx->auth_info, ctx->session_info, &authorized);
         if (code != ccNoError) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             return code;
         }
 
         if (ctx == input_ctx && authorized) {
-            cci_context_free_iterator(ctx_iterator);
+            ccs_context_free_iterator(ctx_iterator);
             *ctxpp = ctx;
             return ccNoError;
         }
     }
-    cci_context_free_iterator(ctx_iterator);
+    ccs_context_free_iterator(ctx_iterator);
     return ccIteratorEnd;
 }
 
 cc_int32
-cci_serv_find_ccache_by_handle(cc_server_context_t* ctx, cc_handle ccache, cc_server_ccache_t** ccachepp ) 
+ccs_serv_find_ccache_by_handle(cc_server_context_t* ctx, cc_handle ccache, cc_server_ccache_t** ccachepp ) 
 {
     cc_ccache_iterate_t* ccache_iterator;
     cc_ccache_list_node_t* ccache_node;
@@ -231,31 +254,31 @@ cci_serv_find_ccache_by_handle(cc_server_context_t* ctx, cc_handle ccache, cc_se
     cc_server_ccache_t* target_ccache = (cc_server_ccache_t*)ccache;
     cc_int32 code;
 
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
     if (code != ccNoError)
         return code;
 
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
         if (code != ccNoError) {
-            cci_ccache_free_iterator(ccache_iterator);
+            ccs_ccache_free_iterator(ccache_iterator);
             return code;
         }
 
         stored_ccache = (cc_server_ccache_t *)ccache_node->data;
        
         if (stored_ccache == target_ccache) {
-            cci_ccache_free_iterator(ccache_iterator);
+            ccs_ccache_free_iterator(ccache_iterator);
             *ccachepp = stored_ccache;
             return ccNoError;
         }
     }
-    cci_ccache_free_iterator(ccache_iterator);
+    ccs_ccache_free_iterator(ccache_iterator);
     return ccIteratorEnd;
 }
 
 cc_int32
-cci_serv_find_ccache_iterator_by_handle(cc_server_context_t* ctx, cc_handle iterator, cc_generic_list_node_t** nodepp ) 
+ccs_serv_find_ccache_iterator_by_handle(cc_server_context_t* ctx, cc_handle iterator, cc_generic_list_node_t** nodepp ) 
 {
     cc_generic_iterate_t* gen_iterator;
     cc_generic_list_node_t* gen_node;
@@ -286,7 +309,7 @@ cci_serv_find_ccache_iterator_by_handle(cc_server_context_t* ctx, cc_handle iter
 }
 
 cc_int32
-cci_serv_find_creds_iterator_by_handle(cc_server_ccache_t* ccache, cc_handle iterator, cc_generic_list_node_t** nodepp) 
+ccs_serv_find_creds_iterator_by_handle(cc_server_ccache_t* ccache, cc_handle iterator, cc_generic_list_node_t** nodepp) 
 {
     cc_generic_iterate_t* gen_iterator;
     cc_generic_list_node_t* gen_node;
@@ -317,7 +340,7 @@ cci_serv_find_creds_iterator_by_handle(cc_server_ccache_t* ccache, cc_handle ite
 }       
 
 cc_int32 
-cci_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
+ccs_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
 {
     ccmsg_nack_t* nack_header;
     cc_int32 code;
@@ -333,7 +356,7 @@ cci_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info
         return ccErrNoMem;
     }
 
-    nack_header->err_code = err_code;;
+    nack_header->err_code = htonl(err_code);
     code = cci_msg_add_header(*resp_msg, nack_header, sizeof(ccmsg_nack_t));
     if (code != ccNoError) {
         cci_msg_destroy(*resp_msg);
@@ -345,7 +368,7 @@ cci_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info
 }
 
 cc_int32 
-cci_serv_make_ack(void * header, cc_int32 header_len, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
+ccs_serv_make_ack(void * header, cc_int32 header_len, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg) 
 {
     cc_int32 code;
 
@@ -375,54 +398,58 @@ ccop_INIT( cc_server_context_t* ctx,            /* not used */
     ccmsg_init_resp_t *resp_header;
     ccmsg_init_t *header = (ccmsg_init_t *)msg->header;
     cc_context_list_node_t* ctx_node;
+    cc_uint32 header_len, in_version;
+
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_init_t)) {
+    header_len = msg->header_len;
+    if (ctx != NULL || header_len != sizeof(ccmsg_init_t)) {
         return ccErrBadParam;
     }
 
-    code = cci_context_new(header->in_version, auth_info, session_info, &new_ctx);
+    in_version = ntohl(header->in_version);
+    code = ccs_context_new(in_version, auth_info, session_info, &new_ctx);
     if (code != ccNoError) {
         return code;
     }
 
-    code = cci_context_list_append(AllContexts, ctx, &ctx_node);
+    code = ccs_context_list_append(AllContexts, new_ctx, &ctx_node);
     if (code != ccNoError) {
-        cci_context_destroy(new_ctx);
+        ccs_context_destroy(new_ctx);
         return code;
     }
 
     resp_header = (ccmsg_init_resp_t*)malloc(sizeof(ccmsg_init_resp_t));
     if (resp_header == NULL) {
-        cci_context_destroy(new_ctx);
+        ccs_context_destroy(new_ctx);
         return ccErrNoMem;
     }
 
     code = cci_msg_new(ccmsg_ACK, resp_msg);
     if (code != ccNoError) {
         free(resp_header);
-        cci_context_destroy(new_ctx);
+        ccs_context_destroy(new_ctx);
         return code;
     }
     code = cci_msg_add_data_blob(*resp_msg, cc_vendor, strlen(cc_vendor) + 1, &blob_pos);
     if (code != ccNoError) {
         free(resp_header);
-        cci_context_destroy(new_ctx);
+        ccs_context_destroy(new_ctx);
         cci_msg_destroy(*resp_msg);
         *resp_msg = 0;
         return code;
     }
 
-    resp_header->out_ctx = new_ctx;
-    resp_header->out_version = cc_myversion;
-    resp_header->vendor_offset = blob_pos;
-    resp_header->vendor_length = strlen(cc_vendor) + 1;
+    resp_header->out_ctx = htonll((cc_handle) new_ctx);
+    resp_header->out_version = htonl(cc_myversion);
+    resp_header->vendor_offset = htonl(blob_pos);
+    resp_header->vendor_length = htonl(strlen(cc_vendor) + 1);
     code = cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_init_resp_t));
     if (code != ccNoError) {
         free(resp_header);
-        cci_context_destroy(new_ctx);
+        ccs_context_destroy(new_ctx);
         cci_msg_destroy(*resp_msg);
         *resp_msg = 0;
         return code;
@@ -438,16 +465,18 @@ ccop_CTX_RELEASE( cc_server_context_t* ctx,
                   cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     ccmsg_ctx_release_t* header = (ccmsg_ctx_release_t *)msg->header;
+    cc_uint32 header_len = msg->header_len;
+    cc_handle handle = ntohll(header->ctx);
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ctx_release_t)) {
+    if (header_len != sizeof(ccmsg_ctx_release_t)) {
         return ccErrBadParam;
     }
 
-    code = cci_context_destroy(header->ctx);
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    code = ccs_context_destroy((cc_server_context_t *)handle);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -458,10 +487,11 @@ ccop_CTX_GET_CHANGE_TIME( cc_server_context_t* ctx,
 {
     ccmsg_ctx_get_change_time_resp_t* resp_header;
     ccmsg_ctx_get_change_time_t *header = (ccmsg_ctx_get_change_time_t *)msg->header;
+    cc_uint32 header_len = msg->header_len;
 
     *resp_msg = 0;
        
-    if (msg->header_len != sizeof(ccmsg_ctx_get_change_time_t)) {
+    if (header_len != sizeof(ccmsg_ctx_get_change_time_t)) {
         return ccErrBadParam;
     }
 
@@ -470,8 +500,8 @@ ccop_CTX_GET_CHANGE_TIME( cc_server_context_t* ctx,
         return ccErrNoMem;
     }
 
-    resp_header->time = ctx->changed;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ctx_get_change_time_resp_t), auth_info, session_info, resp_msg);
+    resp_header->time = htonll(ctx->changed);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_get_change_time_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -483,15 +513,16 @@ ccop_CTX_GET_DEFAULT_CCACHE_NAME( cc_server_context_t* ctx,
     char * name;
     ccmsg_ctx_get_default_ccache_name_resp_t* resp_header;
     ccmsg_ctx_get_default_ccache_name_t* header = (ccmsg_ctx_get_default_ccache_name_t *)msg->header;
+    cc_uint32 header_len = htonl(msg->header_len);
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ctx_get_default_ccache_name_t)) {
+    if (header_len != sizeof(ccmsg_ctx_get_default_ccache_name_t)) {
         return ccErrBadParam;
     }
        
-    code = cci_context_get_default_ccache_name(ctx, &name);
+    code = ccs_context_get_default_ccache_name(ctx, &name);
     if (code != ccNoError)
         return code;
 
@@ -507,7 +538,7 @@ ccop_CTX_GET_DEFAULT_CCACHE_NAME( cc_server_context_t* ctx,
     }
 
     code = cci_msg_add_data_blob(*resp_msg, name, strlen(name) + 1, &resp_header->name_offset);
-    resp_header->name_len = strlen(name) + 1;
+    resp_header->name_len = htonl(strlen(name) + 1);
     return ccNoError;
 }
 
@@ -520,21 +551,22 @@ ccop_CTX_COMPARE(cc_server_context_t* ctx,
     cc_server_context_t *ctx2;
     ccmsg_ctx_compare_resp_t* resp_header;
     ccmsg_ctx_compare_t* header = (ccmsg_ctx_compare_t *)msg->header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ctx_compare_t))
+    if (header_len != sizeof(ccmsg_ctx_compare_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ctx_by_handle(header->ctx2, auth_info, session_info, &ctx2);
+    code = ccs_serv_find_ctx_by_handle(header->ctx2, auth_info, session_info, &ctx2);
 
     resp_header = (ccmsg_ctx_compare_resp_t*)malloc(sizeof(ccmsg_ctx_compare_resp_t));
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->is_equal = cci_context_compare(ctx, ctx2);
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ctx_compare_resp_t), auth_info, session_info, resp_msg);
+    resp_header->is_equal = htonl(ccs_context_compare(ctx, ctx2));
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_compare_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -546,22 +578,23 @@ ccop_CTX_NEW_CCACHE_ITERATOR(cc_server_context_t* ctx,
     cc_ccache_iterate_t* ccache_iterator;
     ccmsg_ctx_new_ccache_iterator_resp_t* resp_header;
     ccmsg_ctx_new_ccache_iterator_t* header = (ccmsg_ctx_new_ccache_iterator_t*)msg->header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ctx_new_ccache_iterator_t))
+    if (header_len != sizeof(ccmsg_ctx_new_ccache_iterator_t))
         return ccErrBadParam;
 
-    code = cci_context_ccache_iterator(ctx,&ccache_iterator);
+    code = ccs_context_ccache_iterator(ctx, &ccache_iterator);
 
     resp_header = (ccmsg_ctx_new_ccache_iterator_resp_t*)malloc(sizeof(ccmsg_ctx_new_ccache_iterator_resp_t));
     if (resp_header == NULL) 
         return ccErrNoMem;
 
-    resp_header->iterator = ccache_iterator;
+    resp_header->iterator = htonll((cc_handle) ccache_iterator);
 
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ctx_new_ccache_iterator_resp_t), auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_new_ccache_iterator_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32
@@ -571,7 +604,7 @@ ccop_CTX_LOCK( cc_server_context_t* ctx,
                cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 cc_int32
@@ -581,7 +614,7 @@ ccop_CTX_UNLOCK( cc_server_context_t* ctx,
                  cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 cc_int32
@@ -591,11 +624,11 @@ ccop_CTX_CLONE( cc_server_context_t* ctx,
                 cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 cc_int32 
-ccop_CCACHE_OPEN(cc_server_context_t* ctx,
+ccop_CTX_CCACHE_OPEN(cc_server_context_t* ctx,
                   cc_auth_info_t* auth_info,
                   cc_session_info_t* session_info,
                   cc_msg_t *msg, cc_msg_t **resp_msg) 
@@ -604,32 +637,33 @@ ccop_CCACHE_OPEN(cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     ccmsg_ccache_open_resp_t* resp_header;
     ccmsg_ccache_open_t* header = (ccmsg_ccache_open_t*)msg->header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_open_t))
+    if (header_len != sizeof(ccmsg_ccache_open_t))
         return ccErrBadParam;
 
-    code = cci_msg_retrieve_blob(msg, header->name_offset, header->name_len, &name);
-    code = cci_context_find_ccache(ctx, name, &ccache);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->name_offset), ntohl(header->name_len), &name);
+    code = ccs_context_find_ccache(ctx, name, &ccache);
 
     free(name);
 
     if (ccache == NULL)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_open_resp_t*)malloc(sizeof(ccmsg_ccache_open_resp_t));
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->ccache = ccache;
-    cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
+    resp_header->ccache = htonll((cc_handle) ccache);
+    ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
     return ccNoError;
 }       
 
 cc_int32 
-ccop_CCACHE_OPEN_DEFAULT(cc_server_context_t* ctx,
+ccop_CTX_CCACHE_OPEN_DEFAULT(cc_server_context_t* ctx,
                           cc_auth_info_t* auth_info,
                           cc_session_info_t* session_info,
                           cc_msg_t *msg, cc_msg_t **resp_msg) 
@@ -637,14 +671,15 @@ ccop_CCACHE_OPEN_DEFAULT(cc_server_context_t* ctx,
     ccmsg_ccache_open_default_t* header = (ccmsg_ccache_open_default_t*)msg->header;
     ccmsg_ccache_open_resp_t* resp_header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_open_default_t)) 
+    if (header_len != sizeof(ccmsg_ccache_open_default_t)) 
         return ccErrBadParam;
 
     if (ctx->ccaches->head->data == NULL)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
     
     ccache = (cc_server_ccache_t*) ctx->ccaches->head->data;
 
@@ -652,12 +687,12 @@ ccop_CCACHE_OPEN_DEFAULT(cc_server_context_t* ctx,
     if (resp_header == NULL) 
         return ccErrNoMem;
 
-    resp_header->ccache = ccache;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
+    resp_header->ccache = htonll((cc_handle) ccache);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
-ccop_CCACHE_CREATE(cc_server_context_t* ctx,
+ccop_CTX_CCACHE_CREATE(cc_server_context_t* ctx,
                     cc_auth_info_t* auth_info,
                     cc_session_info_t* session_info,
                     cc_msg_t *msg, cc_msg_t **resp_msg) 
@@ -667,24 +702,25 @@ ccop_CCACHE_CREATE(cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     char* principal;
     char* name;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_create_t)) 
+    if (header_len != sizeof(ccmsg_ccache_create_t)) 
         return ccErrBadParam;
 
-    code = cci_msg_retrieve_blob(msg, header->principal_offset, header->principal_len, &principal);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
     if (code != ccNoError) 
         return code;
-    principal[header->principal_len] = '\0'; /*Ensure null termination*/
+    principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
 
-    code = cci_msg_retrieve_blob(msg, header->name_offset, header->name_len, &name);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->name_offset), ntohl(header->name_len), &name);
     if (code != ccNoError) 
         return code;
-    name[header->name_len] = '\0'; /*Ensure null termination*/
+    name[ntohl(header->name_len)] = '\0'; /*Ensure null termination*/
 
-    code = cci_context_create_ccache(ctx, name, header->version, principal, &ccache);
+    code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
     if (code != ccNoError)
         return code;
 
@@ -692,12 +728,12 @@ ccop_CCACHE_CREATE(cc_server_context_t* ctx,
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->ccache = ccache;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
+    resp_header->ccache = htonll((cc_handle) ccache);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
 }
 
 cc_int32 
-ccop_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
+ccop_CTX_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
                             cc_auth_info_t* auth_info,
                             cc_session_info_t* session_info,
                             cc_msg_t *msg, cc_msg_t **resp_msg) 
@@ -707,23 +743,24 @@ ccop_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     char* principal;
     char* name;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_create_t)) 
+    if (header_len != sizeof(ccmsg_ccache_create_t)) 
         return ccErrBadParam;
 
-    code = cci_msg_retrieve_blob(msg, header->principal_offset, header->principal_len, &principal);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
     if (code != ccNoError) 
         return code;
-    principal[header->principal_len] = '\0'; /*Ensure null termination*/
+    principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
 
-    code = cci_context_get_default_ccache_name(ctx, &name);
+    code = ccs_context_get_default_ccache_name(ctx, &name);
     if (code != ccNoError)
         return code;
 
-    code = cci_context_create_ccache(ctx, name, header->version, principal, &ccache);
+    code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
     if (code != ccNoError)
         return code;
 
@@ -731,12 +768,12 @@ ccop_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->ccache = ccache;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
+    resp_header->ccache = htonll((cc_handle) ccache);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
 }
 
 cc_int32 
-ccop_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
+ccop_CTX_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
                            cc_auth_info_t* auth_info,
                            cc_session_info_t* session_info,
                            cc_msg_t *msg, cc_msg_t **resp_msg) 
@@ -746,21 +783,23 @@ ccop_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     char* principal;
     char* name;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_create_t)) 
+    if (header_len != sizeof(ccmsg_ccache_create_t)) 
         return ccErrBadParam;
 
-    code = cci_msg_retrieve_blob(msg, header->principal_offset, header->principal_len, &principal);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), htonl(header->principal_len), &principal);
     if (code != ccNoError) 
         return code;
-    principal[header->principal_len] = '\0'; /*Ensure null termination*/
+    principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
 
-    // TODO: Generate a unique ccache name 
+    // TODO: Generate a unique ccache name
+    name = "unique";
 
-    code = cci_context_create_ccache(ctx, name, header->version, principal, &ccache);
+    code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
     if (code != ccNoError)
         return code;
 
@@ -768,8 +807,8 @@ ccop_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->ccache = ccache;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
+    resp_header->ccache = htonll((cc_handle) ccache);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
 }
 
 cc_int32 
@@ -790,20 +829,21 @@ ccop_CCACHE_DESTROY( cc_server_context_t* ctx,
 {
     ccmsg_ccache_release_t* header = (ccmsg_ccache_release_t*)msg->header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_release_t)) 
+    if (header_len != sizeof(ccmsg_ccache_release_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    cci_ccache_destroy(ccache);
+    ccs_ccache_destroy(ccache);
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }
 
 cc_int32 
@@ -816,39 +856,40 @@ ccop_CCACHE_SET_DEFAULT(cc_server_context_t* ctx,
     ccmsg_ccache_set_default_t* header = (ccmsg_ccache_set_default_t*)msg->header;
     cc_ccache_iterate_t* ccache_iterator;
     cc_ccache_list_node_t* ccache_node;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_set_default_t))
+    if (header_len != sizeof(ccmsg_ccache_set_default_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     if (ccache == (cc_server_ccache_t*)ctx->ccaches->head->data) /*already default*/
-        return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+        return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 
     old_default = (cc_server_ccache_t*)ctx->ccaches->head->data;
     old_default->last_default = time(NULL);
 
-    code = cci_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
+    code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator,&ccache_node);
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {
+        code = ccs_ccache_iterate_next(ccache_iterator,&ccache_node);
         stored_ccache = (cc_server_ccache_t*)ccache_node->data;
 
         if (stored_ccache == ccache) {
             ccache_node->data = NULL; /*don't want list removal code free()ing ccache*/
-            cci_ccache_list_remove_element(ctx->ccaches, ccache_node);
-            cci_ccache_list_prepend(ctx->ccaches, ccache, NULL);
+            ccs_ccache_list_remove_element(ctx->ccaches, ccache_node);
+            ccs_ccache_list_prepend(ctx->ccaches, ccache, NULL);
             break;
         }
     }       
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -860,23 +901,24 @@ ccop_CCACHE_GET_CREDS_VERSION(cc_server_context_t* ctx,
     ccmsg_ccache_get_creds_version_t* header = (ccmsg_ccache_get_creds_version_t*)msg->header;
     ccmsg_ccache_get_creds_version_resp_t* resp_header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_get_creds_version_t))
+    if (header_len != sizeof(ccmsg_ccache_get_creds_version_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_get_creds_version_resp_t*)malloc(sizeof(ccmsg_ccache_get_creds_version_resp_t));       
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->version = ccache->versions;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_creds_version_resp_t), auth_info, session_info, resp_msg);
+    resp_header->version = htonl(ccache->versions);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_creds_version_resp_t), auth_info, session_info, resp_msg);
 }
 
 cc_int32 
@@ -888,16 +930,18 @@ ccop_CCACHE_GET_NAME(cc_server_context_t* ctx,
     ccmsg_ccache_get_name_t* header = (ccmsg_ccache_get_name_t*)msg->header;
     ccmsg_ccache_get_name_resp_t* resp_header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
+    cc_uint32 name_offset;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_get_name_resp_t)) 
+    if (header_len != sizeof(ccmsg_ccache_get_name_resp_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (ccache == NULL)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_get_name_resp_t*)malloc(sizeof(ccmsg_ccache_get_name_resp_t));
     if (resp_header == NULL)
@@ -907,8 +951,11 @@ ccop_CCACHE_GET_NAME(cc_server_context_t* ctx,
     if (code != ccNoError)
         return code;
 
-    code = cci_msg_add_data_blob(*resp_msg, ccache->name, strlen(ccache->name) + 1, &resp_header->name_offset);
-    resp_header->name_len = strlen(ccache->name) + 1;
+    code = cci_msg_add_data_blob(*resp_msg, ccache->name, strlen(ccache->name) + 1, &name_offset);
+    if (code == 0) {
+       resp_header->name_len = htonl(strlen(ccache->name) + 1);
+       resp_header->name_offset = htonl(name_offset);
+    }
     cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_ccache_get_name_resp_t));
 
     return ccNoError;
@@ -924,20 +971,22 @@ ccop_CCACHE_GET_PRINCIPAL(cc_server_context_t* ctx,
     ccmsg_ccache_get_principal_resp_t* resp_header;
     cc_server_ccache_t* ccache;
     char * principal;
+    cc_uint32 header_len = msg->header_len;
+    cc_uint32 principal_offset;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_get_principal_t)) 
+    if (header_len != sizeof(ccmsg_ccache_get_principal_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_ccache_get_principal(ccache, header->version, &principal);
+    code = ccs_ccache_get_principal(ccache, ntohl(header->version), &principal);
     if (code != ccNoError)
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
     code = cci_msg_new(ccmsg_ACK, resp_msg);
     if (code != ccNoError) 
@@ -947,7 +996,11 @@ ccop_CCACHE_GET_PRINCIPAL(cc_server_context_t* ctx,
     if (resp_header == NULL) 
         return ccErrNoMem;
 
-    code = cci_msg_add_data_blob(*resp_msg, principal, strlen(principal) + 1, &resp_header->principal_offset);
+    code = cci_msg_add_data_blob(*resp_msg, principal, strlen(principal) + 1, &principal_offset);
+    if (code == 0) {
+       resp_header->principal_len = htonl(strlen(principal) + 1);
+       resp_header->principal_offset = htonl(principal_offset);
+    }
     cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_ccache_get_principal_resp_t));
 
     return ccNoError;
@@ -962,50 +1015,52 @@ ccop_CCACHE_SET_PRINCIPAL(cc_server_context_t* ctx,
     ccmsg_ccache_set_principal_t* header = (ccmsg_ccache_set_principal_t*)msg->header;
     cc_server_ccache_t* ccache;
     char *principal;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_set_principal_t))
+    if (header_len != sizeof(ccmsg_ccache_set_principal_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_msg_retrieve_blob(msg, header->principal_offset, header->principal_len, &principal);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
-    code = cci_ccache_set_principal(ccache, header->version, principal);
+    code = ccs_ccache_set_principal(ccache, ntohl(header->version), principal);
     if (code != ccNoError)
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
-ccop_CCACHE_CREDS_ITERATOR(cc_server_context_t* ctx,
-                            cc_auth_info_t* auth_info,
-                            cc_session_info_t* session_info,
-                            cc_msg_t *msg, cc_msg_t **resp_msg) 
+ccop_CCACHE_NEW_CREDS_ITERATOR( cc_server_context_t* ctx,
+                               cc_auth_info_t* auth_info,
+                               cc_session_info_t* session_info,
+                               cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     cc_server_ccache_t* ccache;
     cc_credentials_iterate_t* creds_iterator;
     ccmsg_ccache_creds_iterator_t* header = (ccmsg_ccache_creds_iterator_t*)msg->header;
     ccmsg_ccache_creds_iterator_resp_t* resp_header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_creds_iterator_t)) 
+    if (header_len != sizeof(ccmsg_ccache_creds_iterator_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_ccache_new_iterator(ccache, &creds_iterator);
+    code = ccs_ccache_new_iterator(ccache, &creds_iterator);
     if (code != ccNoError)
         return code;
 
@@ -1013,13 +1068,13 @@ ccop_CCACHE_CREDS_ITERATOR(cc_server_context_t* ctx,
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->iterator = creds_iterator;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_creds_iterator_resp_t), auth_info, session_info, resp_msg);
+    resp_header->iterator = htonll((cc_handle) creds_iterator);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_creds_iterator_resp_t), auth_info, session_info, resp_msg);
 }       
 
 
 static cc_int32
-cci_credentials_union_release( cc_credentials_union * creds )
+ccs_credentials_union_release( cc_credentials_union * creds )
 {
     int i;
 
@@ -1069,24 +1124,21 @@ ccop_CCACHE_STORE_CREDS(cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     char                 *flat_creds;
     cc_credentials_union *creds;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_store_creds_t))
+    if (header_len != sizeof(ccmsg_ccache_store_creds_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    // TODO: This code is too simplistic.  cc_credential_unions are not flat
-    // structures and must be flattened.  That means that although we can 
-    // store a flat blob in the message we will need to decode the blob
-    // into the actual object.  
-    code = cci_msg_retrieve_blob(msg, header->creds_offset, header->creds_len, &flat_creds);
+    code = cci_msg_retrieve_blob(msg, ntohl(header->creds_offset), ntohl(header->creds_len), &flat_creds);
     if (code != ccNoError) 
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
     creds = (cc_credentials_union *)malloc(sizeof(cc_credentials_union));
     if ( creds == NULL )
@@ -1094,24 +1146,24 @@ ccop_CCACHE_STORE_CREDS(cc_server_context_t* ctx,
 
     switch ( creds->version ) {        
     case cc_credentials_v4:
-        code = cci_creds_v4_unmarshall(flat_creds, header->creds_len, creds);
+        code = cci_creds_v4_unmarshall(flat_creds, ntohl(header->creds_len), creds);
         break;                                 
     case cc_credentials_v5:
-        code = cci_creds_v5_unmarshall(flat_creds, header->creds_len, creds);
+        code = cci_creds_v5_unmarshall(flat_creds, ntohl(header->creds_len), creds);
         break;
     default:
-        return cci_serv_make_nack(ccErrBadCredentialsVersion, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadCredentialsVersion, auth_info, session_info, resp_msg);
     }
     if (code != ccNoError)
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
-    code = cci_ccache_store_creds(ccache, creds);
-    cci_credentials_union_release(creds);
+    code = ccs_ccache_store_creds(ccache, creds);
+    ccs_credentials_union_release(creds);
     if (code != ccNoError) {
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
     }
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1123,21 +1175,22 @@ ccop_CCACHE_REM_CREDS(cc_server_context_t* ctx,
     ccmsg_ccache_rem_creds_t* header = (ccmsg_ccache_rem_creds_t*)msg->header;
     cc_server_ccache_t* ccache;
     cc_credentials_union *creds;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
-    if (msg->header_len != sizeof(ccmsg_ccache_rem_creds_t))
+    if (header_len != sizeof(ccmsg_ccache_rem_creds_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_ccache_rem_creds(ccache, header->creds);
+    code = ccs_ccache_rem_creds(ccache, (const cc_credentials_union *)(ntohll(header->creds)));
     if (code != ccNoError)
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }               
 
 cc_int32
@@ -1147,7 +1200,7 @@ ccop_CCACHE_LOCK( cc_server_context_t* ctx,
                   cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 cc_int32
@@ -1157,7 +1210,7 @@ ccop_CCACHE_UNLOCK( cc_server_context_t* ctx,
                     cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 cc_int32
@@ -1167,7 +1220,7 @@ ccop_CCACHE_MOVE( cc_server_context_t* ctx,
                   cc_msg_t *msg, cc_msg_t **resp_msg) 
 {
     // TODO
-    return cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
 }
 
 
@@ -1180,23 +1233,24 @@ ccop_CCACHE_GET_LAST_DEFAULT_TIME(cc_server_context_t* ctx,
     ccmsg_ccache_get_last_default_time_t* header = (ccmsg_ccache_get_last_default_time_t*)msg->header;
     ccmsg_ccache_get_last_default_time_resp_t* resp_header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_get_last_default_time_t))
+    if (header_len != sizeof(ccmsg_ccache_get_last_default_time_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_get_last_default_time_resp_t*)malloc(sizeof(ccmsg_ccache_get_last_default_time_resp_t));
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->last_default_time = ccache->last_default;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_last_default_time_resp_t), auth_info, session_info, resp_msg);
+    resp_header->last_default_time = htonll(ccache->last_default);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_last_default_time_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1208,10 +1262,11 @@ ccop_CCACHE_GET_CHANGE_TIME( cc_server_context_t* ctx,
     ccmsg_ccache_get_change_time_resp_t* resp_header;
     ccmsg_ccache_get_change_time_t *header = (ccmsg_ccache_get_change_time_t *)msg->header;
     cc_server_ccache_t* ccache = (cc_server_ccache_t *)header->ccache;
+    cc_uint32 header_len = msg->header_len;
 
     *resp_msg = 0;
        
-    if (msg->header_len != sizeof(ccmsg_ccache_get_change_time_t)) {
+    if (header_len != sizeof(ccmsg_ccache_get_change_time_t)) {
         return ccErrBadParam;
     }
 
@@ -1220,8 +1275,8 @@ ccop_CCACHE_GET_CHANGE_TIME( cc_server_context_t* ctx,
         return ccErrNoMem;
     }
 
-    resp_header->time = ccache->changed;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_change_time_resp_t), auth_info, session_info, resp_msg);
+    resp_header->time = htonll(ccache->changed);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_change_time_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1233,27 +1288,30 @@ ccop_CCACHE_COMPARE(cc_server_context_t* ctx,
     ccmsg_ccache_compare_t* header = (ccmsg_ccache_compare_t*)msg->header;
     ccmsg_ccache_compare_resp_t* resp_header;
     cc_server_ccache_t* ccache1, *ccache2;
+    cc_uint32 header_len = msg->header_len;
+    cc_uint32 is_equal;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_compare_t))
+    if (header_len != sizeof(ccmsg_ccache_compare_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache1, &ccache1);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache1), &ccache1);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache2, &ccache2);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache2), &ccache2);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_compare_resp_t*)malloc(sizeof(ccmsg_ccache_compare_resp_t));   
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    cci_ccache_compare(ccache1, ccache2, &resp_header->is_equal);
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_compare_resp_t), auth_info, session_info, resp_msg);
+    ccs_ccache_compare(ccache1, ccache2, &is_equal);
+    resp_header->is_equal = htonl(is_equal);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_compare_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1265,30 +1323,31 @@ ccop_CCACHE_GET_KDC_TIME_OFFSET(cc_server_context_t* ctx,
     ccmsg_ccache_get_kdc_time_offset_t* header = (ccmsg_ccache_get_kdc_time_offset_t*)msg->header;
     ccmsg_ccache_get_kdc_time_offset_resp_t* resp_header;
     cc_server_ccache_t* ccache;
-    cc_time_t offset;
+    cc_time64 offset;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_get_kdc_time_offset_t))
+    if (header_len != sizeof(ccmsg_ccache_get_kdc_time_offset_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     // TODO How is the header->creds_version supposed to be used?
 
-    code = cci_ccache_get_kdc_time_offset(ccache, &offset);
+    code = ccs_ccache_get_kdc_time_offset(ccache, &offset);
     if (code != ccNoError)
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
     resp_header = (ccmsg_ccache_get_kdc_time_offset_resp_t*)malloc(sizeof(ccmsg_ccache_get_kdc_time_offset_resp_t));
     if (resp_header == NULL)
         return ccErrNoMem;
 
-    resp_header->offset = offset;
-    return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_kdc_time_offset_resp_t), auth_info, session_info, resp_msg);
+    resp_header->offset = htonll(offset);
+    return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_kdc_time_offset_resp_t), auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1299,21 +1358,22 @@ ccop_CCACHE_SET_KDC_TIME_OFFSET(cc_server_context_t* ctx,
 {
     ccmsg_ccache_set_kdc_time_offset_t* header = (ccmsg_ccache_set_kdc_time_offset_t*)msg->header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_set_kdc_time_offset_t))
+    if (header_len != sizeof(ccmsg_ccache_set_kdc_time_offset_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     // TODO How is the header->creds_version supposed to be used?
 
-    cci_ccache_set_kdc_time_offset(ccache, header->offset);
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    ccs_ccache_set_kdc_time_offset(ccache, htonll(header->offset));
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
 cc_int32 
@@ -1324,21 +1384,22 @@ ccop_CCACHE_CLEAR_KDC_TIME_OFFSET(cc_server_context_t* ctx,
 {
     ccmsg_ccache_clear_kdc_time_offset_t* header = (ccmsg_ccache_clear_kdc_time_offset_t*)msg->header;
     cc_server_ccache_t* ccache;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_clear_kdc_time_offset_t))
+    if (header_len != sizeof(ccmsg_ccache_clear_kdc_time_offset_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
     // TODO How is the header->creds_version supposed to be used?
 
-    cci_ccache_clear_kdc_time_offset(ccache);
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    ccs_ccache_clear_kdc_time_offset(ccache);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }               
 
 cc_int32 
@@ -1349,24 +1410,35 @@ ccop_CCACHE_ITERATOR_RELEASE(cc_server_context_t* ctx,
 {
     cc_generic_list_node_t* gen_node;
     ccmsg_ccache_iterator_release_t* header = (ccmsg_ccache_iterator_release_t*)msg->header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_iterator_release_t)) 
+    if (header_len != sizeof(ccmsg_ccache_iterator_release_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_iterator_by_handle(ctx, header->iterator, &gen_node);
+    code = ccs_serv_find_ccache_iterator_by_handle(ctx, ntohll(header->iterator), &gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
     code = cci_generic_list_remove_element(ctx->active_iterators, gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
+cc_int32
+ccop_CCACHE_ITERATOR_CLONE( cc_server_context_t* ctx,
+                cc_auth_info_t* auth_info,
+                cc_session_info_t* session_info,
+                cc_msg_t *msg, cc_msg_t **resp_msg) 
+{
+    // TODO
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+}
+
 cc_int32 
 ccop_CCACHE_ITERATOR_NEXT(cc_server_context_t* ctx,
                            cc_auth_info_t* auth_info,
@@ -1377,32 +1449,33 @@ ccop_CCACHE_ITERATOR_NEXT(cc_server_context_t* ctx,
     ccmsg_ccache_iterator_next_resp_t* resp_header;
     cc_generic_list_node_t* gen_node;
     cc_ccache_iterate_t* ccache_iterator;
-       cc_ccache_list_node_t *ccache_node;
+    cc_ccache_list_node_t *ccache_node;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_ccache_iterator_next_t)) 
+    if (header_len != sizeof(ccmsg_ccache_iterator_next_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_iterator_by_handle(ctx, header->iterator, &gen_node);
+    code = ccs_serv_find_ccache_iterator_by_handle(ctx, ntohll(header->iterator), &gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
     ccache_iterator = (cc_ccache_iterate_t*)gen_node->data;
-    if (cci_ccache_iterate_has_next(ccache_iterator)) {
+    if (ccs_ccache_iterate_has_next(ccache_iterator)) {
         resp_header = (ccmsg_ccache_iterator_next_resp_t*)malloc(sizeof(ccmsg_ccache_iterator_next_resp_t));
         if (resp_header == NULL)
             return ccErrNoMem;
 
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
         if (code != ccNoError) 
-            return cci_serv_make_nack(code, auth_info, session_info, resp_msg);
+            return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
 
-               resp_header->ccache = ccache_node;
-        return cci_serv_make_ack(resp_header, sizeof(ccmsg_ccache_iterator_next_resp_t), auth_info, session_info, resp_msg);
+       resp_header->ccache = htonll((cc_handle) ccache_node);
+        return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_iterator_next_resp_t), auth_info, session_info, resp_msg);
     } else {
-        return cci_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
     }
 }       
 
@@ -1415,28 +1488,40 @@ ccop_CREDS_ITERATOR_RELEASE(cc_server_context_t* ctx,
     cc_generic_list_node_t* gen_node;
     cc_server_ccache_t* ccache;
     ccmsg_creds_iterator_release_t* header = (ccmsg_creds_iterator_release_t*)msg->header;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_creds_iterator_release_t)) 
+    if (header_len != sizeof(ccmsg_creds_iterator_release_t)) 
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_serv_find_creds_iterator_by_handle(ccache, header->iterator, &gen_node);
+    code = ccs_serv_find_creds_iterator_by_handle(ccache, ntohll(header->iterator), &gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
     code = cci_generic_list_remove_element(ccache->active_iterators, gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
-    return cci_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
+    return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
 }       
 
+cc_int32
+ccop_CREDS_ITERATOR_CLONE( cc_server_context_t* ctx,
+                cc_auth_info_t* auth_info,
+                cc_session_info_t* session_info,
+                cc_msg_t *msg, cc_msg_t **resp_msg) 
+{
+    // TODO
+    return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+}
+
+
 cc_int32 
 ccop_CREDS_ITERATOR_NEXT(cc_server_context_t* ctx,
                           cc_auth_info_t* auth_info,
@@ -1451,23 +1536,24 @@ ccop_CREDS_ITERATOR_NEXT(cc_server_context_t* ctx,
     cc_server_ccache_t* ccache;
     cc_server_credentials_t* stored_creds;
     cc_credentials_union *creds_union;
+    cc_uint32 header_len = msg->header_len;
     cc_int32 code;
 
     *resp_msg = 0;
 
-    if (msg->header_len != sizeof(ccmsg_creds_iterator_next_t))
+    if (header_len != sizeof(ccmsg_creds_iterator_next_t))
         return ccErrBadParam;
 
-    code = cci_serv_find_ccache_by_handle(ctx, header->ccache, &ccache);
+    code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
     if (code != ccNoError)
-        return cci_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
 
-    code = cci_serv_find_creds_iterator_by_handle(ccache, header->iterator, &gen_node);
+    code = ccs_serv_find_creds_iterator_by_handle(ccache, ntohll(header->iterator), &gen_node);
     if (code != ccNoError) 
-        return cci_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
+        return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
 
     creds_iterator = (cc_credentials_iterate_t*)gen_node->data;
-    if (cci_credentials_iterate_has_next(creds_iterator)) {
+    if (ccs_credentials_iterate_has_next(creds_iterator)) {
         code = cci_msg_new(ccmsg_ACK, resp_msg);
         if (code != ccNoError)
             return code;
@@ -1476,14 +1562,14 @@ ccop_CREDS_ITERATOR_NEXT(cc_server_context_t* ctx,
         if (resp_header == NULL)
             return ccErrNoMem;
 
-        code = cci_credentials_iterate_next(creds_iterator, &creds_node);
+        code = ccs_credentials_iterate_next(creds_iterator, &creds_node);
         stored_creds = (cc_server_credentials_t*)creds_node->data;
         creds_union = &stored_creds->creds;
 
         code = cci_msg_add_data_blob(*resp_msg, creds_union, sizeof(cc_credentials_union), &resp_header->creds_offset);
         code = cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_creds_iterator_next_resp_t));
     } else {
-        cci_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
+        ccs_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
     }
     return ccNoError;
 }       
@@ -1495,6 +1581,6 @@ ccop_CREDS_RELEASE( cc_server_context_t* ctx,
                     cc_msg_t *msg, cc_msg_t **resp_msg) 
 {       
         
-    cci_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
+    ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
     return ccNoError;
 }       
diff --git a/src/lib/ccapi/server/serv_ops.h b/src/lib/ccapi/server/serv_ops.h
deleted file mode 100644 (file)
index f439566..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/* $Copyright:
- *
- * Copyright 2004 by the Massachusetts Institute of Technology.
- * 
- * All rights reserved.
- * 
- * Export of this software from the United States of America may require a
- * specific license from the United States Government.  It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- * 
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
- * this software and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of M.I.T. not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  Furthermore if you
- * modify this software you must label your software as modified software
- * and not distribute it in such a fashion that it might be confused with
- * the original MIT software. M.I.T. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * 
- * Individual source code files are copyright MIT, Cygnus Support,
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
- * 
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
- * and Zephyr are trademarks of the Massachusetts Institute of Technology
- * (MIT).  No commercial use of these trademarks may be made without prior
- * written permission of MIT.
- * 
- * "Commercial use" means use of a name in a product or other for-profit
- * manner.  It does NOT prevent a commercial firm from referring to the MIT
- * trademarks in order to convey information (although in doing so,
- * recognition of their trademark status should be given).
- * $
- */
-
-/*
- * Prototypes for serv_ops.c
- */
-
-#ifndef __SERV_OPS_H__
-#define __SERV_OPS_H__
-
-#include "CredentialsCache.h"
-#include "rpc_auth.h"
-#include "msg.h"
-#include "datastore.h"
-
-struct type_to_op_mapping_t {
-    cc_int32 (*operations[CC_MSG_MAX_TYPE]) (
-                        cc_server_context_t* ctx,
-                       cc_auth_info_t* auth_info,
-                       cc_session_info_t* session_info,
-                       cc_msg_t *msg,
-                        cc_msg_t **resp_msg);
-};
-typedef struct type_to_op_mapping_t type_to_op_mapping_t;
-
-cc_int32 cci_serv_initialize(void);
-cc_int32 cci_serv_process_msg(cc_msg_t * msg, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg);
-cc_int32 cci_serv_find_ctx(cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_server_context_t** contextp);
-cc_int32 cci_serv_find_ctx_by_handle(cc_handle ctx_handle, cc_auth_info_t *auth, cc_session_info_t* session, cc_server_context_t** contextp);
-cc_int32 cci_serv_find_ccache_by_handle(cc_server_context_t* ctx, cc_handle ccache_handle, cc_server_ccache_t** ccachep) ;
-cc_int32 cci_serv_find_ccache_iterator_by_handle(cc_server_context_t* ctx, cc_handle iterator, cc_generic_list_node_t** nodep);
-cc_int32 cci_serv_find_creds_iterator_by_handle(cc_server_ccache_t* ccache, cc_handle iterator, cc_generic_list_node_t** nodep);
-cc_int32 cci_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** msgp);
-cc_int32 cci_serv_make_ack(void * header, cc_int32 header_len, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** msgp);
-
-cc_int32 ccop_INIT( 
-        cc_server_context_t* ctx,
-        cc_auth_info_t* auth_info,
-        cc_session_info_t* session_info,
-        cc_msg_t *msg,
-        cc_msg_t **resp_msg);
-
-cc_int32 ccop_CTX_RELEASE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CTX_GET_CHANGE_TIME(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CTX_GET_DEFAULT_CCACHE_NAME(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CTX_COMPARE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CTX_NEW_CCACHE_ITERATOR(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32
-ccop_CTX_LOCK( cc_server_context_t* ctx,
-               cc_auth_info_t* auth_info,
-               cc_session_info_t* session_info,
-               cc_msg_t *msg, 
-               cc_msg_t **resp_msg);
-
-cc_int32
-ccop_CTX_UNLOCK( cc_server_context_t* ctx,
-                 cc_auth_info_t* auth_info,
-                 cc_session_info_t* session_info,
-                 cc_msg_t *msg, 
-                 cc_msg_t **resp_msg);
-
-cc_int32
-ccop_CTX_CLONE( cc_server_context_t* ctx,
-                cc_auth_info_t* auth_info,
-                cc_session_info_t* session_info,
-                cc_msg_t *msg, 
-                cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_OPEN(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_OPEN_DEFAULT(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_CREATE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 
-ccop_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
-                            cc_auth_info_t* auth_info,
-                            cc_session_info_t* session_info,
-                            cc_msg_t *msg, 
-                            cc_msg_t **resp_msg);
-
-cc_int32 
-ccop_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
-                           cc_auth_info_t* auth_info,
-                           cc_session_info_t* session_info,
-                           cc_msg_t *msg, 
-                           cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_RELEASE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_DESTROY(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_SET_DEFAULT(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_GET_CREDS_VERSION(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_GET_NAME(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_GET_PRINCIPAL(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_SET_PRINCIPAL(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_CREDS_ITERATOR(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_STORE_CREDS(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_REM_CREDS(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_GET_LAST_DEFAULT_TIME(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 
-ccop_CCACHE_GET_CHANGE_TIME( 
-        cc_server_context_t* ctx,
-        cc_auth_info_t* auth_info,
-        cc_session_info_t* session_info,
-        cc_msg_t *msg, 
-        cc_msg_t **resp_msg) ;
-
-cc_int32 ccop_CCACHE_COMPARE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_GET_KDC_TIME_OFFSET(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_SET_KDC_TIME_OFFSET(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_CLEAR_KDC_TIME_OFFSET(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_ITERATOR_RELEASE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CCACHE_ITERATOR_NEXT(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CREDS_ITERATOR_RELEASE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CREDS_ITERATOR_NEXT(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-
-cc_int32 ccop_CREDS_RELEASE(
-       cc_server_context_t* ctx,
-       cc_auth_info_t* auth_info,
-       cc_session_info_t* session_info,
-       cc_msg_t *msg,
-       cc_msg_t **resp_msg);
-#endif /*__SERV_OPS_H__*/
diff --git a/src/lib/ccapi/unit-test/NTMakefile b/src/lib/ccapi/unit-test/NTMakefile
new file mode 100644 (file)
index 0000000..73f53f2
--- /dev/null
@@ -0,0 +1,53 @@
+!include <win32.mak>\r
+\r
+CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
+\r
+WINLIBS = ws2_32.lib rpcrt4.lib $(guilibsdll)\r
+\r
+T_CCACHE = t_ccache.exe\r
+\r
+T_CONTEXT = t_context.exe\r
+\r
+T_LISTS = t_lists.exe\r
+\r
+T_MSG = t_msg.exe\r
+\r
+T_SERVER = t_server.exe\r
+\r
+T_CCAPI = t_ccapi.exe\r
+\r
+all:  $(T_CCAPI) $(T_CCACHE) $(T_CONTEXT) $(T_LISTS) $(T_MSG) $(T_SERVER)\r
+\r
+ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf\r
+       midl ntccrpc.idl /acf ntccrpc.acf\r
+\r
+CC_CLIENT_LIB = ..\client\cc_client.lib\r
+\r
+CC_COMMON_LIB = ..\common\cc_common.lib\r
+\r
+CC_SERVER_LIB = ..\server\cc_server.lib\r
+\r
+CC_API_LIB = ..\windows\krbcc32.lib\r
+\r
+$(T_CCACHE): t_ccache.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+$(T_CONTEXT): t_context.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+$(T_LISTS): t_lists.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+$(T_MSG): t_msg.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+$(T_SERVER): t_server.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+$(T_CCAPI): t_ccapi.obj $(CC_API_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+clean:\r
+       del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h\r
+\r
+\r
index 6ef33ea23df5c7fec5b6e8225867f140b15beeee..175764e798a9f9dd86f73fc8dbd338f493a762ac 100644 (file)
@@ -59,8 +59,8 @@ int main() {
     int i;
     cc_int32 code;
 
-    code = cci_ccache_new("The first", p1, cc_credentials_v4_v5, &c1);
-    code = cci_ccache_new("The 2nd", p2, cc_credentials_v4_v5, &c2);
+    code = ccs_ccache_new("The first", p1, cc_credentials_v4_v5, &c1);
+    code = ccs_ccache_new("The 2nd", p2, cc_credentials_v4_v5, &c2);
 
     cred1 = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));
     memset(cred1,0,sizeof(cc_server_credentials_t));
@@ -83,30 +83,30 @@ int main() {
     strncpy(cred2->creds.credentials.credentials_v4->principal, p1, strlen(p1));
     cred3->creds.credentials.credentials_v5->client = p1;
 
-    code = cci_ccache_store_creds(c1, &cred1->creds);
+    code = ccs_ccache_store_creds(c1, &cred1->creds);
     printf("(c1, cred1) -> %d\n",code);
 
-    code = cci_ccache_store_creds(c1, &cred2->creds);
+    code = ccs_ccache_store_creds(c1, &cred2->creds);
     printf("(c1, cred2) -> %d\n",code);
 
-    code = cci_ccache_store_creds(c2, &cred3->creds);
+    code = ccs_ccache_store_creds(c2, &cred3->creds);
     printf("(c2, cred3) -> %d\n",code);
 
-    code = cci_ccache_store_creds(c1, &cred3->creds);
+    code = ccs_ccache_store_creds(c1, &cred3->creds);
     printf("(c1, cred3) -> %d\n",code);
 
     i = 0;
-    code = cci_ccache_move(c1, c2);
-    code = cci_ccache_destroy(c1);
-    code = cci_ccache_new_iterator(c2, &iterator);
-    while (cci_credentials_iterate_has_next(iterator)) {
+    code = ccs_ccache_move(c1, c2);
+    code = ccs_ccache_destroy(c1);
+    code = ccs_ccache_new_iterator(c2, &iterator);
+    while (ccs_credentials_iterate_has_next(iterator)) {
         i++;
-        code = cci_credentials_iterate_next(iterator, &node);
+        code = ccs_credentials_iterate_next(iterator, &node);
         stored_cred = (cc_server_credentials_t *)node->data;
         printf("%d %d %s\n", stored_cred->is_default, stored_cred->creds.version, stored_cred->creds.credentials.credentials_v4->principal);
 
         if (i == 1) {
-            code = cci_ccache_rem_creds(c2,&cred2->creds);
+            code = ccs_ccache_rem_creds(c2,&cred2->creds);
             printf("(c2 rem cred2) -> %d\n",code);
         }
     }
index 9e35d9abf3a4d23f994352760ba1845d9d155d02..d76ff78d9a9d1fbda9f919179d3d3cfca8a4bd22 100644 (file)
@@ -68,10 +68,10 @@ int main() {
     int i;
     cc_int32 code;
 
-    code = cci_context_new(5, auth_info, session_info, &ctx);
-    code = cci_context_create_default_ccache(ctx, cc_credentials_v4, "Spike", &ccache);
-    code = cci_context_get_default_ccache_name(ctx, &name);
-    code = cci_context_open_ccache(ctx, name, &ccache);
+    code = ccs_context_new(5, auth_info, session_info, &ctx);
+    code = ccs_context_create_default_ccache(ctx, cc_credentials_v4, "Spike", &ccache);
+    code = ccs_context_get_default_ccache_name(ctx, &name);
+    code = ccs_context_open_ccache(ctx, name, &ccache);
        
     for (i = 0; i < 5; i++) {
         creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union));
@@ -79,32 +79,32 @@ int main() {
         creds->credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
         strcpy(creds->credentials.credentials_v4->principal, "Spike");
 
-        code = cci_ccache_store_creds(ccache, creds);
+        code = ccs_ccache_store_creds(ccache, creds);
     }
 
-    code = cci_context_create_ccache(ctx, "ccache 2", cc_credentials_v4, "Jeff", &ccache);
-    code = cci_context_open_ccache(ctx, "ccache 2", &ccache);
+    code = ccs_context_create_ccache(ctx, "ccache 2", cc_credentials_v4_v5, "Jeff", &ccache);
+    code = ccs_context_open_ccache(ctx, "ccache 2", &ccache);
        
     for (i = 0; i < 5; i++) {
         creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union));
-        creds->version = cc_credentials_v4;
-        creds->credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
-        strcpy(creds->credentials.credentials_v4->principal, "Jeff");
+        creds->version = cc_credentials_v5;
+        creds->credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));
+        strcpy(creds->credentials.credentials_v5->principal, "Jeff");
 
-        cci_ccache_store_creds(ccache, creds);
+        ccs_ccache_store_creds(ccache, creds);
     }
 
-    code = cci_context_ccache_iterator(ctx, &ccache_iterator);
-    while (cci_ccache_iterate_has_next(ccache_iterator)) {
-        code = cci_ccache_iterate_next(ccache_iterator, &ccache_node);
+    code = ccs_context_ccache_iterator(ctx, &ccache_iterator);
+    while (ccs_ccache_iterate_has_next(ccache_iterator)) {
+        code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
         ccache = (cc_server_ccache_t *)ccache_node->data;
         printf("%x for %s %s default = %d v %d\n",
                ccache, ccache->principal_v4, ccache->principal_v5, 
                ccache->is_default, ccache->versions);
 
-        code = cci_ccache_new_iterator(ccache, &creds_iterator);
-        while (cci_credentials_iterate_has_next(creds_iterator)) {
-            code = cci_credentials_iterate_next(creds_iterator, &creds_node);
+        code = ccs_ccache_new_iterator(ccache, &creds_iterator);
+        while (ccs_credentials_iterate_has_next(creds_iterator)) {
+            code = ccs_credentials_iterate_next(creds_iterator, &creds_node);
             server_creds = (cc_server_credentials_t *)creds_node->data;        
             printf("\t%s %d\n", 
                    server_creds->creds.credentials.credentials_v4->principal, 
index d4d9984661f6f2a5565f80d15ca60fb1623868e2..d6093941ef5eb3125cbd2ed1f646b399d557de63 100644 (file)
@@ -143,7 +143,7 @@ main(void)
     cc_session_info_t * session_info;
     cc_int32            code;
 
-    if ( cci_serv_initialize() != ccNoError )
+    if ( ccs_serv_initialize() != ccNoError )
         return 1;
 
     while ( 1 ) {
@@ -163,7 +163,7 @@ main(void)
         code = obtain_session_info(&session_info);
 
         /* process message */
-        code = cci_serv_process_msg(msg, auth_info, session_info, &resp);
+        code = ccs_serv_process_msg(msg, auth_info, session_info, &resp);
 
         /* flatten response */
         code = cci_msg_flatten(resp, NULL);
diff --git a/src/lib/ccapi/windows/NTMakefile b/src/lib/ccapi/windows/NTMakefile
new file mode 100644 (file)
index 0000000..f6fee6f
--- /dev/null
@@ -0,0 +1,35 @@
+!include <win32.mak>\r
+\r
+CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
+\r
+CCAPI_SERVER = ccapi_server.exe\r
+\r
+CCAPI_DLLFILE = krbcc32.dll\r
+\r
+WINLIBS = ws2_32.lib rpcrt4.lib $(guilibsdll)\r
+\r
+all:  $(CCAPI_DLLFILE) $(CCAPI_SERVER)\r
+\r
+ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf\r
+       midl ntccrpc.idl /acf ntccrpc.acf\r
+\r
+CLIENT_OBJS = ntccrpc_c.obj client.obj dllmain.obj\r
+\r
+SERVER_OBJS = ntccrpc_s.obj server.obj\r
+\r
+CC_CLIENT_LIB = ..\client\cc_client.lib\r
+\r
+CC_COMMON_LIB = ..\common\cc_common.lib\r
+\r
+CC_SERVER_LIB = ..\server\cc_server.lib\r
+\r
+$(CCAPI_DLLFILE): $(CLIENT_OBJS) $(CC_CLIENT_LIB) $(CC_COMMON_LIB)\r
+        $(link) /NOLOGO /OUT:$@ $(ldebug) $(dlllflags) $(guilibsmt) -def:cacheapi.def $** $(WINLIBS)\r
+\r
+$(CCAPI_SERVER): $(SERVER_OBJS) $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
+       $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
+\r
+clean:\r
+       del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h\r
+\r
+\r
diff --git a/src/lib/ccapi/windows/cacheapi.def b/src/lib/ccapi/windows/cacheapi.def
new file mode 100644 (file)
index 0000000..c54cc11
--- /dev/null
@@ -0,0 +1,29 @@
+EXPORTS\r
+       ; ccapi v3 only exports one function\r
+        cc_initialize                  @14\r
+\r
+       ; ccapi v2 compatibility functions\r
+        cc_close                       @2\r
+        cc_create                      @3\r
+        cc_destroy                     @4\r
+        cc_free_NC_info                        @5\r
+        cc_free_creds                  @6\r
+        cc_free_name                   @7\r
+        cc_free_principal              @8\r
+        cc_get_NC_info                 @9\r
+        cc_get_change_time             @10\r
+        cc_get_cred_version            @11\r
+        cc_get_name                    @12\r
+        cc_get_principal               @13\r
+        cc_lock_request                        @15\r
+        cc_open                                @16\r
+        cc_remove_cred                 @17\r
+        cc_seq_fetch_NCs_begin         @18\r
+        cc_seq_fetch_NCs_end           @19\r
+        cc_seq_fetch_NCs_next          @20\r
+        cc_seq_fetch_creds_begin       @21\r
+        cc_seq_fetch_creds_end         @22\r
+        cc_seq_fetch_creds_next                @23\r
+        cc_set_principal               @24\r
+        cc_shutdown                    @25\r
+        cc_store                       @26\r
diff --git a/src/lib/ccapi/windows/client.c b/src/lib/ccapi/windows/client.c
new file mode 100644 (file)
index 0000000..e30801d
--- /dev/null
@@ -0,0 +1,141 @@
+#include <windows.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <tchar.h>\r
+#include "ntccrpc.h"\r
+#include <strsafe.h>\r
+#include "CredentialsCache.h"\r
+#include "msg.h"\r
+\r
+static RPC_BINDING_HANDLE hRpcBinding;\r
+\r
+void * __RPC_USER MIDL_user_allocate(size_t s) {\r
+    return malloc(s);\r
+}\r
+\r
+void __RPC_USER MIDL_user_free(void * p) {\r
+    free(p);\r
+}\r
+\r
+int cc_rpc_init(void) {\r
+    RPC_STATUS status;\r
+    TCHAR * bindstring = NULL;\r
+    RPC_SECURITY_QOS sqos;\r
+\r
+    status = RpcStringBindingCompose(NULL,\r
+                                     _T("ncalrpc"),\r
+                                     NULL,\r
+                                     NULL,\r
+                                     NULL,\r
+                                     &bindstring);\r
+\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcStringBindingCompose failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    status = RpcBindingFromStringBinding(bindstring,\r
+                                         &hRpcBinding);\r
+\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcBindingFromStringBinding failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    status = RpcStringFree(&bindstring);\r
+\r
+    ZeroMemory(&sqos, sizeof(sqos));\r
+\r
+    sqos.Version = 1;\r
+    sqos.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;\r
+    sqos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;\r
+    sqos.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;\r
+\r
+    status = RpcBindingSetAuthInfoEx(hRpcBinding,\r
+                                     NULL,\r
+                                     RPC_C_AUTHN_LEVEL_CALL,\r
+                                     RPC_C_AUTHN_WINNT,\r
+                                     NULL,\r
+                                     0,\r
+                                     &sqos);\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcBindingSetAuthInfoEx failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    return 0;\r
+}\r
+\r
+int cc_rpc_cleanup(void) {\r
+    RPC_STATUS status;\r
+\r
+    status = RpcBindingFree(&hRpcBinding);\r
+\r
+    return 0;\r
+}\r
+\r
+cc_int32 cci_set_thread_session_id(unsigned char * client_name, LUID luid) {\r
+    return 0;\r
+}\r
+\r
+void cci_get_thread_session_id(unsigned char * client_name, int len, LUID *pluid) {\r
+    client_name[0] = '\0';\r
+    pluid->HighPart = 0;\r
+    pluid->LowPart = 0;\r
+}\r
+\r
+\r
+/* __int32 ccapi_Message(\r
+ * [in] handle_t h,\r
+ * [string][in] unsigned char *client_name,\r
+ * [in] struct _LUID luid,\r
+ * [in] __int32 cb_buffer,\r
+ * [out] __int32 *cb_len,\r
+ * [size_is][string][out] unsigned char buffer[  ]);\r
+ */\r
+\r
+cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response)\r
+{\r
+    cc_int32 code;\r
+    unsigned char client_name[256];\r
+    LUID luid;\r
+    struct __LUID __luid;\r
+    unsigned char out_buf[MAXMSGLEN];\r
+    __int32  out_len = MAXMSGLEN;\r
+\r
+    if (cc_rpc_init())\r
+       return -1;\r
+\r
+    cci_get_thread_session_id(client_name, sizeof(client_name), &luid);\r
+\r
+    __luid.HighPart = luid.HighPart;\r
+    __luid.LowPart  = luid.LowPart;\r
+\r
+    /* flatten response */\r
+    code = cci_msg_flatten(request, NULL);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    RpcTryExcept {\r
+       code = ccapi_Message(hRpcBinding, client_name, __luid, \r
+                            request->flat, request->flat_len, \r
+                            out_buf, &out_len);\r
+    } \r
+    RpcExcept(1) {\r
+       code = RpcExceptionCode();\r
+    }\r
+    RpcEndExcept;\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* unflatten message */\r
+    code = cci_msg_unflatten(out_buf, out_len, response);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+  cleanup:\r
+    return code;\r
+}\r
diff --git a/src/lib/ccapi/windows/dllmain.c b/src/lib/ccapi/windows/dllmain.c
new file mode 100644 (file)
index 0000000..6b4d6bf
--- /dev/null
@@ -0,0 +1,15 @@
+#include <windows.h>\r
+\r
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, \r
+                   LPVOID lpvReserved)\r
+{\r
+    switch (fdwReason) {\r
+    case DLL_PROCESS_ATTACH:\r
+    case DLL_THREAD_ATTACH:\r
+    case DLL_THREAD_DETACH:\r
+    case DLL_PROCESS_DETACH:\r
+    default:\r
+       return TRUE;\r
+    }\r
+}\r
+\r
diff --git a/src/lib/ccapi/windows/ntccrpc.acf b/src/lib/ccapi/windows/ntccrpc.acf
new file mode 100644 (file)
index 0000000..77216a9
--- /dev/null
@@ -0,0 +1,8 @@
+[\r
+    explicit_handle\r
+]\r
+\r
+interface portable_ccapi\r
+{\r
+\r
+}
\ No newline at end of file
diff --git a/src/lib/ccapi/windows/ntccrpc.idl b/src/lib/ccapi/windows/ntccrpc.idl
new file mode 100644 (file)
index 0000000..51ff898
--- /dev/null
@@ -0,0 +1,30 @@
+[\r
+    uuid(0012a1de-f7ad-44b0-b597-8ba53159c6fa),\r
+    version(1.0),\r
+    pointer_default(unique)\r
+]\r
+\r
+interface portable_ccapi\r
+{\r
+    const short MAXMSGLEN = 65536;\r
+\r
+    // Locally Unique Identifier\r
+    //\r
+\r
+    struct __LUID {\r
+        __int32 LowPart;\r
+        long    HighPart;\r
+    };\r
+\r
+\r
+    // The Generic CCAPI Message RPC\r
+\r
+    __int32 ccapi_Message  (\r
+            [in] handle_t h,\r
+            [in, string]  unsigned char * client_name,\r
+            [in] struct __LUID  luid,\r
+            [in, length_is(in_len), size_is(MAXMSGLEN)] unsigned char in_buf[],\r
+            [in] __int32 in_len,\r
+            [out, length_is(*out_len), size_is(MAXMSGLEN)] unsigned char out_buf[],\r
+            [out] __int32 * out_len);\r
+}\r
diff --git a/src/lib/ccapi/windows/rpcsstest/NTMakefile b/src/lib/ccapi/windows/rpcsstest/NTMakefile
new file mode 100644 (file)
index 0000000..0e23307
--- /dev/null
@@ -0,0 +1,24 @@
+\r
+!include <win32.mak>\r
+\r
+{}.c{}.obj:\r
+       $(CC) $(cdebug) $(cflags) /Fo"$@" /c $**\r
+\r
+EXECONLINK=link /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $**\r
+\r
+CLIENTEXE=csclient.exe\r
+\r
+SERVEREXE=csserver.exe\r
+\r
+SDKLIBS=rpcrt4.lib\r
+\r
+cstest_c.c cstest_s.c cstest.h: cstest.idl cstest.acf\r
+       midl cstest.idl /acf cstest.acf\r
+\r
+$(CLIENTEXE): client.obj cstest_c.obj\r
+       $(EXECONLINK) $(SDKLIBS)\r
+\r
+$(SERVEREXE): server.obj cstest_s.obj\r
+       $(EXECONLINK) $(SDKLIBS)\r
+\r
+all: $(SERVEREXE) $(CLIENTEXE)\r
diff --git a/src/lib/ccapi/windows/rpcsstest/client.c b/src/lib/ccapi/windows/rpcsstest/client.c
new file mode 100644 (file)
index 0000000..a25e8d1
--- /dev/null
@@ -0,0 +1,87 @@
+#include<windows.h>\r
+#include<stdio.h>\r
+#include<stdlib.h>\r
+#include<tchar.h>\r
+#include"cstest.h"\r
+#include<strsafe.h>\r
+\r
+void * __RPC_USER MIDL_user_allocate(size_t s) {\r
+    return malloc(s);\r
+}\r
+\r
+void __RPC_USER MIDL_user_free(void * p) {\r
+    free(p);\r
+}\r
+\r
+int main(int argc, char ** argv) {\r
+    RPC_STATUS status;\r
+    RPC_BINDING_HANDLE h;\r
+    TCHAR * bindstring = NULL;\r
+    RPC_SECURITY_QOS sqos;\r
+    char inbuf[256];\r
+    char outbuf[256];\r
+    long cb_out;\r
+\r
+    status = RpcStringBindingCompose(NULL,\r
+                                     _T("ncalrpc"),\r
+                                     NULL,\r
+                                     NULL,\r
+                                     NULL,\r
+                                     &bindstring);\r
+\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcStringBindingCompose failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    status = RpcBindingFromStringBinding(bindstring,\r
+                                         &h);\r
+\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcBindingFromStringBinding failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    ZeroMemory(&sqos, sizeof(sqos));\r
+\r
+    sqos.Version = 1;\r
+    sqos.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;\r
+    sqos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;\r
+    sqos.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;\r
+\r
+    status = RpcBindingSetAuthInfoEx(h,\r
+                                     NULL,\r
+                                     RPC_C_AUTHN_LEVEL_CALL,\r
+                                     RPC_C_AUTHN_WINNT,\r
+                                     NULL,\r
+                                     0,\r
+                                     &sqos);\r
+\r
+    if (status != RPC_S_OK) {\r
+        fprintf(stderr, "RpcBindingSetAuthInfoEx failed: %d\n",\r
+                status);\r
+        return 1;\r
+    }\r
+\r
+    StringCbCopyA(inbuf, sizeof(inbuf), "Echo Test 1");\r
+    StringCbCopyA(outbuf, sizeof(outbuf), "Blank blank blank");\r
+\r
+    printf("Before call: in[%s], out[%s]\n", inbuf, outbuf);\r
+    cb_out = 0;\r
+\r
+    status = EchoString(h, inbuf, sizeof(outbuf), &cb_out, outbuf);\r
+\r
+    if (status) {\r
+        printf("Call failed: status = %d\n", status);\r
+    } else {\r
+        printf("After call: out[%s], outlen[%d]\n", outbuf, cb_out);\r
+    }\r
+\r
+    status = RpcBindingFree(&h);\r
+\r
+    status = RpcStringFree(&bindstring);\r
+\r
+    return 0;\r
+}\r
diff --git a/src/lib/ccapi/windows/rpcsstest/cstest.acf b/src/lib/ccapi/windows/rpcsstest/cstest.acf
new file mode 100644 (file)
index 0000000..3c2ae73
--- /dev/null
@@ -0,0 +1,8 @@
+[\r
+    explicit_handle\r
+]\r
+\r
+interface ccapi_cstest\r
+{\r
+\r
+}
\ No newline at end of file
diff --git a/src/lib/ccapi/windows/rpcsstest/cstest.idl b/src/lib/ccapi/windows/rpcsstest/cstest.idl
new file mode 100644 (file)
index 0000000..c51b8ee
--- /dev/null
@@ -0,0 +1,14 @@
+[\r
+uuid(c8b4a635-e9e4-4650-a073-b25610324950),\r
+    version(1.0),\r
+    pointer_default(unique)\r
+]\r
+\r
+interface ccapi_cstest\r
+{\r
+    long EchoString([in] handle_t h,\r
+                    [in, string] unsigned char * in_str,\r
+                    [in] long cb_buffer,\r
+                    [out] long * cb_len,\r
+                    [out, string, size_is(cb_buffer)] unsigned char buffer[*]);\r
+}\r
diff --git a/src/lib/ccapi/windows/rpcsstest/server.c b/src/lib/ccapi/windows/rpcsstest/server.c
new file mode 100644 (file)
index 0000000..f127434
--- /dev/null
@@ -0,0 +1,537 @@
+#include<windows.h>\r
+#include<stdio.h>\r
+#include<process.h>\r
+#include<tchar.h>\r
+#include<rpc.h>\r
+#include"cstest.h"\r
+#include<strsafe.h>\r
+\r
+#define SVCNAME "CCAPICSTest"\r
+\r
+SERVICE_STATUS_HANDLE h_service_status = NULL;\r
+SERVICE_STATUS service_status;\r
+FILE * logfile = NULL;\r
+\r
+void begin_log(void) {\r
+    char temppath[512];\r
+\r
+    temppath[0] = L'\0';\r
+\r
+    GetTempPathA(sizeof(temppath), temppath);\r
+    StringCbCatA(temppath, sizeof(temppath), "csserverconn.log");\r
+    logfile = fopen(temppath, "w");\r
+}\r
+\r
+void end_log(void) {\r
+    if (logfile) {\r
+        fclose(logfile);\r
+        logfile = NULL;\r
+    }\r
+}\r
+\r
+BOOL report_status(DWORD state,\r
+                   DWORD exit_code,\r
+                   DWORD wait_hint) {\r
+    static DWORD checkpoint = 1;\r
+    BOOL rv = TRUE;\r
+\r
+    if (state == SERVICE_START_PENDING)\r
+        service_status.dwControlsAccepted = 0;\r
+    else\r
+        service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;\r
+\r
+    service_status.dwCurrentState = state;\r
+    service_status.dwWin32ExitCode = exit_code;\r
+    service_status.dwWaitHint = wait_hint;\r
+\r
+    if (state == SERVICE_RUNNING ||\r
+        state == SERVICE_STOPPED)\r
+        service_status.dwCheckPoint = 0;\r
+    else\r
+        service_status.dwCheckPoint = checkpoint++;\r
+\r
+    rv = SetServiceStatus(h_service_status, &service_status);\r
+\r
+    return rv;\r
+}\r
+\r
+void service_start(DWORD argc, LPTSTR * argv) {\r
+    RPC_STATUS status;\r
+    RPC_BINDING_VECTOR * bv;\r
+\r
+    status = RpcServerUseProtseq("ncalrpc",\r
+                                 RPC_C_PROTSEQ_MAX_REQS_DEFAULT,\r
+                                 NULL);\r
+\r
+    if (status != RPC_S_OK) {\r
+        return;\r
+    }\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerRegisterIf(ccapi_cstest_v1_0_s_ifspec,\r
+                                 0, 0);\r
+\r
+    if (status != RPC_S_OK)\r
+        return;\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerInqBindings(&bv);\r
+\r
+    if (status != RPC_S_OK)\r
+        return;\r
+\r
+    status = RpcEpRegister(ccapi_cstest_v1_0_s_ifspec,\r
+                           bv, 0, 0);\r
+\r
+    if (status != RPC_S_OK)\r
+        return;\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerRegisterAuthInfo(NULL,\r
+                                       RPC_C_AUTHN_WINNT,\r
+                                       0, 0);\r
+\r
+    if (status != RPC_S_OK)\r
+        return;\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerListen(1,\r
+                             RPC_C_LISTEN_MAX_CALLS_DEFAULT,\r
+                             TRUE);\r
+\r
+    if (status != RPC_S_OK)\r
+        return;\r
+\r
+    report_status(SERVICE_RUNNING, NO_ERROR, 0);\r
+\r
+    begin_log();\r
+\r
+    status = RpcMgmtWaitServerListen();\r
+\r
+    end_log();\r
+\r
+    RpcEpUnregister(ccapi_cstest_v1_0_s_ifspec, bv, 0);\r
+\r
+    RpcBindingVectorFree(&bv);\r
+}\r
+\r
+void service_stop(void) {\r
+    RpcMgmtStopServerListening(0);\r
+}\r
+\r
+void * __RPC_USER MIDL_user_allocate(size_t s) {\r
+    return malloc(s);\r
+}\r
+\r
+void __RPC_USER MIDL_user_free(void * p) {\r
+    free(p);\r
+}\r
+\r
+typedef struct tag_client_info {\r
+    char client_name[512];\r
+    LUID luid;    \r
+} client_info_t;\r
+\r
+RPC_STATUS check_auth(handle_t h, client_info_t * client_info) {\r
+    RPC_BINDING_HANDLE bh = (RPC_BINDING_HANDLE) h;\r
+    RPC_STATUS status;\r
+    HANDLE htoken = NULL;\r
+    char name[256];\r
+    char domain[256];\r
+    DWORD name_len;\r
+    DWORD domain_len;\r
+    SID_NAME_USE snu = 0;\r
+\r
+    struct {\r
+        TOKEN_ORIGIN origin;\r
+        char pad[512];\r
+    } torigin;\r
+\r
+    struct {\r
+        TOKEN_OWNER owner;\r
+        char pad[4096];\r
+    } towner;\r
+\r
+    DWORD len;\r
+\r
+    status = RpcImpersonateClient(bh);\r
+\r
+    if (status != RPC_S_OK)\r
+        return status;\r
+\r
+    if (!OpenThreadToken(GetCurrentThread(),\r
+                         TOKEN_READ | TOKEN_QUERY_SOURCE,\r
+                         FALSE,\r
+                         &htoken)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    len = 0;\r
+\r
+    if (!GetTokenInformation(htoken,\r
+                             TokenOrigin,\r
+                             &torigin.origin,\r
+                             sizeof(torigin),\r
+                             &len)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    if (!GetTokenInformation(htoken,\r
+                             TokenOwner,\r
+                             &towner.owner,\r
+                             sizeof(towner),\r
+                             &len)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+\r
+    name_len = sizeof(name)/sizeof(name[0]);\r
+    domain_len = sizeof(domain)/sizeof(domain[0]);\r
+\r
+    if (!LookupAccountSidA(NULL,\r
+                           towner.owner.Owner,\r
+                           name,\r
+                           &name_len,\r
+                           domain,\r
+                           &domain_len,\r
+                           &snu)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    client_info->luid = torigin.origin.OriginatingLogonSession;\r
+    StringCbPrintfA(client_info->client_name,\r
+                    sizeof(client_info->client_name),\r
+                    "%s\\%s", domain, name);\r
+\r
+    status = 0;\r
+\r
+ _cleanup:\r
+\r
+    RpcRevertToSelf();\r
+\r
+    return status;\r
+}\r
+\r
+long EchoString(\r
+    /* [in] */ handle_t h,\r
+    /* [string][in] */ unsigned char *in_str,\r
+    /* [in] */ long cb_buffer,\r
+    /* [out] */ long *cb_len,\r
+    /* [size_is][string][out] */ unsigned char buffer[  ]) {\r
+\r
+    size_t cb;\r
+    long rv = 0;\r
+    client_info_t client_info;\r
+\r
+    rv = check_auth(h, &client_info);\r
+\r
+    if (rv == 0 && logfile) {\r
+        fprintf(logfile,\r
+                "Client name [%s], LUID [%x:%x]\n",\r
+                client_info.client_name,\r
+                (client_info.luid.HighPart),\r
+                (client_info.luid.LowPart));\r
+        fflush(logfile);\r
+    }\r
+\r
+    if (!in_str) {\r
+        rv = 1;\r
+        if (cb_len)\r
+            *cb_len = 0;\r
+        if (buffer)\r
+            buffer[0] = '\0';\r
+    } else {\r
+        if (FAILED(StringCbLengthA(in_str, 256, &cb))) {\r
+            rv = 2;\r
+            goto _exit_f;\r
+        }\r
+\r
+        cb += sizeof(char);\r
+\r
+        if (((long)cb) > cb_buffer) {\r
+            rv = 3;\r
+            goto _exit_f;\r
+        }\r
+\r
+        *cb_len = cb;\r
+\r
+        if (buffer)\r
+            StringCbCopyA(buffer, cb_buffer, in_str);\r
+\r
+        rv = 0;\r
+    }\r
+\r
+ _exit_f:\r
+\r
+    return rv;\r
+}\r
+\r
+void WINAPI service_control(DWORD ctrl_code) {\r
+    switch(ctrl_code) {\r
+    case SERVICE_CONTROL_STOP:\r
+        report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);\r
+        service_stop();\r
+        return;\r
+\r
+        /* everything else falls through */\r
+    }\r
+\r
+    report_status(service_status.dwCurrentState, NO_ERROR, 0);\r
+}\r
+\r
+void WINAPI service_main(DWORD argc, LPTSTR * argv) {\r
+\r
+    h_service_status = RegisterServiceCtrlHandler( _T(SVCNAME), service_control);\r
+\r
+    if (!h_service_status)\r
+        goto cleanup;\r
+\r
+    ZeroMemory(&service_status, sizeof(service_status));\r
+\r
+    service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;\r
+    service_status.dwServiceSpecificExitCode = 0;\r
+\r
+    if (!report_status(SERVICE_START_PENDING,\r
+                       NO_ERROR,\r
+                       3000))\r
+        goto cleanup;\r
+\r
+    service_start(argc, argv);\r
+\r
+ cleanup:\r
+\r
+    if (h_service_status) {\r
+        report_status(SERVICE_STOPPED, NO_ERROR, 0);\r
+    }\r
+}\r
+\r
+\r
+BOOL\r
+IsInstalled()\r
+{\r
+    BOOL bResult = FALSE;\r
+    SC_HANDLE hSCM;\r
+    SC_HANDLE hService;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (hSCM) {\r
+\r
+        // Try to open the service\r
+        hService = OpenService( hSCM,\r
+                                SVCNAME,\r
+                                SERVICE_QUERY_CONFIG);\r
+        if (hService) {\r
+            bResult = TRUE;\r
+            CloseServiceHandle(hService);\r
+        }\r
+\r
+        CloseServiceHandle(hSCM);\r
+    }\r
+\r
+    return bResult;\r
+}\r
+\r
+BOOL\r
+Install()\r
+{\r
+    char szFilePath[_MAX_PATH];\r
+    SC_HANDLE hSCM;\r
+    SC_HANDLE hService;\r
+    TCHAR szKey[256];\r
+    HKEY hKey = NULL;\r
+    DWORD dwData;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (!hSCM)\r
+        return FALSE;\r
+\r
+    // Get the executable file path\r
+    GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
+\r
+    // Create the service\r
+    hService = CreateService( hSCM,\r
+                              SVCNAME,\r
+                              SVCNAME,\r
+                              SERVICE_ALL_ACCESS,\r
+                              SERVICE_WIN32_OWN_PROCESS,\r
+                              SERVICE_AUTO_START,        // start condition\r
+                              SERVICE_ERROR_NORMAL,\r
+                              szFilePath,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL);\r
+    if (!hService) {\r
+        CloseServiceHandle(hSCM);\r
+        return FALSE;\r
+    }\r
+\r
+    // make registry entries to support logging messages\r
+    // Add the source name as a subkey under the Application\r
+    // key in the EventLog service portion of the registry.\r
+    StringCbCopyA(szKey, 256, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\IKSD");\r
+    if (RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hKey) != ERROR_SUCCESS) {\r
+        CloseServiceHandle(hService);\r
+        CloseServiceHandle(hSCM);\r
+        return FALSE;\r
+    }\r
+\r
+    // Add the Event ID message-file name to the 'EventMessageFile' subkey.\r
+    RegSetValueEx( hKey,\r
+                   "EventMessageFile",\r
+                    0,\r
+                    REG_EXPAND_SZ,\r
+                    (CONST BYTE*)szFilePath,\r
+                    strlen(szFilePath) + 1);\r
+\r
+    // Set the supported types flags.\r
+    dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;\r
+    RegSetValueEx( hKey,\r
+                   "TypesSupported",\r
+                    0,\r
+                    REG_DWORD,\r
+                    (CONST BYTE*)&dwData,\r
+                     sizeof(DWORD));\r
+    RegCloseKey(hKey);\r
+\r
+    // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, SVCNAME);\r
+\r
+    // tidy up\r
+    CloseServiceHandle(hService);\r
+    CloseServiceHandle(hSCM);\r
+    return TRUE;\r
+}\r
+\r
+BOOL\r
+Uninstall()\r
+{\r
+    BOOL bResult = FALSE;\r
+    SC_HANDLE hService;\r
+    SC_HANDLE hSCM;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (!hSCM)\r
+        return FALSE;\r
+\r
+    hService = OpenService( hSCM,\r
+                            SVCNAME,\r
+                            DELETE);\r
+    if (hService) {\r
+        if (DeleteService(hService)) {\r
+            // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_REMOVED, SVCNAME);\r
+            bResult = TRUE;\r
+        } else {\r
+            // LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_NOTREMOVED, SVCNAME);\r
+        }\r
+        CloseServiceHandle(hService);\r
+    }\r
+\r
+    CloseServiceHandle(hSCM);\r
+    return bResult;\r
+}\r
+\r
+\r
+// Returns TRUE if it found an arg it recognised, FALSE if not\r
+// Note: processing some arguments causes output to stdout to be generated.\r
+BOOL\r
+ParseStandardArgs(int argc, char* argv[])\r
+{\r
+    char szFilePath[_MAX_PATH];\r
+\r
+    // See if we have any command line args we recognize\r
+    if (argc <= 1)\r
+        return FALSE;\r
+\r
+    if ( _stricmp(argv[1], "-h") == 0 ||\r
+         _stricmp(argv[1], "-?") == 0 ||\r
+         _stricmp(argv[1], "/h") == 0 ||\r
+         _stricmp(argv[1], "/?") == 0) {\r
+\r
+        //\r
+        GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
+        fprintf(stderr, "usage: %s [-v | -i | -u | -h]\r\n",szFilePath);\r
+        return TRUE;\r
+    } else if (_stricmp(argv[1], "-v") == 0 ||\r
+               _stricmp(argv[1], "/v") == 0 ) {\r
+\r
+        // Spit out version info\r
+        fprintf(stderr, "%s Version 0.1\n",_T(SVCNAME));\r
+        fprintf(stderr, "The service is %s installed\n",\r
+               IsInstalled() ? "currently" : "not");\r
+        return TRUE; // say we processed the argument\r
+\r
+    } else if (_stricmp(argv[1], "-i") == 0 ||\r
+               _stricmp(argv[1], "/i") == 0) {\r
+\r
+        // Request to install.\r
+        if (IsInstalled()) {\r
+            fprintf(stderr, "%s is already installed\n", _T(SVCNAME));\r
+        } else {\r
+            // Try and install the copy that's running\r
+            if (Install()) {\r
+                fprintf(stderr, "%s installed\n", _T(SVCNAME));\r
+            } else {\r
+                fprintf(stderr, "%s failed to install. Error %d\n", _T(SVCNAME), GetLastError());\r
+            }\r
+        }\r
+        return TRUE; // say we processed the argument\r
+\r
+    } else if (_stricmp(argv[1], "-u") == 0 ||\r
+               _stricmp(argv[1], "/u") == 0) {\r
+\r
+        // Request to uninstall.\r
+        if (!IsInstalled()) {\r
+            fprintf(stderr, "%s is not installed\n", _T(SVCNAME));\r
+        } else {\r
+            // Try and remove the copy that's installed\r
+            if (Uninstall()) {\r
+                // Get the executable file path\r
+                GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
+                fprintf(stderr, "%s removed. (You must delete the file (%s) yourself.)\n"\r
+                       _T(SVCNAME), szFilePath);\r
+            } else {\r
+                fprintf(stderr, "Could not remove %s. Error %d\n", _T(SVCNAME), GetLastError());\r
+            }\r
+        }\r
+        return TRUE; // say we processed the argument\r
+\r
+    }\r
+\r
+    // Don't recognise the args\r
+    return FALSE;\r
+}\r
+\r
+int main(int argc, char ** argv) {\r
+\r
+    SERVICE_TABLE_ENTRY dispatch_table[] = {\r
+        { _T(SVCNAME), (LPSERVICE_MAIN_FUNCTION) service_main },\r
+        { NULL, NULL }\r
+    };\r
+\r
+    if ( ParseStandardArgs(argc, argv) )\r
+       return 0;\r
+\r
+    if (!StartServiceCtrlDispatcher(dispatch_table)) {\r
+        fprintf(stderr, "Can't start service control dispatcher\n");\r
+    }\r
+\r
+    return 0;\r
+}\r
diff --git a/src/lib/ccapi/windows/server.c b/src/lib/ccapi/windows/server.c
new file mode 100644 (file)
index 0000000..ac4ab70
--- /dev/null
@@ -0,0 +1,679 @@
+\r
+#include <windows.h>\r
+#include "msg.h"\r
+#include "marshall.h"\r
+#include "serv_ops.h"\r
+#include "datastore.h"\r
+#include <stdio.h>\r
+#include <process.h>\r
+#include <tchar.h>\r
+#include <rpc.h>\r
+#include <rpcndr.h>\r
+#include "ntccrpc.h"\r
+#include <strsafe.h>\r
+\r
+#define SVCNAME "MIT_CCAPI_NT_Service"\r
+\r
+HANDLE hMainThread = 0;\r
+HANDLE WaitToTerminate = 0;\r
+\r
+SERVICE_STATUS_HANDLE h_service_status = NULL;\r
+SERVICE_STATUS service_status;\r
+FILE * logfile = NULL;\r
+\r
+/* Log File */\r
+void begin_log(void) {\r
+    char temppath[512];\r
+\r
+    temppath[0] = L'\0';\r
+\r
+    GetTempPathA(sizeof(temppath), temppath);\r
+    StringCbCatA(temppath, sizeof(temppath), "mit_nt_ccapi.log");\r
+    logfile = fopen(temppath, "w");\r
+}\r
+\r
+void end_log(void) {\r
+    if (logfile) {\r
+        fclose(logfile);\r
+        logfile = NULL;\r
+    }\r
+}\r
+\r
+BOOL report_status(DWORD state,\r
+                   DWORD exit_code,\r
+                   DWORD wait_hint) {\r
+    static DWORD checkpoint = 1;\r
+    BOOL rv = TRUE;\r
+\r
+    if (state == SERVICE_START_PENDING)\r
+        service_status.dwControlsAccepted = 0;\r
+    else\r
+        service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;\r
+\r
+    service_status.dwCurrentState = state;\r
+    service_status.dwWin32ExitCode = exit_code;\r
+    service_status.dwWaitHint = wait_hint;\r
+\r
+    if (state == SERVICE_RUNNING ||\r
+        state == SERVICE_STOPPED)\r
+        service_status.dwCheckPoint = 0;\r
+    else\r
+        service_status.dwCheckPoint = checkpoint++;\r
+\r
+    rv = SetServiceStatus(h_service_status, &service_status);\r
+\r
+    return rv;\r
+}\r
+\r
+void service_start(DWORD argc, LPTSTR * argv) {\r
+    RPC_STATUS status;\r
+    RPC_BINDING_VECTOR * bv;\r
+\r
+    status = RpcServerUseProtseq("ncalrpc",\r
+                                 RPC_C_PROTSEQ_MAX_REQS_DEFAULT,\r
+                                 NULL);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcServerUseProtseq = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerRegisterIf(portable_ccapi_v1_0_s_ifspec,\r
+                                 0, 0);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcServerRegisterIf = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerInqBindings(&bv);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcServerInqBindings = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    status = RpcEpRegister(portable_ccapi_v1_0_s_ifspec,\r
+                           bv, 0, 0);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcEpRegister = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerRegisterAuthInfo(NULL,\r
+                                       RPC_C_AUTHN_WINNT,\r
+                                       0, 0);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcServerRegisterAuthInfo = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
+\r
+    status = RpcServerListen(2,\r
+                             RPC_C_LISTEN_MAX_CALLS_DEFAULT,\r
+                             TRUE);\r
+\r
+    if (status != RPC_S_OK) {\r
+       if (logfile) fprintf(logfile, "service_start RpcServerListen = 0x%x\n", status);\r
+        goto cleanup;\r
+    }\r
+\r
+    report_status(SERVICE_RUNNING, NO_ERROR, 0);\r
+\r
+\r
+    if (logfile) fprintf(logfile, "service_start calling RpcMgmtWaitServerListen\n");\r
+    status = RpcMgmtWaitServerListen();\r
+    if (logfile) fprintf(logfile, "service_start RpcMgmtWaitServerListen = 0x%x\n", status);\r
+\r
+  cleanup:\r
+    RpcEpUnregister(portable_ccapi_v1_0_s_ifspec, bv, 0);\r
+\r
+    RpcBindingVectorFree(&bv);\r
+}\r
+\r
+void service_stop(void) {\r
+    if (logfile) fprintf(logfile, "service_stop\n");\r
+    RpcMgmtStopServerListening(0);\r
+}\r
+\r
+void * __RPC_USER MIDL_user_allocate(size_t s) {\r
+    return malloc(s);\r
+}\r
+\r
+void __RPC_USER MIDL_user_free(void * p) {\r
+    free(p);\r
+}\r
+\r
+typedef struct tag_client_info {\r
+    char client_name[512];\r
+    LUID luid;    \r
+} client_info_t;\r
+\r
+int obtain_auth_info(client_info_t * client_info, cc_auth_info_t ** pauth_info)\r
+{\r
+    *pauth_info = (cc_auth_info_t *)malloc(sizeof(cc_auth_info_t));\r
+    if ( !*pauth_info )\r
+       return ccErrNoMem;\r
+    \r
+    (*pauth_info)->len  = strlen(client_info->client_name) + 1;\r
+    (*pauth_info)->info = malloc((*pauth_info)->len);\r
+    if ( !(*pauth_info)->info ) {\r
+       free(*pauth_info);\r
+       return ccErrNoMem;\r
+    }\r
+\r
+    memcpy((*pauth_info)->info, client_info->client_name, (*pauth_info)->len);\r
+    \r
+    return 0;\r
+}\r
+\r
+void destroy_auth_info(cc_auth_info_t *auth_info)\r
+{\r
+    free(auth_info->info);\r
+    free(auth_info);\r
+}\r
+\r
+int obtain_session_info(client_info_t * client_info, cc_session_info_t ** psession_info)\r
+{\r
+    *psession_info = (cc_session_info_t *)malloc(sizeof(cc_session_info_t));\r
+    if ( !*psession_info )\r
+       return ccErrNoMem;\r
+    \r
+    (*psession_info)->len  = sizeof(LUID);\r
+    (*psession_info)->info = malloc((*psession_info)->len);\r
+    if ( !(*psession_info)->info ) {\r
+       free(*psession_info);\r
+       return ccErrNoMem;\r
+    }\r
+\r
+    memcpy((*psession_info)->info, &client_info->luid, (*psession_info)->len);\r
+    \r
+    return 0;\r
+}\r
+\r
+void destroy_session_info(cc_session_info_t *session_info)\r
+{\r
+    free(session_info->info);\r
+    free(session_info);\r
+}\r
+\r
+RPC_STATUS check_auth(handle_t h, client_info_t * client_info) {\r
+    RPC_BINDING_HANDLE bh = (RPC_BINDING_HANDLE) h;\r
+    RPC_STATUS status;\r
+    HANDLE htoken = NULL;\r
+    char name[256];\r
+    char domain[256];\r
+    DWORD name_len;\r
+    DWORD domain_len;\r
+    SID_NAME_USE snu = 0;\r
+\r
+    struct {\r
+        TOKEN_ORIGIN origin;\r
+        char pad[512];\r
+    } torigin;\r
+\r
+    struct {\r
+        TOKEN_OWNER owner;\r
+        char pad[4096];\r
+    } towner;\r
+\r
+    DWORD len;\r
+\r
+    status = RpcImpersonateClient(bh);\r
+\r
+    if (status != RPC_S_OK)\r
+        return status;\r
+\r
+    if (!OpenThreadToken(GetCurrentThread(),\r
+                         TOKEN_READ | TOKEN_QUERY_SOURCE,\r
+                         FALSE,\r
+                         &htoken)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    len = 0;\r
+\r
+    if (!GetTokenInformation(htoken,\r
+                             TokenOrigin,\r
+                             &torigin.origin,\r
+                             sizeof(torigin),\r
+                             &len)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    if (!GetTokenInformation(htoken,\r
+                             TokenOwner,\r
+                             &towner.owner,\r
+                             sizeof(towner),\r
+                             &len)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+\r
+    name_len = sizeof(name)/sizeof(name[0]);\r
+    domain_len = sizeof(domain)/sizeof(domain[0]);\r
+\r
+    if (!LookupAccountSidA(NULL,\r
+                           towner.owner.Owner,\r
+                           name,\r
+                           &name_len,\r
+                           domain,\r
+                           &domain_len,\r
+                           &snu)) {\r
+        status = GetLastError();\r
+        goto _cleanup;\r
+    }\r
+\r
+    client_info->luid = torigin.origin.OriginatingLogonSession;\r
+    StringCbPrintfA(client_info->client_name,\r
+                    sizeof(client_info->client_name),\r
+                    "%s\\%s", domain, name);\r
+\r
+    status = 0;\r
+\r
+ _cleanup:\r
+\r
+    RpcRevertToSelf();\r
+\r
+    return status;\r
+}\r
+\r
+__int32 ccapi_Message( \r
+    /* [in] */ handle_t h,\r
+    /* [string][in] */ unsigned char *client_name,\r
+    /* [in] */ struct __LUID luid,\r
+    /* [size_is][length_is][in] */ unsigned char in_buf[],\r
+    /* [in] */ __int32 in_len,\r
+    /* [size_is][length_is][out] */ unsigned char out_buf[],\r
+    /* [out] */ __int32 *out_len)\r
+{\r
+    client_info_t client_info;\r
+    cc_msg_t *          msg = NULL;\r
+    cc_msg_t *          resp = NULL;\r
+    cc_auth_info_t    * auth_info = NULL;\r
+    cc_session_info_t * session_info = NULL;\r
+    cc_int32            code;\r
+\r
+    if (logfile) fprintf(logfile, "ccapi_Message\n");\r
+\r
+    if ( ccs_serv_initialize() != ccNoError ) {\r
+       code = ccErrServerUnavailable;\r
+       goto done;\r
+    }\r
+\r
+    code = check_auth(h, &client_info);\r
+    if (code == 0) {\r
+       if (!strcmp("SYSTEM",client_info.client_name) &&\r
+            client_info.luid.HighPart == 0 &&\r
+            client_info.luid.LowPart == 0 &&\r
+            client_name != NULL &&\r
+            client_name[0] != '\0') {\r
+           StringCbPrintfA(client_info.client_name,\r
+                            sizeof(client_info.client_name),\r
+                            "%s", client_name);\r
+           client_info.luid.HighPart = luid.HighPart;\r
+           client_info.luid.LowPart  = luid.LowPart;\r
+       }\r
+    } else {\r
+       code = ccErrServerCantBecomeUID;\r
+       goto done;\r
+    }\r
+\r
+    /* allocate message */\r
+    msg = (cc_msg_t *)malloc(sizeof(cc_msg_t));\r
+    if (!msg) {\r
+       code = ccErrNoMem;\r
+       goto done;\r
+    }\r
+\r
+    /* unflatten message */\r
+    code = cci_msg_unflatten(in_buf, in_len, &msg);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* obtain auth info */\r
+    code = obtain_auth_info(&client_info, &auth_info);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* obtain session info */\r
+    code = obtain_session_info(&client_info, &session_info);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* process message */\r
+    code = ccs_serv_process_msg(msg, auth_info, session_info, &resp);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* flatten response */\r
+    code = cci_msg_flatten(resp, NULL);\r
+    if (code)\r
+       goto cleanup;\r
+\r
+    /* send response */\r
+    if (resp->flat_len > MAXMSGLEN) {\r
+       code = ccErrBadInternalMessage;\r
+       goto cleanup;\r
+    }\r
+    memcpy(out_buf, resp->flat, resp->flat_len);\r
+    *out_len = resp->flat_len;\r
+    code = ccNoError;\r
+\r
+  cleanup:\r
+    if (auth_info)\r
+       destroy_auth_info(auth_info);\r
+\r
+    if (session_info)\r
+       destroy_session_info(session_info);\r
+\r
+    /* free message */\r
+    if (msg)\r
+       cci_msg_destroy(msg);\r
+\r
+    /* free response */\r
+    if (resp)\r
+       cci_msg_destroy(resp);\r
+\r
+  done:\r
+    return code ? -1 : 0;\r
+}\r
+\r
+void WINAPI service_control(DWORD ctrl_code) {\r
+    switch(ctrl_code) {\r
+    case SERVICE_CONTROL_STOP:\r
+        report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);\r
+        service_stop();\r
+        return;\r
+\r
+        /* everything else falls through */\r
+    }\r
+\r
+    report_status(service_status.dwCurrentState, NO_ERROR, 0);\r
+}\r
+\r
+void WINAPI service_main(DWORD argc, LPTSTR * argv) {\r
+\r
+    begin_log();\r
+\r
+    h_service_status = RegisterServiceCtrlHandler( _T(SVCNAME), service_control);\r
+\r
+    if (!h_service_status)\r
+        goto cleanup;\r
+\r
+    ZeroMemory(&service_status, sizeof(service_status));\r
+\r
+    service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;\r
+    service_status.dwServiceSpecificExitCode = 0;\r
+\r
+    if (!report_status(SERVICE_START_PENDING,\r
+                       NO_ERROR,\r
+                       3000))\r
+        goto cleanup;\r
+\r
+    service_start(argc, argv);\r
+\r
+ cleanup:\r
+\r
+    if (h_service_status) {\r
+        report_status(SERVICE_STOPPED, NO_ERROR, 0);\r
+    }\r
+\r
+    end_log();\r
+}\r
+\r
+\r
+BOOL\r
+IsInstalled()\r
+{\r
+    BOOL bResult = FALSE;\r
+    SC_HANDLE hSCM;\r
+    SC_HANDLE hService;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (hSCM) {\r
+\r
+        // Try to open the service\r
+        hService = OpenService( hSCM,\r
+                                SVCNAME,\r
+                                SERVICE_QUERY_CONFIG);\r
+        if (hService) {\r
+            bResult = TRUE;\r
+            CloseServiceHandle(hService);\r
+        }\r
+\r
+        CloseServiceHandle(hSCM);\r
+    }\r
+\r
+    return bResult;\r
+}\r
+\r
+BOOL\r
+Install()\r
+{\r
+    char szFilePath[_MAX_PATH];\r
+    SC_HANDLE hSCM;\r
+    SC_HANDLE hService;\r
+    TCHAR szKey[256];\r
+    HKEY hKey = NULL;\r
+    DWORD dwData;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (!hSCM)\r
+        return FALSE;\r
+\r
+    // Get the executable file path\r
+    GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
+\r
+    // Create the service\r
+    hService = CreateService( hSCM,\r
+                              SVCNAME,\r
+                              SVCNAME,\r
+                              SERVICE_ALL_ACCESS,\r
+                              SERVICE_WIN32_OWN_PROCESS,\r
+                              SERVICE_AUTO_START,        // start condition\r
+                              SERVICE_ERROR_NORMAL,\r
+                              szFilePath,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL,\r
+                              NULL);\r
+    if (!hService) {\r
+        CloseServiceHandle(hSCM);\r
+        return FALSE;\r
+    }\r
+\r
+    // make registry entries to support logging messages\r
+    // Add the source name as a subkey under the Application\r
+    // key in the EventLog service portion of the registry.\r
+    StringCbCopyA(szKey, 256, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\IKSD");\r
+    if (RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hKey) != ERROR_SUCCESS) {\r
+        CloseServiceHandle(hService);\r
+        CloseServiceHandle(hSCM);\r
+        return FALSE;\r
+    }\r
+\r
+    // Add the Event ID message-file name to the 'EventMessageFile' subkey.\r
+    RegSetValueEx( hKey,\r
+                   "EventMessageFile",\r
+                    0,\r
+                    REG_EXPAND_SZ,\r
+                    (CONST BYTE*)szFilePath,\r
+                    strlen(szFilePath) + 1);\r
+\r
+    // Set the supported types flags.\r
+    dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;\r
+    RegSetValueEx( hKey,\r
+                   "TypesSupported",\r
+                    0,\r
+                    REG_DWORD,\r
+                    (CONST BYTE*)&dwData,\r
+                     sizeof(DWORD));\r
+    RegCloseKey(hKey);\r
+\r
+    // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, SVCNAME);\r
+\r
+    // tidy up\r
+    CloseServiceHandle(hService);\r
+    CloseServiceHandle(hSCM);\r
+    return TRUE;\r
+}\r
+\r
+BOOL\r
+Uninstall()\r
+{\r
+    BOOL bResult = FALSE;\r
+    SC_HANDLE hService;\r
+    SC_HANDLE hSCM;\r
+\r
+    // Open the Service Control Manager\r
+    hSCM = OpenSCManager( NULL, // local machine\r
+                          NULL, // ServicesActive database\r
+                          SC_MANAGER_ALL_ACCESS); // full access\r
+    if (!hSCM)\r
+        return FALSE;\r
+\r
+    hService = OpenService( hSCM,\r
+                            _T(SVCNAME),\r
+                            DELETE);\r
+    if (hService) {\r
+        if (DeleteService(hService)) {\r
+            // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_REMOVED, SVCNAME);\r
+            bResult = TRUE;\r
+        } else {\r
+            // LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_NOTREMOVED, SVCNAME);\r
+        }\r
+        CloseServiceHandle(hService);\r
+    }\r
+\r
+    CloseServiceHandle(hSCM);\r
+    return bResult;\r
+}\r
+\r
+\r
+// Returns TRUE if it found an arg it recognised, FALSE if not\r
+// Note: processing some arguments causes output to stdout to be generated.\r
+BOOL\r
+ParseStandardArgs(int argc, char* argv[])\r
+{\r
+    char szFilePath[_MAX_PATH]="not a file name";\r
+\r
+    // See if we have any command line args we recognize\r
+    if (argc <= 1)\r
+        return FALSE;\r
+\r
+    if ( _stricmp(argv[1], "-h") == 0 ||\r
+         _stricmp(argv[1], "-?") == 0 ||\r
+         _stricmp(argv[1], "/h") == 0 ||\r
+         _stricmp(argv[1], "/?") == 0) {\r
+\r
+        //\r
+        GetModuleFileNameA(NULL, szFilePath, sizeof(szFilePath));\r
+        fprintf(stderr, "usage: %s [-v | -i | -u | -h]\r\n",szFilePath);\r
+        return TRUE;\r
+    } else if (_stricmp(argv[1], "-v") == 0 ||\r
+               _stricmp(argv[1], "/v") == 0 ) {\r
+\r
+        // Spit out version info\r
+        fprintf(stderr, "%s Version 0.1\n",_T(SVCNAME));\r
+        fprintf(stderr, "The service is %s installed\n",\r
+               IsInstalled() ? "currently" : "not");\r
+        return TRUE; // say we processed the argument\r
+\r
+    } else if (_stricmp(argv[1], "-i") == 0 ||\r
+               _stricmp(argv[1], "/i") == 0) {\r
+\r
+        // Request to install.\r
+        if (IsInstalled()) {\r
+            fprintf(stderr, "%s is already installed\n", _T(SVCNAME));\r
+        } else {\r
+            // Try and install the copy that's running\r
+            if (Install()) {\r
+                fprintf(stderr, "%s installed\n", _T(SVCNAME));\r
+            } else {\r
+                fprintf(stderr, "%s failed to install. Error %d\n", _T(SVCNAME), GetLastError());\r
+            }\r
+        }\r
+        return TRUE; // say we processed the argument\r
+\r
+    } else if (_stricmp(argv[1], "-u") == 0 ||\r
+               _stricmp(argv[1], "/u") == 0) {\r
+\r
+        // Request to uninstall.\r
+        if (!IsInstalled()) {\r
+            fprintf(stderr, "%s is not installed\n", _T(SVCNAME));\r
+        } else {\r
+            // Try and remove the copy that's installed\r
+            if (Uninstall()) {\r
+                // Get the executable file path\r
+                GetModuleFileNameA(NULL, szFilePath, sizeof(szFilePath));\r
+                fprintf(stderr, "%s removed. (You must delete the file (%s) yourself.)\n",\r
+                       _T(SVCNAME), szFilePath);\r
+            } else {\r
+                fprintf(stderr, "Could not remove %s. Error %d\n", _T(SVCNAME), GetLastError());\r
+            }\r
+        }\r
+        return TRUE; // say we processed the argument\r
+\r
+    }\r
+\r
+    // Don't recognise the args\r
+    return FALSE;\r
+}\r
+\r
+DWORD __stdcall Main_thread(void* notUsed)\r
+{\r
+    char * argv[2] = {SVCNAME, NULL};\r
+    begin_log();\r
+    service_start(1, (LPTSTR*)argv);\r
+    end_log();\r
+    return(0);\r
+}\r
+\r
+int main(int argc, char ** argv) {\r
+    SERVICE_TABLE_ENTRY dispatch_table[] = {\r
+        { _T(SVCNAME), (LPSERVICE_MAIN_FUNCTION) service_main },\r
+        { NULL, NULL }\r
+    };\r
+\r
+    if ( ParseStandardArgs(argc, argv) )\r
+       return 0;\r
+\r
+    if (!StartServiceCtrlDispatcher(dispatch_table)) {\r
+        LONG status = GetLastError();\r
+        if (status == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)\r
+        {\r
+            DWORD tid;\r
+            hMainThread = CreateThread(NULL, 0, Main_thread, 0, 0, &tid);\r
+\r
+            printf("Hit <Enter> to terminate MIT CCAPI Server\n");\r
+            getchar();\r
+           service_stop();\r
+       }\r
+    }\r
+\r
+    if ( hMainThread ) {\r
+       WaitForSingleObject( hMainThread, INFINITE );\r
+       CloseHandle( hMainThread );\r
+    }\r
+    return 0;\r
+}\r
index 55a795090715bad88f23e3a71b73829434d49d7f..681c1a15dd2764c6cdfe6bda0c6f045642b9e137 100644 (file)
@@ -354,8 +354,8 @@ check-windows::
        cd ..
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 417a2b6247907d545a762d831449ee1ed55d21af..917b751df00dd4e6ed27166e4b8d348ac1770f23 100644 (file)
@@ -68,7 +68,7 @@ clean-unix:: clean-libobjs
 clean::
        -$(RM) aes-gen aes-gen.o vt.txt vk.txt kresults.out aes-test aes-test.o
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 0311d1a2d1ba08f377156abc52e45647e067aa76..2b461f00a96a76c2c7b5e5e422d1e1387cb37112 100644 (file)
@@ -36,7 +36,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index e16171bdd93dfb2679d4927645f6b87ede3e0767..ca0d031899274c58ed7ffa47d95b754e4653b928 100644 (file)
@@ -37,7 +37,7 @@ t_crc: t_crc.o crc32.o $(SUPPORT_DEPLIB)
        $(CC_LINK) -o $@ t_crc.o crc32.o $(SUPPORT_LIB)
 
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index d249976250f05caa510fc19e59f3de35598ace6b..b6f293cee58681025150310e5101630d40a71693 100644 (file)
@@ -91,7 +91,7 @@ clean::
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index baa93563f5b72ca8b8861ad10c957a6b5adf32da..58a95d4c275944b5e76afa1d80c6425072415432 100644 (file)
@@ -48,7 +48,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 8ac9da7185212bbc4626470bbdcece4810de6dc3..e26fde55958879d37a5612ca3d56f5bf852c7ae9 100644 (file)
@@ -38,7 +38,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 7878c97888157883e8dcee58d724a9c4395660a5..d879b40297f62cd6508903c9408818a6308a196b 100644 (file)
@@ -33,7 +33,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index a3c5017ccdf3d03817cf1d2a7a0d285375b6aee8..7e3bc03aa5b12ae86d0d8e788f56209cbb097eae 100644 (file)
@@ -52,7 +52,7 @@ clean-unix::
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 7bb87dce780ad65ca5df88272803f9b27b2f5c55..c2f2d7b6fc39bfa88a2fec9c35ed901afc408ddf 100644 (file)
@@ -54,7 +54,7 @@ clean::
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index e915e9e8a8ecd7a485e3502d457fc145712c2332..ab250951e7022af309ad79afb40af6a5420eb858 100644 (file)
@@ -44,7 +44,7 @@ clean::
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 006183db6fec98158a5a2369ff7d78cad6847117..d4db7a237fa5dfef1ceb1d0999d4156445bc5f19 100644 (file)
@@ -31,7 +31,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index c2389e1be2d2a826fe29ac1c401cc8d65fdcfa06..d70493b096b1332805f479e1379333114c8df557 100644 (file)
@@ -29,7 +29,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 49ec4437f90ed99e8a9777ebea13bfefc7d7d6cc..3113b8e4e471aaa49fce4c43241d07309e690be7 100644 (file)
@@ -49,7 +49,7 @@ clean-unix:: clean-libobjs
 t_shs3: t_shs3.o shs.o $(SUPPORT_DEPLIB)
        $(CC_LINK) -o t_shs3 t_shs3.o shs.o $(SUPPORT_LIB)
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 9610636e09f22cc8d27c3218db2310d9800fc943..ccdeb6cd0d5e259fd409c7fa35c64e4e5440f6b7 100644 (file)
@@ -35,7 +35,7 @@ depend:: $(SRCS)
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 61489fff6ec1da5a91885fe10f68d46849d6d47b..1289be32fd6d624f4ab4176f07da5f4d82439350 100644 (file)
@@ -109,8 +109,8 @@ clean-unix:: clean-liblinks clean-libs clean-libobjs
 
 install-unix:: install-libs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 03fc695b2fde909cf1c9f1931e70943237d562e2..a18159e3a133440d3e95a2ae47139f2d8d112496 100644 (file)
@@ -6,8 +6,8 @@ LOCAL_SUBDIRS= generic mechglue krb5 spnego
 DEFS=
 
 ##DOSLIBNAME=$(OUTPRE)gssapi.lib
-##DOSOBJFILELIST=@$(OUTPRE)generic.lst @$(OUTPRE)krb5.lst @$(OUTPRE)gssapi.lst
-##DOSOBJFILEDEP=$(OUTPRE)generic.lst $(OUTPRE)krb5.lst $(OUTPRE)gssapi.lst
+##DOSOBJFILELIST=@$(OUTPRE)mechglue.lst @$(OUTPRE)spnego.lst @$(OUTPRE)generic.lst @$(OUTPRE)krb5.lst @$(OUTPRE)gssapi.lst
+##DOSOBJFILEDEP=$(OUTPRE)mechglue.lst $(OUTPRE)spnego.lst $(OUTPRE)generic.lst $(OUTPRE)krb5.lst $(OUTPRE)gssapi.lst
 
 ##DOSOBJFILE=$(OUTPRE)gssapi.lst
 ##DOSLIBOBJS=$(OBJS)
@@ -30,7 +30,7 @@ LIBMINOR=2
 LIBINITFUNC=gssint_lib_init
 LIBFINIFUNC=gssint_lib_fini
 STOBJLISTS=OBJS.ST generic/OBJS.ST mechglue/OBJS.ST krb5/OBJS.ST spnego/OBJS.ST
-SUBDIROBJLISTS=generic/OBJS.ST mechglue/OBJS.ST krb5/OBJS.ST
+SUBDIROBJLISTS=generic/OBJS.ST mechglue/OBJS.ST krb5/OBJS.ST spnego/OBJS.ST
 SHLIB_EXPDEPS=\
        $(KRB5_DEPLIB) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB) $(COM_ERR_DEPLIB)
 SHLIB_EXPLIBS=-lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB) $(DL_LIB) $(LIBS)
@@ -38,15 +38,29 @@ SHLIB_DIRS=-L$(TOPLIBD)
 SHLIB_RDIRS=$(KRB5_LIBDIR)
 RELDIR=gssapi
 
-all-unix:: all-liblinks
+all-unix:: all-liblinks @MAINT@ verify-calling-conventions-gssapi
 
 install-unix:: install-libs
 
-clean-unix:: clean-liblinks clean-libs clean-libobjs
+clean-unix:: clean-liblinks clean-libs clean-libobjs clean-misc-unix
 
 clean-windows::
        $(RM) gssapi.lib gssapi.bak
 
+clean-misc-unix:
+       $(RM) merged-gssapi-header.h
+
+EHDRDIR=$(BUILDTOP)$(S)include$(S)gssapi
+EXPORTED_HEADERS= \
+       $(EHDRDIR)$(S)gssapi_krb5.h \
+       $(EHDRDIR)$(S)gssapi_generic.h \
+       $(EHDRDIR)$(S)gssapi.h
+merged-gssapi-header.h: $(EXPORTED_HEADERS)
+       cat $(EXPORTED_HEADERS) > merged.tmp
+       $(MV) merged.tmp merged-gssapi-header.h
+verify-calling-conventions-gssapi: merged-gssapi-header.h
+       $(PERL) -w $(SRCTOP)/util/def-check.pl merged-gssapi-header.h $(srcdir)/../gssapi32.def
+
 all-windows::
        cd generic
        @echo Making in gssapi\generic
@@ -54,9 +68,12 @@ all-windows::
        cd ..\krb5
        @echo Making in gssapi\krb5
        $(MAKE) -$(MFLAGS)
-#      cd ..\mechglue
-#      @echo Making in gssapi\mechglue
-#      $(MAKE) -$(MFLAGS)
+       cd ..\mechglue
+       @echo Making in gssapi\mechglue
+       $(MAKE) -$(MFLAGS)
+       cd ..\spnego
+       @echo Making in gssapi\spnego
+       $(MAKE) -$(MFLAGS)
        cd ..
 
 clean-windows::
@@ -66,9 +83,12 @@ clean-windows::
        cd ..\krb5
        @echo Making clean in gssapi\krb5
        $(MAKE) -$(MFLAGS) clean
-#      cd ..\mechglue
-#      @echo Making clean in gssapi\mechglue
-#      $(MAKE) -$(MFLAGS) clean
+       cd ..\mechglue
+       @echo Making clean in gssapi\mechglue
+       $(MAKE) -$(MFLAGS) clean
+       cd ..\spnego
+       @echo Making clean in gssapi\spnego
+       $(MAKE) -$(MFLAGS) clean
        cd ..
        @echo Making clean in gssapi
 
@@ -110,13 +130,13 @@ clean-windows::
 # appears to be properly serializing the subdir processing and local
 # compiles... so far.
 ##DOS##!if 0
-$(BUILDTOP)/include/gssapi/gssapi.h generic/gssapi.h krb5/gssapi_err_krb5.h generic/gssapi_err_generic.h krb5/gssapi_krb5.h: all-recurse
+$(EXPORTED_HEADERS) generic/gssapi.h krb5/gssapi_err_krb5.h generic/gssapi_err_generic.h krb5/gssapi_krb5.h: all-recurse
        : $@ updated by recursion rule
 ##DOS##!endif
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 305a32589a7b71643c73f0e9a0e5f43c5f384c3a..a9581f2d451dff4a930ea0d49a65a376eeaaeb2d 100644 (file)
@@ -142,7 +142,7 @@ install-headers-unix install:: gssapi.h
 
 depend:: $(ETSRCS)
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 16031e26efc8b6548abfeb9873e09664bfeb5e47..f075fe481e40cdf694a4627c39780fbe58272930 100644 (file)
@@ -40,9 +40,11 @@ int gssint_lib_init(void)
     err = k5_key_register(K5_KEY_GSS_KRB5_CCACHE_NAME, free);
     if (err)
        return err;
+#ifndef _WIN32
     err = k5_mutex_finish_init(&kg_kdc_flag_mutex);
     if (err)
        return err;
+#endif
     return k5_mutex_finish_init(&kg_vdb.mutex);
 }
 
@@ -64,7 +66,9 @@ void gssint_lib_fini(void)
     k5_key_delete(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME);
     k5_key_delete(K5_KEY_GSS_KRB5_CCACHE_NAME);
     k5_mutex_destroy(&kg_vdb.mutex);
+#ifndef _WIN32
     k5_mutex_destroy(&kg_kdc_flag_mutex);
+#endif
     k5_mutex_destroy(&gssint_krb5_keytab_lock);
     gssint_mechglue_fini();
 }
index 7f6b80034eabd1544e75ea43246ba4599d914632..2d3368a883b966fb7e879c2f37b4aac70bd6c2db 100644 (file)
@@ -235,7 +235,7 @@ includes::  gssapi_krb5.h
 
 install::
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 6d27fd33cb64bfa59c20007f04bc78d37739c3bf..81b49f2c73c90327255f5104b6d4d9f64dbb631f 100644 (file)
@@ -970,29 +970,37 @@ krb5_gss_init_sec_context(minor_status, claimant_cred_handle,
    return(major_status);
 }
 
+#ifndef _WIN32
 k5_mutex_t kg_kdc_flag_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
 static int kdc_flag = 0;
+#endif
 
 krb5_error_code
 krb5_gss_init_context (krb5_context *ctxp)
 {
     krb5_error_code err;
+#ifndef _WIN32
     int is_kdc;
+#endif
 
     err = gssint_initialize_library();
     if (err)
        return err;
+#ifndef _WIN32
     err = k5_mutex_lock(&kg_kdc_flag_mutex);
     if (err)
        return err;
     is_kdc = kdc_flag;
     k5_mutex_unlock(&kg_kdc_flag_mutex);
+
     if (is_kdc)
        return krb5int_init_context_kdc(ctxp);
-    else
-       return krb5_init_context(ctxp);
+#endif
+
+    return krb5_init_context(ctxp);
 }
 
+#ifndef _WIN32
 krb5_error_code
 krb5_gss_use_kdc_context()
 {
@@ -1008,3 +1016,5 @@ krb5_gss_use_kdc_context()
     k5_mutex_unlock(&kg_kdc_flag_mutex);
     return 0;
 }
+#endif
+
index 758cfbcb0f28459520fb9a3841f9e24d06a6b275..77cf0da5eef4dd503f80badedb01a116d93c3678 100644 (file)
@@ -366,8 +366,6 @@ static OM_uint32 k5glue_validate_cred
     k5glue_inquire_context,                            \
     k5glue_internal_release_oid,                       \
     k5glue_wrap_size_limit,                            \
-    NULL,                      /* pname_to_uid */      \
-    NULL,                      /* userok */            \
     k5glue_export_name,                                        \
     NULL                       /* store_cred */
 
@@ -396,7 +394,7 @@ static gss_mechanism krb5_mech_configs[] = {
 #ifdef MS_BUG_TEST
 static gss_mechanism krb5_mech_configs_hack[] = {
     &krb5_mechanism, &krb5_mechanism_old, NULL
-}
+};
 #endif
 
 #if 1
index eb7dce968d17aee5404d45efa5506b68a09ab4d8..2d6199cde4e5bdb89d578c9ae7a2c87dd40683b4 100644 (file)
@@ -68,43 +68,6 @@ gss_verify
 gss_verify_mic
 gss_wrap
 gss_wrap_size_limit
-krb5_gss_accept_sec_context
-krb5_gss_acquire_cred
-krb5_gss_add_cred
-krb5_gss_canonicalize_name
-krb5_gss_compare_name
-krb5_gss_context_time
-krb5_gss_convert_static_mech_oid
 krb5_gss_dbg_client_expcreds
-krb5_gss_delete_sec_context
-krb5_gss_display_name
-krb5_gss_display_status
-krb5_gss_duplicate_name
-krb5_gss_export_name
-krb5_gss_export_sec_context
-krb5_gss_get_mic
-krb5_gss_import_name
-krb5_gss_import_sec_context
-krb5_gss_indicate_mechs
-krb5_gss_init_sec_context
-krb5_gss_inquire_context
-krb5_gss_inquire_cred
-krb5_gss_inquire_cred_by_mech
-krb5_gss_inquire_names_for_mech
-krb5_gss_oid_array
-krb5_gss_process_context_token
 krb5_gss_register_acceptor_identity
-krb5_gss_release_cred
-krb5_gss_release_name
-krb5_gss_release_oid
-krb5_gss_seal
-krb5_gss_ser_init
-krb5_gss_sign
-krb5_gss_unseal
-krb5_gss_unwrap
-krb5_gss_validate_cred
-krb5_gss_verify
-krb5_gss_verify_mic
-krb5_gss_wrap
-krb5_gss_wrap_size_limit
 krb5_gss_use_kdc_context
index 7d1c6136ce37c4acc5e513b86e18ccde6cf2cb4e..d1c137ac2b9d46911512cd37558ae29cc5f3fc74 100644 (file)
@@ -6,7 +6,8 @@ LOCALINCLUDES = -I. -I$(srcdir) -I$(srcdir)/.. -I../generic -I$(srcdir)/../gener
 DEFS=
 
 ##DOSBUILDTOP = ..\..\..
-##DOSLIBNAME=..\$(OUTPRE)gssapi.$(LIBEXT)
+##DOS##PREFIXDIR=mechglue
+##DOS##OBJFILE=..\$(OUTPRE)mechglue.lst
 
 ##DOS##DLL_EXP_TYPE=GSS
 
@@ -41,12 +42,43 @@ SRCS = \
        $(srcdir)/g_sign.c \
        $(srcdir)/g_store_cred.c \
        $(srcdir)/g_unseal.c \
-       $(srcdir)/g_userok.c \
-       $(srcdir)/g_utils.c \
        $(srcdir)/g_verify.c \
-       $(srcdir)/gssd_pname_to_uid.c \
        $(srcdir)/oid_ops.c
 
+OBJS = \
+       $(OUTPRE)g_accept_sec_context.$(OBJEXT) \
+       $(OUTPRE)g_acquire_cred.$(OBJEXT) \
+       $(OUTPRE)g_canon_name.$(OBJEXT) \
+       $(OUTPRE)g_compare_name.$(OBJEXT) \
+       $(OUTPRE)g_context_time.$(OBJEXT) \
+       $(OUTPRE)g_delete_sec_context.$(OBJEXT) \
+       $(OUTPRE)g_dsp_name.$(OBJEXT) \
+       $(OUTPRE)g_dsp_status.$(OBJEXT) \
+       $(OUTPRE)g_dup_name.$(OBJEXT) \
+       $(OUTPRE)g_exp_sec_context.$(OBJEXT) \
+       $(OUTPRE)g_export_name.$(OBJEXT) \
+       $(OUTPRE)g_glue.$(OBJEXT) \
+       $(OUTPRE)g_imp_name.$(OBJEXT) \
+       $(OUTPRE)g_imp_sec_context.$(OBJEXT) \
+       $(OUTPRE)g_init_sec_context.$(OBJEXT) \
+       $(OUTPRE)g_initialize.$(OBJEXT) \
+       $(OUTPRE)g_inq_context.$(OBJEXT) \
+       $(OUTPRE)g_inq_cred.$(OBJEXT) \
+       $(OUTPRE)g_inq_names.$(OBJEXT) \
+       $(OUTPRE)g_mechname.$(OBJEXT) \
+       $(OUTPRE)g_oid_ops.$(OBJEXT) \
+       $(OUTPRE)g_process_context.$(OBJEXT) \
+       $(OUTPRE)g_rel_buffer.$(OBJEXT) \
+       $(OUTPRE)g_rel_cred.$(OBJEXT) \
+       $(OUTPRE)g_rel_name.$(OBJEXT) \
+       $(OUTPRE)g_rel_oid_set.$(OBJEXT) \
+       $(OUTPRE)g_seal.$(OBJEXT) \
+       $(OUTPRE)g_sign.$(OBJEXT) \
+       $(OUTPRE)g_store_cred.$(OBJEXT) \
+       $(OUTPRE)g_unseal.$(OBJEXT) \
+       $(OUTPRE)g_verify.$(OBJEXT) \
+       $(OUTPRE)oid_ops.$(OBJEXT)
+
 STLIBOBJS = \
        g_accept_sec_context.o \
        g_acquire_cred.o \
@@ -78,17 +110,18 @@ STLIBOBJS = \
        g_sign.o \
        g_store_cred.o \
        g_unseal.o \
-       g_userok.o \
-       g_utils.o \
        g_verify.o \
-       gssd_pname_to_uid.o \
        oid_ops.o
 
 EHDRDIR= $(BUILDTOP)$(S)include$(S)gssapi
 EXPORTED_HEADERS = mechglue.h
 
+$(OBJS): $(EXPORTED_HEADERS)
+
 all-unix:: all-libobjs
 
+##DOS##LIBOBJS = $(OBJS)
+
 clean-unix:: clean-libobjs
 
 # Krb5InstallHeaders($(EXPORTED_HEADERS), $(KRB5_INCDIR)/krb5)
@@ -100,7 +133,7 @@ install::
 
 includes::
 
-@libobj_frag@
+@libobj_frag@
 # +++ Dependency line eater +++
 # 
 # Makefile dependencies follow.  This must be the last section in
@@ -200,8 +233,8 @@ g_initialize.so g_initialize.po $(OUTPRE)g_initialize.$(OBJEXT): \
   $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
   $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
   $(srcdir)/../generic/gssapiP_generic.h $(srcdir)/../generic/gssapi_generic.h \
-  ../generic/gssapi_err_generic.h g_initialize.c mechglue.h \
-  mglueP.h
+  $(srcdir)/../gss_libinit.h ../generic/gssapi.h ../generic/gssapi_err_generic.h \
+  g_initialize.c mechglue.h mglueP.h
 g_inq_context.so g_inq_context.po $(OUTPRE)g_inq_context.$(OBJEXT): \
   $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
   $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
@@ -286,26 +319,12 @@ g_unseal.so g_unseal.po $(OUTPRE)g_unseal.$(OBJEXT): \
   $(srcdir)/../generic/gssapiP_generic.h $(srcdir)/../generic/gssapi_generic.h \
   ../generic/gssapi_err_generic.h g_unseal.c mechglue.h \
   mglueP.h
-g_userok.so g_userok.po $(OUTPRE)g_userok.$(OBJEXT): \
-  $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
-  $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
-  $(srcdir)/../generic/gssapiP_generic.h $(srcdir)/../generic/gssapi_generic.h \
-  ../generic/gssapi_err_generic.h g_userok.c mechglue.h \
-  mglueP.h
-g_utils.so g_utils.po $(OUTPRE)g_utils.$(OBJEXT): $(BUILDTOP)/include/gssapi/gssapi.h \
-  g_utils.c
 g_verify.so g_verify.po $(OUTPRE)g_verify.$(OBJEXT): \
   $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
   $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
   $(srcdir)/../generic/gssapiP_generic.h $(srcdir)/../generic/gssapi_generic.h \
   ../generic/gssapi_err_generic.h g_verify.c mechglue.h \
   mglueP.h
-gssd_pname_to_uid.so gssd_pname_to_uid.po $(OUTPRE)gssd_pname_to_uid.$(OBJEXT): \
-  $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
-  $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
-  $(srcdir)/../generic/gssapiP_generic.h $(srcdir)/../generic/gssapi_generic.h \
-  ../generic/gssapi_err_generic.h gssd_pname_to_uid.c \
-  mechglue.h mglueP.h
 oid_ops.so oid_ops.po $(OUTPRE)oid_ops.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
   $(BUILDTOP)/include/gssapi/gssapi.h $(BUILDTOP)/include/gssapi/gssapi_generic.h \
   $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-thread.h \
diff --git a/src/lib/gssapi/mechglue/g_indicate_mechs.c b/src/lib/gssapi/mechglue/g_indicate_mechs.c
deleted file mode 100644 (file)
index e2c8d41..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* #ident  "@(#)gss_indicate_mechs.c 1.13     95/08/04 SMI" */
-
-/*
- * Copyright 1996 by Sun Microsystems, Inc.
- * 
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appears in all copies and
- * that both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Sun Microsystems not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. Sun Microsystems makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- * 
- * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- *  glue routine for gss_indicate_mechs
- */
-
-#include "mglueP.h"
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-
-extern gss_mechanism *gssint_mechs_array;
-
-static gss_OID_set_desc        supported_mechs_desc; 
-static gss_OID_set supported_mechs = NULL;
-
-OM_uint32 KRB5_CALLCONV
-gss_indicate_mechs (minor_status,
-                    mech_set)
-
-OM_uint32 *            minor_status;
-gss_OID_set *          mech_set;
-
-{
-    int i;
-    
-    gss_initialize();
-
-    if (minor_status)
-       *minor_status = 0;
-
-    /*
-     * If we have already computed the mechanisms supported, return
-     * a pointer to it. Otherwise, compute them and return the pointer.
-     */
-    
-    if(supported_mechs == NULL) {
-
-       supported_mechs = &supported_mechs_desc;
-       supported_mechs->count = 0;
-
-       /* Build the mech_set from the OIDs in mechs_array. */
-
-       for(i=0; gssint_mechs_array[i]->mech_type.length != 0; i++) 
-           supported_mechs->count++;
-
-       supported_mechs->elements =
-           (void *) malloc(supported_mechs->count *
-                           sizeof(gss_OID_desc));
-
-       for(i=0; i < supported_mechs->count; i++) {
-           supported_mechs->elements[i].length =
-               gssint_mechs_array[i]->mech_type.length;
-           supported_mechs->elements[i].elements = (void *)
-               malloc(gssint_mechs_array[i]->mech_type.length);
-           memcpy(supported_mechs->elements[i].elements,
-                  gssint_mechs_array[i]->mech_type.elements,
-                  gssint_mechs_array[i]->mech_type.length);
-       }
-    }
-    
-    if(mech_set != NULL)
-       *mech_set = supported_mechs;
-    
-    return(GSS_S_COMPLETE);
-}
index 21677562756034eff3df5779d3f18cc991fc7287..89134a6cd5dc80c34e329e76d2c7bee95dbe0004 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include "mglueP.h"
+#include "gss_libinit.h"
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
 #include <ctype.h>
 #include <errno.h>
 
-#include <dlfcn.h>
-
-#define        MECH_CONF "/etc/gss/mech"
-
-#define        MECH_LIB_PREFIX1        "/usr/lib/"
-
-#define        MECH_LIB_PREFIX2        ""
-
-#define        MECH_LIB_DIR            "gss/"
-
-#define        MECH_LIB_PREFIX MECH_LIB_PREFIX1 MECH_LIB_PREFIX2 MECH_LIB_DIR
-
-#define MECH_SYM "gss_mech_initialize"
-
 #define        M_DEFAULT       "default"
 
-#include <sys/stat.h>
-
 #include "k5-thread.h"
 
 /* Local functions */
 static gss_mech_info searchMechList(const gss_OID);
-static void loadConfigFile(const char *);
 static void updateMechList(void);
 static void register_mech(gss_mechanism, const char *, void *);
 
@@ -72,9 +56,7 @@ static void init_hardcoded(void);
 static gss_mech_info g_mechList = NULL;
 static gss_mech_info g_mechListTail = NULL;
 static k5_mutex_t g_mechListLock = K5_MUTEX_PARTIAL_INITIALIZER;
-static time_t g_confFileModTime = (time_t)0;
 
-static time_t g_mechSetTime = (time_t)0;
 static gss_OID_set_desc g_mechSet = { 0, NULL };
 static k5_mutex_t g_mechSetLock = K5_MUTEX_PARTIAL_INITIALIZER;
 
@@ -154,8 +136,6 @@ gss_indicate_mechs(minorStatus, mechSet)
 OM_uint32 *minorStatus;
 gss_OID_set *mechSet;
 {
-       char *fileName;
-       struct stat fileInfo;
        int i, j;
        gss_OID curItem;
 
@@ -171,18 +151,6 @@ gss_OID_set *mechSet;
        if (mechSet == NULL)
                return (GSS_S_CALL_INACCESSIBLE_WRITE);
 
-       fileName = MECH_CONF;
-
-#if 0
-       /*
-        * If we have already computed the mechanisms supported and if it
-        * is still valid; make a copy and return to caller,
-        * otherwise build it first.
-        */
-       if ((stat(fileName, &fileInfo) == 0 &&
-               fileInfo.st_mtime > g_mechSetTime)) {
-       } /* if g_mechSet is out of date or not initialized */
-#endif
        if (build_mechSet())
                return GSS_S_FAILURE;
 
@@ -261,20 +229,6 @@ build_mechSet(void)
         */
        (void) k5_mutex_lock(&g_mechListLock);
 
-#if 0
-       /*
-        * this checks for the case when we need to re-construct the
-        * g_mechSet structure, but the mechanism list is upto date
-        * (because it has been read by someone calling
-        * gssint_get_mechanism)
-        */
-       if (fileInfo.st_mtime > g_confFileModTime)
-       {
-               g_confFileModTime = fileInfo.st_mtime;
-               loadConfigFile(fileName);
-       }
-#endif
-
        updateMechList();
 
        /*
@@ -343,9 +297,6 @@ build_mechSet(void)
                }
        }
 
-#if 0
-       g_mechSetTime = fileInfo.st_mtime;
-#endif
        (void) k5_mutex_unlock(&g_mechSetLock);
        (void) k5_mutex_unlock(&g_mechListLock);
 
@@ -491,20 +442,9 @@ gssint_get_mechanisms(char *mechArray[], int arrayLen)
 static void
 updateMechList(void)
 {
-       char *fileName;
-       struct stat fileInfo;
 
        init_hardcoded();
-       fileName = MECH_CONF;
-
-#if 0
-       /* check if mechList needs updating */
-       if (stat(fileName, &fileInfo) == 0 &&
-               (fileInfo.st_mtime > g_confFileModTime)) {
-               loadConfigFile(fileName);
-               g_confFileModTime = fileInfo.st_mtime;
-       }
-#endif
+
 } /* updateMechList */
 
 /*
@@ -560,7 +500,6 @@ init_hardcoded(void)
        extern gss_mechanism *spnego_gss_get_mech_configs(void);
        gss_mechanism *cflist;
        static int inited;
-       gss_mech_info cf;
 
        if (inited)
                return;
@@ -589,12 +528,9 @@ init_hardcoded(void)
  * module if it has not been already loaded.
  */
 gss_mechanism
-gssint_get_mechanism(oid)
-const gss_OID oid;
+gssint_get_mechanism(gss_OID oid)
 {
        gss_mech_info aMech;
-       gss_mechanism (*sym)(const gss_OID);
-       void *dl;
 
        if (gssint_initialize_library())
                return NULL;
@@ -624,100 +560,11 @@ const gss_OID oid;
        if (aMech->mech) {
                (void) k5_mutex_unlock(&g_mechListLock);
                return (aMech->mech);
+       } else {
+               return NULL;
        }
-
-       /* we found the mechanism, but it is not loaded */
-       if ((dl = dlopen(aMech->uLibName, RTLD_NOW)) == NULL) {
-#if 0
-               (void) syslog(LOG_INFO, "libgss dlopen(%s): %s\n",
-                               aMech->uLibName, dlerror());
-#endif
-               (void) k5_mutex_unlock(&g_mechListLock);
-               return ((gss_mechanism)NULL);
-       }
-
-       if ((sym = (gss_mechanism (*)(const gss_OID))dlsym(dl, MECH_SYM))
-                       == NULL) {
-               (void) dlclose(dl);
-#if 0
-               (void) syslog(LOG_INFO, "unable to initialize mechanism"
-                               " library [%s]\n", aMech->uLibName);
-#endif
-               (void) k5_mutex_unlock(&g_mechListLock);
-               return ((gss_mechanism)NULL);
-       }
-
-       /* Call the symbol to get the mechanism table */
-       aMech->mech = (*sym)(aMech->mech_type);
-
-       if (aMech->mech == NULL) {
-               (void) dlclose(dl);
-#if 0
-               (void) syslog(LOG_INFO, "unable to initialize mechanism"
-                               " library [%s]\n", aMech->uLibName);
-#endif
-               (void) k5_mutex_unlock(&g_mechListLock);
-               return ((gss_mechanism)NULL);
-       }
-
-       aMech->dl_handle = dl;
-
-       (void) k5_mutex_unlock(&g_mechListLock);
-       return (aMech->mech);
 } /* gssint_get_mechanism */
 
-gss_mechanism_ext
-gssint_get_mechanism_ext(oid)
-const gss_OID oid;
-{
-       gss_mech_info aMech;
-       gss_mechanism_ext mech_ext;
-
-       /* check if the mechanism is already loaded */
-       if ((aMech = searchMechList(oid)) != NULL && aMech->mech_ext != NULL)
-               return (aMech->mech_ext);
-
-       if (gssint_get_mechanism(oid) == NULL)
-               return (NULL);
-
-       if (aMech->dl_handle == NULL)
-               return (NULL);
-
-       /* Load the gss_config_ext struct for this mech */
-
-       mech_ext = (gss_mechanism_ext)malloc(sizeof (struct gss_config_ext));
-
-       if (mech_ext == NULL)
-               return (NULL);
-
-       /*
-        * dlsym() the mech's 'method' functions for the extended APIs
-        *
-        * NOTE:  Until the void *context argument is removed from the
-        * SPI method functions' signatures it will be necessary to have
-        * different function pointer typedefs and function names for
-        * the SPI methods than for the API.  When this argument is
-        * removed it will be possible to rename gss_*_sfct to gss_*_fct
-        * and and gssspi_* to gss_*.
-        */
-       mech_ext->gss_acquire_cred_with_password =
-               (gss_acquire_cred_with_password_sfct)dlsym(aMech->dl_handle,
-                       "gssspi_acquire_cred_with_password");
-
-       /* Set aMech->mech_ext */
-       (void) k5_mutex_lock(&g_mechListLock);
-
-       if (aMech->mech_ext == NULL)
-               aMech->mech_ext = mech_ext;
-       else
-               free(mech_ext); /* we raced and lost; don't leak */
-
-       (void) k5_mutex_unlock(&g_mechListLock);
-
-       return (aMech->mech_ext);
-
-} /* gssint_get_mechanism_ext */
-
 
 /*
  * this routine is used for searching the list of mechanism data.
@@ -742,244 +589,3 @@ const gss_OID oid;
        /* none found */
        return ((gss_mech_info) NULL);
 } /* searchMechList */
-
-
-/*
- * loads the configuration file
- * this is called while having a mutex lock on the mechanism list
- * entries for libraries that have been loaded can't be modified
- * mechNameStr and mech_type fields are not updated during updates
- */
-static void loadConfigFile(fileName)
-const char *fileName;
-{
-       char buffer[BUFSIZ], *oidStr, *oid, *sharedLib, *kernMod, *endp;
-       char *modOptions;
-       char sharedPath[sizeof (MECH_LIB_PREFIX) + BUFSIZ];
-       char *tmpStr;
-       FILE *confFile;
-       gss_OID mechOid;
-       gss_mech_info aMech, tmp;
-       OM_uint32 minor;
-       gss_buffer_desc oidBuf;
-
-       if ((confFile = fopen(fileName, "r")) == NULL) {
-               return;
-       }
-
-       (void) memset(buffer, 0, sizeof (buffer));
-       while (fgets(buffer, BUFSIZ, confFile) != NULL) {
-
-               /* ignore lines beginning with # */
-               if (*buffer == '#')
-                       continue;
-
-               /*
-                * find the first white-space character after
-                * the mechanism name
-                */
-               oidStr = buffer;
-               for (oid = buffer; *oid && !isspace(*oid); oid++);
-
-               /* Now find the first non-white-space character */
-               if (*oid) {
-                       *oid = '\0';
-                       oid++;
-                       while (*oid && isspace(*oid))
-                               oid++;
-               }
-
-               /*
-                * If that's all, then this is a corrupt entry. Skip it.
-                */
-               if (! *oid)
-                       continue;
-
-               /* Find the end of the oid and make sure it is NULL-ended */
-               for (endp = oid; *endp && !isspace(*endp); endp++)
-                       ;
-
-               if (*endp) {
-                       *endp = '\0';
-               }
-
-               /*
-                * check if an entry for this oid already exists
-                * if it does, and the library is already loaded then
-                * we can't modify it, so skip it
-                */
-               oidBuf.value = (void *)oid;
-               oidBuf.length = strlen(oid);
-               if (generic_gss_str_to_oid(&minor, &oidBuf, &mechOid)
-                       != GSS_S_COMPLETE) {
-#if 0
-                       (void) syslog(LOG_INFO, "invalid mechanism oid"
-                                       " [%s] in configuration file", oid);
-#endif
-                       continue;
-               }
-
-               k5_mutex_lock(&g_mechListLock);
-               aMech = searchMechList(mechOid);
-               if (aMech && aMech->mech) {
-                       free(mechOid->elements);
-                       free(mechOid);
-                       k5_mutex_unlock(&g_mechListLock);
-                       continue;
-               }
-               k5_mutex_unlock(&g_mechListLock);
-
-               /* Find the start of the shared lib name */
-               for (sharedLib = endp+1; *sharedLib && isspace(*sharedLib);
-                       sharedLib++)
-                       ;
-
-               /*
-                * If that's all, then this is a corrupt entry. Skip it.
-                */
-               if (! *sharedLib) {
-                       free(mechOid->elements);
-                       free(mechOid);
-                       continue;
-               }
-
-               /*
-                * Find the end of the shared lib name and make sure it is
-                *  NULL-terminated.
-                */
-               for (endp = sharedLib; *endp && !isspace(*endp); endp++)
-                       ;
-
-               if (*endp) {
-                       *endp = '\0';
-               }
-
-               /* Find the start of the optional kernel module lib name */
-               for (kernMod = endp+1; *kernMod && isspace(*kernMod);
-                       kernMod++)
-                       ;
-
-               /*
-                * If this item starts with a bracket "[", then
-                * it is not a kernel module, but is a list of
-                * options for the user module to parse later.
-                */
-               if (*kernMod && *kernMod != '[') {
-                       /*
-                        * Find the end of the shared lib name and make sure
-                        * it is NULL-terminated.
-                        */
-                       for (endp = kernMod; *endp && !isspace(*endp); endp++)
-                               ;
-
-                       if (*endp) {
-                               *endp = '\0';
-                       }
-               } else
-                       kernMod = NULL;
-
-               /* Find the start of the optional module options list */
-               for (modOptions = endp+1; *modOptions && isspace(*modOptions);
-                       modOptions++);
-
-               if (*modOptions == '[')  {
-                       /* move past the opening bracket */
-                       for (modOptions = modOptions+1;
-                           *modOptions && isspace(*modOptions);
-                           modOptions++);
-
-                       /* Find the closing bracket */
-                       for (endp = modOptions;
-                               *endp && *endp != ']'; endp++);
-
-                       if (endp)
-                               *endp = '\0';
-
-               } else {
-                       modOptions = NULL;
-               }
-
-               (void) strcpy(sharedPath, MECH_LIB_PREFIX);
-               (void) strcat(sharedPath, sharedLib);
-
-               /*
-                * are we creating a new mechanism entry or
-                * just modifying existing (non loaded) mechanism entry
-                */
-               if (aMech) {
-                       /*
-                        * delete any old values and set new
-                        * mechNameStr and mech_type are not modified
-                        */
-                       if (aMech->kmodName) {
-                               free(aMech->kmodName);
-                               aMech->kmodName = NULL;
-                       }
-
-                       if (aMech->optionStr) {
-                               free(aMech->optionStr);
-                               aMech->optionStr = NULL;
-                       }
-
-                       if ((tmpStr = strdup(sharedPath)) != NULL) {
-                               if (aMech->uLibName)
-                                       free(aMech->uLibName);
-                               aMech->uLibName = tmpStr;
-                       }
-
-                       if (kernMod) /* this is an optional parameter */
-                               aMech->kmodName = strdup(kernMod);
-
-                       if (modOptions) /* optional module options */
-                               aMech->optionStr = strdup(modOptions);
-
-                       /* the oid is already set */
-                       free(mechOid->elements);
-                       free(mechOid);
-                       continue;
-               }
-
-               /* adding a new entry */
-               aMech = malloc(sizeof (struct gss_mech_config));
-               if (aMech == NULL) {
-                       free(mechOid->elements);
-                       free(mechOid);
-                       continue;
-               }
-               (void) memset(aMech, 0, sizeof (struct gss_mech_config));
-               aMech->mech_type = mechOid;
-               aMech->uLibName = strdup(sharedPath);
-               aMech->mechNameStr = strdup(oidStr);
-
-               /* check if any memory allocations failed - bad news */
-               if (aMech->uLibName == NULL || aMech->mechNameStr == NULL) {
-                       if (aMech->uLibName)
-                               free(aMech->uLibName);
-                       if (aMech->mechNameStr)
-                               free(aMech->mechNameStr);
-                       free(mechOid->elements);
-                       free(mechOid);
-                       free(aMech);
-                       continue;
-               }
-               if (kernMod)    /* this is an optional parameter */
-                       aMech->kmodName = strdup(kernMod);
-
-               if (modOptions)
-                       aMech->optionStr = strdup(modOptions);
-               /*
-                * add the new entry to the end of the list - make sure
-                * that only complete entries are added because other
-                * threads might currently be searching the list.
-                */
-               tmp = g_mechListTail;
-               g_mechListTail = aMech;
-
-               if (tmp != NULL)
-                       tmp->next = aMech;
-
-               if (g_mechList == NULL)
-                       g_mechList = aMech;
-       } /* while */
-       (void) fclose(confFile);
-} /* loadConfigFile */
diff --git a/src/lib/gssapi/mechglue/g_userok.c b/src/lib/gssapi/mechglue/g_userok.c
deleted file mode 100644 (file)
index 4657b8e..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-/* #pragma ident       "@(#)g_userok.c 1.1     04/03/25 SMI" */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <mglueP.h>
-#include <gssapi/gssapi.h>
-
-
-static OM_uint32
-compare_names(OM_uint32 *minor,
-           const gss_OID mech_type,
-           const gss_name_t name,
-           const char *user,
-           int *user_ok)
-{
-
-       OM_uint32 status, tmpMinor;
-       gss_name_t imported_name;
-       gss_name_t canon_name;
-       gss_buffer_desc gss_user;
-       int match = 0;
-
-       *user_ok = 0;
-
-       gss_user.value = (void *)user;
-       if (!gss_user.value || !name || !mech_type)
-               return (GSS_S_BAD_NAME);
-       gss_user.length = strlen(gss_user.value);
-
-       status = gss_import_name(minor,
-                               &gss_user,
-                               GSS_C_NT_USER_NAME,
-                               &imported_name);
-       if (status != GSS_S_COMPLETE) {
-               goto out;
-       }
-
-       status = gss_canonicalize_name(minor,
-                                   imported_name,
-                                   mech_type,
-                                   &canon_name);
-       if (status != GSS_S_COMPLETE) {
-               (void) gss_release_name(&tmpMinor, &imported_name);
-               goto out;
-       }
-
-       status = gss_compare_name(minor,
-                               canon_name,
-                               name,
-                               &match);
-       (void) gss_release_name(&tmpMinor, &canon_name);
-       (void) gss_release_name(&tmpMinor, &imported_name);
-       if (status == GSS_S_COMPLETE) {
-               if (match)
-                       *user_ok = 1; /* remote user is a-ok */
-       }
-
-out:
-       return (status);
-}
-
-
-OM_uint32
-gssint_userok(OM_uint32 *minor,
-           const gss_name_t name,
-           const char *user,
-           int *user_ok)
-
-{
-       gss_mechanism mech;
-       gss_union_name_t intName;
-       gss_name_t mechName = NULL;
-       OM_uint32 major;
-
-       if (minor == NULL || user_ok == NULL)
-               return (GSS_S_CALL_INACCESSIBLE_WRITE);
-
-       if (name == NULL || user == NULL)
-               return (GSS_S_CALL_INACCESSIBLE_READ);
-
-       *user_ok = 0;
-       *minor = GSS_S_COMPLETE;
-
-       intName = (gss_union_name_t)name;
-
-       mech = gssint_get_mechanism(intName->mech_type);
-       if (mech == NULL)
-               return (GSS_S_UNAVAILABLE);
-
-       /* may need to import the name if this is not MN */
-       if (intName->mech_type == NULL) {
-               return (GSS_S_FAILURE);
-       } else
-               mechName = intName->mech_name;
-
-       if (mech->gssint_userok)
-               major = mech->gssint_userok(mech->context,  minor, mechName,
-                               user, user_ok);
-       else
-               major = compare_names(minor, intName->mech_type,
-                                   name, user, user_ok);
-
-       return (major);
-} /* gss_userok */
diff --git a/src/lib/gssapi/mechglue/g_utils.c b/src/lib/gssapi/mechglue/g_utils.c
deleted file mode 100644 (file)
index 82fe70d..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-/* #pragma ident       "@(#)g_utils.c  1.8     04/02/23 SMI" */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <ctype.h>
-#include <errno.h>
-#include <gssapi/gssapi.h>
-
-#define        Q_DEFAULT               "default"
-#define        BUFLEN                  256
-
-#if 0
-static int qop_num_pair_cnt;
-static const char    QOP_NUM_FILE[] = "/etc/gss/qop";
-static qop_num qop_num_pairs[MAX_QOP_NUM_PAIRS+1];
-static mutex_t qopfile_lock = DEFAULTMUTEX;
-
-static OM_uint32 gssint_read_qop_file(void);
-
-/*
- * This routine fetches qop and num from "/etc/gss/qop".
- * There is a memory leak associated with rereading this file,
- * because we can't free the qop_num_pairs array when we reread
- * the file (some callers may have been given these pointers).
- * In general, this memory leak should be a small one, because
- * we don't expect the qop file to be changed and reread often.
- */
-static OM_uint32
-gssint_read_qop_file(void)
-{
-       char    buf[BUFLEN];    /* one line from the file */
-       char    *name, *next;
-       char    *qopname, *num_str;
-       char    *line;
-       FILE    *fp;
-       static int last = 0;
-       struct stat stbuf;
-       OM_uint32 major = GSS_S_COMPLETE;
-
-       (void) mutex_lock(&qopfile_lock);
-       if (stat(QOP_NUM_FILE, &stbuf) != 0 || stbuf.st_mtime < last) {
-               if (!qop_num_pairs[0].qop) {
-                       major = GSS_S_FAILURE;
-               }
-               goto done;
-       }
-       last = stbuf.st_mtime;
-
-       fp = fopen(QOP_NUM_FILE, "r");
-       if (fp == (FILE *)0) {
-               major = GSS_S_FAILURE;
-               goto done;
-       }
-
-       /*
-        * For each line in the file parse it appropriately.
-        * File format : qopname        num(int)
-        * Note that we silently ignore corrupt entries.
-        */
-       qop_num_pair_cnt = 0;
-       while (!feof(fp)) {
-               line = fgets(buf, BUFLEN, fp);
-               if (line == NULL)
-                       break;
-
-               /* Skip comments and blank lines */
-               if ((*line == '#') || (*line == '\n'))
-                       continue;
-
-               /* Skip trailing comments */
-               next = strchr(line, '#');
-               if (next)
-                       *next = '\0';
-
-               name = &(buf[0]);
-               while (isspace(*name))
-                       name++;
-               if (*name == '\0')      /* blank line */
-                       continue;
-
-               qopname = name; /* will contain qop name */
-               while (!isspace(*qopname))
-                       qopname++;
-               if (*qopname == '\0') {
-                       continue;
-               }
-               next = qopname+1;
-               *qopname = '\0';        /* null terminate qopname */
-               qop_num_pairs[qop_num_pair_cnt].qop = strdup(name);
-               if (qop_num_pairs[qop_num_pair_cnt].qop == NULL)
-                       continue;
-
-               name = next;
-               while (isspace(*name))
-                       name++;
-               if (*name == '\0') {    /* end of line, no num */
-                       free(qop_num_pairs[qop_num_pair_cnt].qop);
-                       continue;
-               }
-               num_str = name; /* will contain num (n) */
-               while (!isspace(*num_str))
-                       num_str++;
-               next = num_str+1;
-               *num_str++ = '\0';      /* null terminate num_str */
-
-               qop_num_pairs[qop_num_pair_cnt].num = (OM_uint32)atoi(name);
-               name = next;
-               while (isspace(*name))
-                       name++;
-               if (*name == '\0') {    /* end of line, no mechanism */
-                       free(qop_num_pairs[qop_num_pair_cnt].qop);
-                       continue;
-               }
-               num_str = name; /* will contain mech */
-               while (!isspace(*num_str))
-                       num_str++;
-               *num_str = '\0';
-
-               qop_num_pairs[qop_num_pair_cnt].mech = strdup(name);
-               if (qop_num_pairs[qop_num_pair_cnt].mech == NULL) {
-                       free(qop_num_pairs[qop_num_pair_cnt].qop);
-                       continue;
-               }
-
-               if (qop_num_pair_cnt++ >= MAX_QOP_NUM_PAIRS)
-                       break;
-       }
-       (void) fclose(fp);
-done:
-       (void) mutex_unlock(&qopfile_lock);
-       return (major);
-}
-
-OM_uint32
-gssint_qop_to_num(
-       char            *qop,
-       char            *mech,
-       OM_uint32       *num
-)
-{
-       int i;
-       OM_uint32 major = GSS_S_FAILURE;
-
-       if (!num)
-               return (GSS_S_CALL_INACCESSIBLE_WRITE);
-
-       if (qop == NULL || strlen(qop) == 0 ||
-                       strcasecmp(qop, Q_DEFAULT) == 0) {
-               *num = GSS_C_QOP_DEFAULT;
-               return (GSS_S_COMPLETE);
-       }
-
-       if ((major = gssint_read_qop_file()) != GSS_S_COMPLETE)
-               return (major);
-
-       for (i = 0; i < qop_num_pair_cnt; i++) {
-               if ((strcasecmp(mech, qop_num_pairs[i].mech) == 0) &&
-                   (strcasecmp(qop, qop_num_pairs[i].qop) == 0)) {
-                       *num = qop_num_pairs[i].num;
-                       return (GSS_S_COMPLETE);
-               }
-       }
-
-       return (GSS_S_FAILURE);
-}
-
-OM_uint32
-gssint_num_to_qop(
-       char            *mech,
-       OM_uint32       num,
-       char            **qop
-)
-{
-       int i;
-       OM_uint32 major;
-
-       if (!qop)
-               return (GSS_S_CALL_INACCESSIBLE_WRITE);
-       *qop = NULL;
-
-       if (num == GSS_C_QOP_DEFAULT) {
-               *qop = Q_DEFAULT;
-               return (GSS_S_COMPLETE);
-       }
-
-       if (mech == NULL)
-               return (GSS_S_CALL_INACCESSIBLE_READ);
-
-       if ((major = gssint_read_qop_file()) != GSS_S_COMPLETE)
-               return (major);
-
-       for (i = 0; i < qop_num_pair_cnt; i++) {
-               if ((strcasecmp(mech, qop_num_pairs[i].mech) == 0) &&
-                   (num == qop_num_pairs[i].num)) {
-                       *qop = qop_num_pairs[i].qop;
-                       return (GSS_S_COMPLETE);
-               }
-       }
-       return (GSS_S_FAILURE);
-}
-
-/*
- * For a given mechanism pass back qop information about it in a buffer
- * of size MAX_QOPS_PER_MECH+1.
- */
-OM_uint32
-gssint_get_mech_info(
-       char            *mech,
-       char            **qops
-)
-{
-       int i, cnt = 0;
-       OM_uint32 major = GSS_S_COMPLETE;
-
-       if (!qops)
-               return (GSS_S_CALL_INACCESSIBLE_WRITE);
-       *qops = NULL;
-
-       if (!mech)
-               return (GSS_S_CALL_INACCESSIBLE_READ);
-
-       if ((major = gssint_read_qop_file()) != GSS_S_COMPLETE)
-               return (major);
-
-       for (i = 0; i < qop_num_pair_cnt; i++) {
-               if (strcmp(mech, qop_num_pairs[i].mech) == 0) {
-                   if (cnt >= MAX_QOPS_PER_MECH) {
-                       return (GSS_S_FAILURE);
-                   }
-                   qops[cnt++] = qop_num_pairs[i].qop;
-               }
-       }
-       qops[cnt] = NULL;
-       return (GSS_S_COMPLETE);
-}
-
-/*
- * Copy the qop values and names for the mechanism back in a qop_num
- * buffer of size MAX_QOPS_PER_MECH provided by the caller.
- */
-OM_uint32
-gssint_mech_qops(
-       char *mech,
-       qop_num *mechqops,
-       int *numqop
-)
-{
-       int i;
-       OM_uint32 major;
-       int cnt = 0;
-
-       if (!mechqops || !numqop)
-               return (GSS_S_CALL_INACCESSIBLE_WRITE);
-       *numqop = 0;
-
-       if (!mech)
-               return (GSS_S_CALL_INACCESSIBLE_READ);
-
-       if ((major = gssint_read_qop_file()) != GSS_S_COMPLETE)
-               return (major);
-
-       for (i = 0; i < qop_num_pair_cnt; i++) {
-           if (strcasecmp(mech, qop_num_pairs[i].mech) == 0) {
-               if (cnt >= MAX_QOPS_PER_MECH) {
-                       return (GSS_S_FAILURE);
-               }
-               mechqops[cnt++] = qop_num_pairs[i];
-           }
-       }
-       *numqop = cnt;
-       return (GSS_S_COMPLETE);
-}
-#endif
diff --git a/src/lib/gssapi/mechglue/gen_oids.c b/src/lib/gssapi/mechglue/gen_oids.c
deleted file mode 100644 (file)
index cd3c1a8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 1993 by OpenVision Technologies, Inc.
- * 
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appears in all copies and
- * that both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of OpenVision not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. OpenVision makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- * 
- * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "mglueP.h"
-
-/*
- * See krb5/gssapi_krb5.c for a description of the algorithm for
- * encoding an object identifier.
- */
-
-/*
- * The OID of user_name is:
- *     iso(1) member-body(2) US(840) mit(113554) infosys(1) gssapi(2)
- *     generic(1) user_name(1) = 1.2.840.113554.1.2.1.1
- * machine_uid_name:
- *     iso(1) member-body(2) US(840) mit(113554) infosys(1) gssapi(2)
- *     generic(1) machine_uid_name(2) = 1.2.840.113554.1.2.1.2
- * string_uid_name:
- *     iso(1) member-body(2) US(840) mit(113554) infosys(1) gssapi(2)
- *     generic(1) string_uid_name(3) = 1.2.840.113554.1.2.1.3
- * service_name:
- *     iso(1) member-body(2) US(840) mit(113554) infosys(1) gssapi(2)
- *     generic(1) service_name(4) = 1.2.840.113554.1.2.1.4
- */
-
-static const gss_OID_desc oids[] = {
-   {10, "\052\206\110\206\367\022\001\002\001\001"},
-   {10, "\052\206\110\206\367\022\001\002\001\002"},
-   {10, "\052\206\110\206\367\022\001\002\001\003"},
-   {10, "\052\206\110\206\367\022\001\002\001\004"},
-};
-
-const gss_OID_desc * const gss_nt_user_name = oids+0;
-const gss_OID_desc * const gss_nt_machine_uid_name = oids+1;
-const gss_OID_desc * const gss_nt_string_uid_name = oids+2;
-const gss_OID_desc * const gss_nt_service_name = oids+3;
diff --git a/src/lib/gssapi/mechglue/gssd_pname_to_uid.c b/src/lib/gssapi/mechglue/gssd_pname_to_uid.c
deleted file mode 100644 (file)
index f15b16c..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* #pragma ident       "@(#)gssd_pname_to_uid.c        1.18    04/02/23 SMI" */
-
-/*
- * Copyright 1996 by Sun Microsystems, Inc.
- * 
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appears in all copies and
- * that both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Sun Microsystems not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. Sun Microsystems makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- * 
- * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- *  glue routines that test the mech id either passed in to
- *  gss_init_sec_contex() or gss_accept_sec_context() or within the glue
- *  routine supported version of the security context and then call
- *  the appropriate underlying mechanism library procedure. 
- *
- */
-
-#include "mglueP.h"
-
-int gssd_pname_to_uid(pname, name_type, mech_type, uid)
-
-char * pname;
-gss_OID name_type;
-gss_OID mech_type;
-uid_t * uid;
-{
-    int status;
-    gss_mechanism      mech;
-
-    /*
-     * find the appropriate mechanism specific pname_to_uid procedure and
-     * call it.
-     */
-
-    mech = gssint_get_mechanism (mech_type);
-
-    if (mech) {
-       if (mech_type == GSS_C_NULL_OID)
-           mech_type = &mech->mech_type;
-
-       if (mech->pname_to_uid)
-               status = mech->pname_to_uid(mech->context,
-                                       pname, name_type, mech_type, uid);
-       else
-           status = GSS_S_BAD_MECH;
-    } else
-       status = GSS_S_BAD_MECH;
-
-    return(status);
-}
index 691b30a96c98e9b164931b5297e2cd4de806b1bd..4f4cd481cb42e37692226effd440b7ec7c638f3a 100644 (file)
@@ -35,7 +35,4 @@
 /* GSSAPI Extension functions -- these functions aren't */
 /* in the GSSAPI, but they are provided in this library */
 
-int gssd_pname_to_uid (char *, gss_OID, gss_OID, uid_t *);
-void gss_initialize (void);
-
 #endif /* _GSS_MECHGLUE_H */
index bfee2524a8ab3f996e12b049f4a3ade6ccba84c6..2becac9608bcd2f6d27672a10bcce747f0ed0c63 100644 (file)
@@ -76,19 +76,6 @@ typedef struct gss_union_cred_t {
        gss_union_cred_auxinfo  auxinfo;
 } gss_union_cred_desc, *gss_union_cred_t;
  
-typedef        OM_uint32           (*gss_acquire_cred_with_password_sfct)(
-                   void *,             /* context */
-                   OM_uint32 *,        /* minor_status */
-                   const gss_name_t,   /* desired_name */
-                   const gss_buffer_t, /* password */
-                   OM_uint32,          /* time_req */
-                   const gss_OID_set,  /* desired_mechs */
-                   int,                /* cred_usage */
-                   gss_cred_id_t *,    /* output_cred_handle */
-                   gss_OID_set *,      /* actual_mechs */
-                   OM_uint32 *         /* time_rec */
-       /* */);
-
 /********************************************************/
 /* The Mechanism Dispatch Table -- a mechanism needs to */
 /* define one of these and provide a function to return */
@@ -352,22 +339,6 @@ typedef struct gss_config {
                    OM_uint32,          /* req_output_size */
                    OM_uint32 *         /* max_input_size */
         );
-    int                     (*pname_to_uid)
-       (
-                   void *,             /* context */
-                   char *,             /* pname */
-                   gss_OID,            /* name type */
-                   gss_OID,            /* mech type */
-                   uid_t *             /* uid */
-                   );
-       OM_uint32               (*gssint_userok)
-       (
-                   void *,             /* context */
-                   OM_uint32 *,        /* minor_status */
-                   const gss_name_t,   /* pname */
-                   const char *,       /* local user */
-                   int *               /* user ok? */
-       /* */);
        OM_uint32               (*gss_export_name)
        (
                void *,                 /* context */
@@ -389,11 +360,6 @@ typedef struct gss_config {
        /* */);
 } *gss_mechanism;
 
-/* This structure MUST NOT be used by any code outside libgss */
-typedef struct gss_config_ext {
-       gss_acquire_cred_with_password_sfct     gss_acquire_cred_with_password;
-} *gss_mechanism_ext;
-
 /*
  * In the user space we use a wrapper structure to encompass the
  * mechanism entry points.  The wrapper contain the mechanism
@@ -409,7 +375,6 @@ typedef struct gss_mech_config {
        void *dl_handle;                /* RTLD object handle for the mech */
        gss_OID mech_type;              /* mechanism oid */
        gss_mechanism mech;             /* mechanism initialization struct */
-       gss_mechanism_ext mech_ext;     /* extensions */
        struct gss_mech_config *next;   /* next element in the list */
 } *gss_mech_info;
 
@@ -420,7 +385,6 @@ int gssint_mechglue_init(void);
 void gssint_mechglue_fini(void);
 
 gss_mechanism gssint_get_mechanism (gss_OID);
-gss_mechanism_ext gssint_get_mechanism_ext(const gss_OID);
 OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
 char *gssint_get_kmodName(const gss_OID);
 char *gssint_get_modOptions(const gss_OID);
@@ -484,14 +448,6 @@ gssint_get_mechanisms(
        int arrayLen                    /* length of passed in array */
 );
 
-OM_uint32
-gssint_userok(
-       OM_uint32 *,            /* minor */
-       const gss_name_t,       /* name */
-       const char *,           /* user */
-       int *                   /* user_ok */
-);
-
 OM_uint32
 gss_store_cred(
        OM_uint32 *,            /* minor_status */
index ba6fe9ad0a12452d34346200bf45c4a9d0b78b12..11b91aae958d01113a1091d8b32eeed7c64f9e66 100644 (file)
@@ -18,9 +18,11 @@ STLIBOBJS = spnego_mech.o
 
 all-unix:: all-libobjs
 
+##DOS##LIBOBJS = $(OBJS)
+
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 # +++ Dependency line eater +++
 # 
 # Makefile dependencies follow.  This must be the last section in
@@ -28,8 +30,12 @@ clean-unix:: clean-libobjs
 #
 spnego_mech.so spnego_mech.po $(OUTPRE)spnego_mech.$(OBJEXT): \
   $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \
-  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(SRCTOP)/include/k5-platform.h \
-  $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/krb5.h \
+  $(BUILDTOP)/include/krb5/krb5.h $(BUILDTOP)/include/osconf.h \
+  $(BUILDTOP)/include/profile.h $(COM_ERR_DEPS) $(SRCTOP)/include/k5-err.h \
+  $(SRCTOP)/include/k5-int.h $(SRCTOP)/include/k5-platform.h \
+  $(SRCTOP)/include/k5-plugin.h $(SRCTOP)/include/k5-thread.h \
+  $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \
+  $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \
   $(SRCTOP)/include/syslog.h $(srcdir)/../generic/gssapiP_generic.h \
   $(srcdir)/../generic/gssapi_generic.h $(srcdir)/../mechglue/mechglue.h \
   $(srcdir)/../mechglue/mglueP.h ../generic/gssapi_err_generic.h \
index 2d3e5e20b39d360ef2a45ae28860ab50e6d4524f..1c8fd7a7b5e5f7ed597dd741c662fe9a78b7e0de 100644 (file)
@@ -117,10 +117,6 @@ static const gss_OID_set_desc spnego_oidsets[] = {
 };
 const gss_OID_set_desc * const gss_mech_set_spnego = spnego_oidsets+0;
 
-#define        TWRITE_STR(ptr, str, len) \
-       memcpy((ptr), (char *)(str), (len)); \
-       (ptr) += (len);
-
 #ifdef DEBUG
 #define        dsyslog(a) syslog(LOG_DEBUG, a)
 #else
index ec8b6083a95e375a283ea5614b7a997fb649a69c..0db0b5f92b372c8c1c2ef0c75240c66e42223691 100644 (file)
 #include       <stdio.h>
 #include       <stdlib.h>
 #include       <string.h>
+#include       <k5-int.h>
 #include       <krb5.h>
-#include       "gssapiP_spnego.h"
 #include       <mglueP.h>
+#include       "gssapiP_spnego.h"
 #include       <gssapi_err_generic.h>
 
 #undef g_token_size
@@ -61,24 +62,26 @@ extern int gssint_put_der_length(OM_uint32, unsigned char **, OM_uint32);
 static spnego_token_t make_spnego_token(char *);
 static gss_buffer_desc make_err_msg(char *);
 static int g_token_size(gss_OID_const, OM_uint32);
-static int g_make_token_header(gss_OID_const, int, unsigned char **, int);
-static int g_verify_token_header(gss_OID_const, int *, unsigned char **,
-                                int, int);
-static int g_verify_neg_token_init(unsigned char **, int);
+static int g_make_token_header(gss_OID_const, unsigned int,
+                              unsigned char **, unsigned int);
+static int g_verify_token_header(gss_OID_const, unsigned int *,
+                                unsigned char **,
+                                int, unsigned int);
+static int g_verify_neg_token_init(unsigned char **, unsigned int);
 static gss_OID get_mech_oid(OM_uint32 *, unsigned char **, size_t);
-static gss_buffer_t get_input_token(unsigned char **, int);
-static gss_OID_set get_mech_set(OM_uint32 *, unsigned char **, int);
+static gss_buffer_t get_input_token(unsigned char **, unsigned int);
+static gss_OID_set get_mech_set(OM_uint32 *, unsigned char **, unsigned int);
 static OM_uint32 get_req_flags(unsigned char **, OM_uint32, OM_uint32 *);
 static OM_uint32 get_available_mechs(OM_uint32 *, gss_name_t,
        gss_cred_usage_t, gss_cred_id_t *, gss_OID_set *);
 static void release_spnego_ctx(spnego_gss_ctx_id_t *);
 static void check_spnego_options(spnego_gss_ctx_id_t);
 static spnego_gss_ctx_id_t create_spnego_ctx(void);
-static int put_req_flags(unsigned char **, OM_uint32, int);
+static int put_req_flags(unsigned char **, OM_uint32, unsigned int);
 static int put_mech_set(gss_OID_set mechSet, gss_buffer_t buf);
-static int put_input_token(unsigned char **, gss_buffer_t, int);
-static int put_mech_oid(unsigned char **, gss_OID_const, int);
-static int put_negResult(unsigned char **, OM_uint32, int);
+static int put_input_token(unsigned char **, gss_buffer_t, unsigned int);
+static int put_mech_oid(unsigned char **, gss_OID_const, unsigned int);
+static int put_negResult(unsigned char **, OM_uint32, unsigned int);
 
 static OM_uint32
 process_mic(OM_uint32 *, gss_buffer_t, spnego_gss_ctx_id_t,
@@ -129,7 +132,7 @@ static gss_OID
 negotiate_mech_type(OM_uint32 *, gss_OID_set, gss_OID_set,
                OM_uint32 *);
 static int
-g_get_tag_and_length(unsigned char **, int, int, int *);
+g_get_tag_and_length(unsigned char **, int, unsigned int, unsigned int *);
 
 static int
 make_spnego_tokenInit_msg(spnego_gss_ctx_id_t, gss_buffer_t,
@@ -184,8 +187,6 @@ static struct gss_config spnego_mechanism =
        spnego_gss_inquire_context,     /* gss_inquire_context */
        NULL,                           /* gss_internal_release_oid */
        spnego_gss_wrap_size_limit,     /* gss_wrap_size_limit */
-       NULL,                           /* gss_pname_to_uid */
-       NULL,                           /* gssint_userok */
        NULL,                           /* gss_export_name */
        NULL,                           /* gss_store_cred */
 };
@@ -976,7 +977,7 @@ acc_ctx_cont(OM_uint32 *minstat,
        OM_uint32 ret, tmpmin;
        gss_OID supportedMech;
        spnego_gss_ctx_id_t sc;
-       int len;
+       unsigned int len;
        unsigned char *ptr, *bufstart;
 
        sc = (spnego_gss_ctx_id_t)*ctx;
@@ -1779,7 +1780,7 @@ get_mech_oid(OM_uint32 *minor_status, unsigned char **buff_in, size_t length)
  */
 
 static int
-put_mech_oid(unsigned char **buf_out, gss_OID_const mech, int buflen)
+put_mech_oid(unsigned char **buf_out, gss_OID_const mech, unsigned int buflen)
 {
        if (buflen < mech->length + 2)
                return (-1);
@@ -1797,7 +1798,7 @@ put_mech_oid(unsigned char **buf_out, gss_OID_const mech, int buflen)
  * buffer pointer.
  */
 static gss_buffer_t
-get_input_token(unsigned char **buff_in, int buff_length)
+get_input_token(unsigned char **buff_in, unsigned int buff_length)
 {
        gss_buffer_t input_token;
        unsigned int bytes;
@@ -1836,7 +1837,7 @@ get_input_token(unsigned char **buff_in, int buff_length)
 
 static int
 put_input_token(unsigned char **buf_out, gss_buffer_t input_token,
-               int buflen)
+               unsigned int buflen)
 {
        int ret;
 
@@ -1851,7 +1852,7 @@ put_input_token(unsigned char **buf_out, gss_buffer_t input_token,
        if ((ret = gssint_put_der_length(input_token->length, buf_out,
                            input_token->length)))
                return (ret);
-       TWRITE_STR(*buf_out, input_token->value, ((int)input_token->length));
+       TWRITE_STR(*buf_out, input_token->value, input_token->length);
        return (0);
 }
 
@@ -1862,7 +1863,8 @@ put_input_token(unsigned char **buf_out, gss_buffer_t input_token,
  * return it, advancing the buffer pointer.
  */
 static gss_OID_set
-get_mech_set(OM_uint32 *minor_status, unsigned char **buff_in, int buff_length)
+get_mech_set(OM_uint32 *minor_status, unsigned char **buff_in,
+            unsigned int buff_length)
 {
        gss_OID_set returned_mechSet;
        OM_uint32 major_status;
@@ -1908,7 +1910,8 @@ static int
 put_mech_set(gss_OID_set mechSet, gss_buffer_t buf)
 {
        unsigned char *ptr;
-       int i, tlen, ilen;
+       int i;
+       unsigned int tlen, ilen;
 
        tlen = ilen = 0;
        for (i = 0; i < mechSet->count; i++) {
@@ -1952,8 +1955,7 @@ static OM_uint32
 get_req_flags(unsigned char **buff_in, OM_uint32 bodysize,
              OM_uint32 *req_flags)
 {
-       int len;
-       unsigned char *start = *buff_in;
+       unsigned int len;
 
        if (**buff_in != (CONTEXT | 0x01))
                return (0);
@@ -1981,7 +1983,8 @@ get_req_flags(unsigned char **buff_in, OM_uint32 bodysize,
  */
 
 static int
-put_req_flags(unsigned char **buf_out, OM_uint32 req_flags, int buflen)
+put_req_flags(unsigned char **buf_out, OM_uint32 req_flags,
+             unsigned int buflen)
 {
        int ret = 0;
        if (buflen < 6)
@@ -2009,7 +2012,7 @@ get_negTokenInit(OM_uint32 *minor_status,
 {
        OM_uint32 err;
        unsigned char *ptr, *bufstart;
-       int len;
+       unsigned int len;
        gss_buffer_desc tmpbuf;
 
        *minor_status = 0;
@@ -2022,7 +2025,7 @@ get_negTokenInit(OM_uint32 *minor_status,
        ptr = bufstart = buf->value;
        if ((buf->length - (ptr - bufstart)) > INT_MAX)
                return GSS_S_FAILURE;
-#define REMAIN ((int)(buf->length - (ptr - bufstart)))
+#define REMAIN (buf->length - (ptr - bufstart))
 
        err = g_verify_token_header(gss_mech_spnego,
                                    &len, &ptr, 0, REMAIN);
@@ -2079,8 +2082,9 @@ get_negTokenResp(OM_uint32 *minor_status,
                 gss_buffer_t *mechListMIC)
 {
        unsigned char *ptr, *bufstart;
-       int len, bytes;
-       unsigned int tag;
+       unsigned int len;
+       int tmplen;
+       unsigned int tag, bytes;
 
        *negState = ACCEPT_DEFECTIVE_TOKEN;
        *supportedMech = GSS_C_NO_OID;
@@ -2091,8 +2095,8 @@ get_negTokenResp(OM_uint32 *minor_status,
        if (g_get_tag_and_length(&ptr, (CONTEXT | 0x01), REMAIN, &len) < 0)
                return GSS_S_DEFECTIVE_TOKEN;
        if (*ptr++ == SEQUENCE) {
-               len = gssint_get_der_length(&ptr, REMAIN, &bytes);
-               if (len < 0)
+               tmplen = gssint_get_der_length(&ptr, REMAIN, &bytes);
+               if (tmplen < 0)
                        return GSS_S_DEFECTIVE_TOKEN;
        }
        if (REMAIN < 1)
@@ -2101,8 +2105,8 @@ get_negTokenResp(OM_uint32 *minor_status,
                tag = *ptr++;
 
        if (tag == CONTEXT) {
-               len = gssint_get_der_length(&ptr, REMAIN, &bytes);
-               if (len < 0)
+               tmplen = gssint_get_der_length(&ptr, REMAIN, &bytes);
+               if (tmplen < 0)
                        return GSS_S_DEFECTIVE_TOKEN;
 
                if (g_get_tag_and_length(&ptr, ENUMERATED,
@@ -2122,8 +2126,8 @@ get_negTokenResp(OM_uint32 *minor_status,
                        tag = *ptr++;
        }
        if (tag == (CONTEXT | 0x01)) {
-               len = gssint_get_der_length(&ptr, REMAIN, &bytes);
-               if (len < 0)
+               tmplen = gssint_get_der_length(&ptr, REMAIN, &bytes);
+               if (tmplen < 0)
                        return GSS_S_DEFECTIVE_TOKEN;
 
                *supportedMech = get_mech_oid(minor_status, &ptr, REMAIN);
@@ -2136,8 +2140,8 @@ get_negTokenResp(OM_uint32 *minor_status,
                        tag = *ptr++;
        }
        if (tag == (CONTEXT | 0x02)) {
-               len = gssint_get_der_length(&ptr, REMAIN, &bytes);
-               if (len < 0)
+               tmplen = gssint_get_der_length(&ptr, REMAIN, &bytes);
+               if (tmplen < 0)
                        return GSS_S_DEFECTIVE_TOKEN;
 
                *responseToken = get_input_token(&ptr, REMAIN);
@@ -2150,8 +2154,8 @@ get_negTokenResp(OM_uint32 *minor_status,
                        tag = *ptr++;
        }
        if (tag == (CONTEXT | 0x03)) {
-               len = gssint_get_der_length(&ptr, REMAIN, &bytes);
-               if (len < 0)
+               tmplen = gssint_get_der_length(&ptr, REMAIN, &bytes);
+               if (tmplen < 0)
                        return GSS_S_DEFECTIVE_TOKEN;
 
                *mechListMIC = get_input_token(&ptr, REMAIN);
@@ -2168,7 +2172,8 @@ get_negTokenResp(OM_uint32 *minor_status,
  */
 
 static int
-put_negResult(unsigned char **buf_out, OM_uint32 negResult, int buflen)
+put_negResult(unsigned char **buf_out, OM_uint32 negResult,
+             unsigned int buflen)
 {
        if (buflen < 3)
                return (-1);
@@ -2273,18 +2278,16 @@ make_spnego_tokenInit_msg(spnego_gss_ctx_id_t spnego_ctx,
                          gss_buffer_t data, send_token_flag sendtoken,
                          gss_buffer_t outbuf)
 {
-       int tlen, dataLen = 0, ret = 0;
-       int negTokenInitSize = 0;
-       int negTokenInitSeqSize = 0;
-       int negTokenInitContSize = 0;
-       int rspTokenSize = 0;
-       int mechListTokenSize = 0;
-       int micTokenSize = 0;
-       int i;
+       int ret = 0;
+       unsigned int tlen, dataLen = 0;
+       unsigned int negTokenInitSize = 0;
+       unsigned int negTokenInitSeqSize = 0;
+       unsigned int negTokenInitContSize = 0;
+       unsigned int rspTokenSize = 0;
+       unsigned int mechListTokenSize = 0;
+       unsigned int micTokenSize = 0;
        unsigned char *t;
        unsigned char *ptr;
-       unsigned char *MechListPtr = NULL;
-       gss_buffer_desc MICbuff;
 
        if (outbuf == GSS_C_NO_BUFFER)
                return (-1);
@@ -2448,14 +2451,13 @@ make_spnego_tokenTarg_msg(OM_uint32 status, gss_OID mech_wanted,
                          send_token_flag sendtoken,
                          gss_buffer_t outbuf)
 {
-       int tlen;
-       int ret;
-       int NegTokenTargSize;
-       int negresultTokenSize;
-       int NegTokenSize;
-       int rspTokenSize;
-       int micTokenSize;
-       int dataLen = 0;
+       unsigned int tlen = 0;
+       unsigned int ret = 0;
+       unsigned int NegTokenTargSize = 0;
+       unsigned int NegTokenSize = 0;
+       unsigned int rspTokenSize = 0;
+       unsigned int micTokenSize = 0;
+       unsigned int dataLen = 0;
        unsigned char *t;
        unsigned char *ptr;
 
@@ -2668,11 +2670,12 @@ g_token_size(gss_OID_const mech, unsigned int body_size)
  */
 static int
 g_make_token_header(gss_OID_const mech,
-                   int body_size,
+                   unsigned int body_size,
                    unsigned char **buf,
-                   int totallen)
+                   unsigned int totallen)
 {
-       int hdrsize, ret = 0;
+       int ret = 0;
+       unsigned int hdrsize;
        unsigned char *p = *buf;
 
        hdrsize = 1 + gssint_der_length_size(mech->length) + mech->length;
@@ -2685,7 +2688,7 @@ g_make_token_header(gss_OID_const mech,
        if ((ret = gssint_put_der_length(mech->length, buf,
                            totallen - (int)(p - *buf))))
                return (ret);
-       TWRITE_STR(*buf, mech->elements, ((int)mech->length));
+       TWRITE_STR(*buf, mech->elements, mech->length);
        return (0);
 }
 
@@ -2696,34 +2699,37 @@ g_make_token_header(gss_OID_const mech,
  * theory.
  */
 static int
-g_get_tag_and_length(unsigned char **buf, int tag, int buflen, int *outlen)
+g_get_tag_and_length(unsigned char **buf, int tag,
+                    unsigned int buflen, unsigned int *outlen)
 {
        unsigned char *ptr = *buf;
        int ret = -1; /* pessimists, assume failure ! */
        unsigned int encoded_len;
+       int tmplen = 0;
 
+       *outlen = 0;
        if (buflen > 1 && *ptr == tag) {
                ptr++;
-               *outlen = gssint_get_der_length(&ptr, buflen - 1,
+               tmplen = gssint_get_der_length(&ptr, buflen - 1,
                                                &encoded_len);
-               if (*outlen < 0) {
+               if (tmplen < 0) {
                        ret = -1;
-               } else if (*outlen > buflen - (ptr - *buf)) {
+               } else if (tmplen > buflen - (ptr - *buf)) {
                        ret = -1;
                } else
                        ret = 0;
        }
-
+       *outlen = tmplen;
        *buf = ptr;
        return (ret);
 }
 
 static int
-g_verify_neg_token_init(unsigned char **buf_in, int cur_size)
+g_verify_neg_token_init(unsigned char **buf_in, unsigned int cur_size)
 {
        unsigned char *buf = *buf_in;
        unsigned char *endptr = buf + cur_size;
-       int seqsize;
+       unsigned int seqsize;
        int ret = 0;
        unsigned int bytes;
 
@@ -2783,10 +2789,10 @@ g_verify_neg_token_init(unsigned char **buf_in, int cur_size)
 /* verify token header. */
 static int
 g_verify_token_header(gss_OID_const mech,
-                   int *body_size,
+                   unsigned int *body_size,
                    unsigned char **buf_in,
                    int tok_type,
-                   int toksize)
+                   unsigned int toksize)
 {
        unsigned char *buf = *buf_in;
        int seqsize;
@@ -2794,7 +2800,7 @@ g_verify_token_header(gss_OID_const mech,
        int ret = 0;
        unsigned int bytes;
 
-       if ((toksize -= 1) < 0)
+       if (toksize-- < 1)
                return (G_BAD_TOK_HEADER);
 
        if (*buf++ != HEADER_ID)
@@ -2806,20 +2812,22 @@ g_verify_token_header(gss_OID_const mech,
        if ((seqsize + bytes) != toksize)
                return (G_BAD_TOK_HEADER);
 
-       if ((toksize -= 1) < 0)
+       if (toksize-- < 1)
                return (G_BAD_TOK_HEADER);
 
 
        if (*buf++ != MECH_OID)
                return (G_BAD_TOK_HEADER);
 
-       if ((toksize -= 1) < 0)
+       if (toksize-- < 1)
                return (G_BAD_TOK_HEADER);
 
        toid.length = *buf++;
 
-       if ((toksize -= toid.length) < 0)
+       if (toksize < toid.length)
                return (G_BAD_TOK_HEADER);
+       else
+               toksize -= toid.length;
 
        toid.elements = buf;
        buf += toid.length;
@@ -2831,8 +2839,10 @@ g_verify_token_header(gss_OID_const mech,
         * G_WRONG_MECH is not returned immediately because it's more important
         * to return G_BAD_TOK_HEADER if the token header is in fact bad
         */
-       if ((toksize -= 2) < 0)
+       if (toksize < 2)
                return (G_BAD_TOK_HEADER);
+       else
+               toksize -= 2;
 
        if (!ret) {
                *buf_in = buf;
index 51b7d481b969580fb8a609e44d21ec27a9d7b7e9..5044808e1d2e2550dc2778602d85635fddad9449 100644 (file)
@@ -59,7 +59,7 @@ EXPORTS
 ; GSS-API v2  future extensions
 ;
        gss_inquire_names_for_mech
-;      gss_inquire_mechs_for_name
+       gss_inquire_mechs_for_name
        gss_canonicalize_name
        gss_export_name
        gss_duplicate_name
@@ -72,6 +72,7 @@ EXPORTS
         gss_krb5_set_allowable_enctypes
         gss_krb5_export_lucid_sec_context
         gss_krb5_free_lucid_sec_context
+       krb5_gss_register_acceptor_identity
 ;
 ; GSS-API variables
 ;
index a597a360aadea7ddb54f584061c3dcfec4047729..71c14f4bda83b4f6b8d61b9e353abac34e51b54e 100644 (file)
@@ -98,7 +98,7 @@ clean-unix:: clean-libobjs
 
 clean-windows::
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index ed0cb41df23b054705547f2120b5b84bfa0d6533..7edea76983aea2b5f8f4ccbcf38ea63d52c0bc12 100644 (file)
@@ -72,8 +72,8 @@ clean-unix:: clean-liblinks clean-libs clean-libobjs
 
 install:: install-libs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 24d845162be4da7332bd7137f10bd683da3265c7..e9c7bfd496671afceae6c782b327455fd9f5a688 100644 (file)
@@ -510,7 +510,7 @@ krb5_klog_init(krb5_context kcontext, char *ename, char *whoami, krb5_boolean do
                         * If there is a facility present, then parse that.
                         */
                        if (cp2) {
-                           const struct {
+                           static const struct {
                                const char *name;
                                int value;
                            } facilities[] = {
index 750aa3f8121b720ec3a22701b44096953ee7e8a4..a3ae6de4254abb22f17fd9bcedd11d7a0deea042 100644 (file)
@@ -1,5 +1,6 @@
 #define USE_KADM5_API_VERSION 1
 #include <kadm5/admin.h>
+#include <string.h>
 
 ovsec_kadm_ret_t ovsec_kadm_init_with_password(char *client_name, char *pass,
                                               char *service_name,
index 63d9c5ad510018a3cf541809dec0dc58cd5a60a8..a2ee7f061124acad23ad6cf34fce0fdfc057c622 100644 (file)
@@ -89,8 +89,8 @@ clean-unix:: clean-liblinks clean-libs clean-libobjs
 
 install:: install-libs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index fa63027f7cbfacba975385d3058ab7db1c842d34..6d8d6d7f69760b876eab154be1ca92e016049ff7 100644 (file)
@@ -197,7 +197,7 @@ kadm5int_acl_parse_line(lp)
            for (op=acle_ops; *op; op++) {
                char rop;
 
-               rop = (isupper((int) *op)) ? tolower((int) *op) : *op;
+               rop = (isupper((unsigned char) *op)) ? tolower((unsigned char) *op) : *op;
                found = 0;
                for (t=0; acl_op_table[t].ao_op; t++) {
                    if (rop == acl_op_table[t].ao_op) {
index fa4e62ee4310b8687df3b936500c336de4ed0d65..cd65371c9c9f633f523f29d20261766a39a3774b 100644 (file)
@@ -134,17 +134,17 @@ passwd_check(kadm5_server_handle_t handle,
            return KADM5_PASS_Q_TOOSHORT;
        s = password;
        while ((c = *s++)) {
-           if (islower((int) c)) {
+           if (islower((unsigned char) c)) {
                nlower = 1;
                continue;
            }
-           else if (isupper((int) c)) {
+           else if (isupper((unsigned char) c)) {
                nupper = 1;
                continue;
-           } else if (isdigit((int) c)) {
+           } else if (isdigit((unsigned char) c)) {
                ndigit = 1;
                continue;
-           } else if (ispunct((int) c)) {
+           } else if (ispunct((unsigned char) c)) {
                npunct = 1;
                continue;
            } else {
index 9677698a7975d2548a3ff9e448163cd5c7c8f6e7..575b24f3536b7d24cc70c79bde29796aed878ce7 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <krb5.h>
+#include <string.h>
 
 int main()
 {
index 4b85a5490d214d7c6b7160930ee4102084168156..17e561ef168d24a5d8e6a8a7d5506d45358419c2 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <kadm5/admin.h>
+#include <string.h>
 
 int main(int argc, char **argv)
 {
index 38ad3cdb7e9493f3bb0dcd71f2d8889ef04cbabe..489b7b88ea906310b190bea8d4185bea23b68807 100644 (file)
@@ -7,6 +7,7 @@
 #include <krb5.h>
 #include <kadm5/admin.h>
 #include <kdb.h>
+#include <string.h>
 
 char *whoami;
 
index ff49791477cc6eccbbdf997440917de352c4b5fb..e6666929c35acd504963cf6df7b376fe6db84710 100644 (file)
@@ -51,8 +51,8 @@ all-unix:: all-liblinks
 install-unix:: install-libs
 clean-unix:: clean-liblinks clean-libs clean-libobjs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 9812d15975cc41c0666a3e7d50607b189c079a9f..b58f785e05bea6c8af856945ef256cd2380efd75 100644 (file)
@@ -264,8 +264,8 @@ check-windows::
 
 install-unix:: install-libs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 190518ad918d4081cccf22a0b8933c544403f702..f6607a9cad708f891beceab16d66bb3038e085a1 100644 (file)
@@ -563,8 +563,8 @@ static char * strutol( start )
 {
     char *q;
     for (q=start; *q; q++)
-        if (isupper((int) *q))
-           *q=tolower((int) *q);
+        if (isupper((unsigned char) *q))
+           *q=tolower((unsigned char) *q);
     return(start);
 }
 \f
index fcf2ea28c72bc33bf0401b4f373b8735f8fb1732..9c6fe864d7ee96e544dcc30df431102c271ff692 100644 (file)
@@ -125,8 +125,8 @@ clean-windows::
 
 install-unix:: install-libs
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 3c440fe561f2f970dc6e23f5baaa5fe7b3917d5a..b39dd2546e6749af5555928406a5cffae1febc53 100644 (file)
@@ -52,7 +52,7 @@ all-unix:: all-libobjs
 
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 7906aebb00af2d8422d41f96dc6b2f19f37be701..44ba2a91b6ab68fb37e136e39eec16d00fea8e8f 100644 (file)
@@ -94,7 +94,7 @@ clean-unix::
 
 ##WIN32## $(OUTPRE)cc_mslsa.$(OBJEXT): cc_mslsa.c $(SRCTOP)/include/k5-int.h $(BUILDTOP)/include/krb5/osconf.h $(BUILDTOP)/include/krb5/autoconf.h $(BUILDTOP)/include/krb5.h $(COM_ERR_DEPS)
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 6a75aef864da2ad3a59b257e3f1169ad2a17669a..46fa507b31b1683065c82034631c2165aa1fe9c8 100644 (file)
@@ -136,6 +136,43 @@ is_windows_xp (void)
    return fIsWinXP;
 }
 
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+
+static BOOL
+is_broken_wow64(void)
+{
+    static BOOL fChecked = FALSE;
+    static BOOL fIsBrokenWow64 = FALSE;
+
+    if (!fChecked)
+    {
+       BOOL isWow64 = FALSE;
+       OSVERSIONINFO Version;
+       LPFN_ISWOW64PROCESS fnIsWow64Process = 
+           (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"),
+                                               "IsWow64Process");
+
+       /* If we don't find the fnIsWow64Process function then we 
+        * are not running in a broken Wow64 
+        */
+       if (fnIsWow64Process) {
+           memset (&Version, 0x00, sizeof(Version));
+           Version.dwOSVersionInfoSize = sizeof(Version);
+
+           if (fnIsWow64Process(GetCurrentProcess(), &isWow64) && 
+               GetVersionEx (&Version)) {
+               if (isWow64 && 
+                   Version.dwPlatformId == VER_PLATFORM_WIN32_NT &&
+                   Version.dwMajorVersion < 6)
+                   fIsBrokenWow64 = TRUE;
+           } 
+       }
+       fChecked = TRUE;
+    }
+
+    return fIsBrokenWow64;
+}
+
 /* This flag is only supported by versions of Windows which have obtained
  * a code change from Microsoft.   When the code change is installed,
  * setting this flag will cause all retrieved credentials to be stored 
@@ -729,9 +766,9 @@ IsKerberosLogon(VOID)
             usLength = (pSessionData->AuthenticationPackage).Length;
             if (usLength < 256)
             {
-                lstrcpyn (buffer, usBuffer, usLength);
-                lstrcat (buffer,L"");
-                if ( !lstrcmp(L"Kerberos",buffer) )
+                lstrcpynW (buffer, usBuffer, usLength);
+                lstrcatW (buffer,L"");
+                if ( !lstrcmpW(L"Kerberos",buffer) )
                     Success = TRUE;
             }
         }
@@ -1888,7 +1925,7 @@ krb5_lcc_resolve (krb5_context context, krb5_ccache *id, const char *residual)
     KERB_EXTERNAL_TICKET *msticket;
     krb5_error_code retval = KRB5_OK;
 
-    if (!is_windows_2000())
+    if (!is_windows_2000() || is_broken_wow64())
         return KRB5_FCC_NOFILE;
 
 #ifdef COMMENT
index 885abf5bb7b5dd3c296a0153669dd1545606130d..ff3e9a83641a07b659e1d347d7558c61b05123f3 100644 (file)
@@ -3,8 +3,9 @@
  *      credentical cache API
  *     
  * Written by Frank Dabek July 1998
+ * Updated by Jeffrey Altman June 2006
  *
- * Copyright 1998, 1999 by the Massachusetts Institute of Technology.
+ * Copyright 1998, 1999, 2006 by the Massachusetts Institute of Technology.
  * All Rights Reserved.
  *
  * Export of this software from the United States of America may
  * 
  */
 
-#define NEED_WINDOWS
 #include "k5-int.h"
 #include "stdcc.h"
 #include "stdcc_util.h"
 #include "string.h"
 #include <stdio.h>
 
-apiCB *gCntrlBlock = NULL;
-
 #if defined(_WIN32)
 #include "winccld.h"   
 #endif
@@ -56,14 +54,37 @@ apiCB *gCntrlBlock = NULL;
 #define SHOW_DEBUG(buf)
 #endif
 
+#ifdef USE_CCAPI_V3
+cc_context_t gCntrlBlock = NULL;
+#else
+apiCB *gCntrlBlock = NULL;
+#endif
+
 /*
  * declare our global object wanna-be
  * must be installed in ccdefops.c
  */
 
 krb5_cc_ops krb5_cc_stdcc_ops = {
-     0,
-     "API",
+      0,
+      "API",
+#ifdef USE_CCAPI_V3
+      krb5_stdccv3_get_name,
+      krb5_stdccv3_resolve,
+      krb5_stdccv3_generate_new,
+      krb5_stdccv3_initialize,
+      krb5_stdccv3_destroy,
+      krb5_stdccv3_close,
+      krb5_stdccv3_store,
+      krb5_stdccv3_retrieve,
+      krb5_stdccv3_get_principal,
+      krb5_stdccv3_start_seq_get,
+      krb5_stdccv3_next_cred,
+      krb5_stdccv3_end_seq_get,
+      krb5_stdccv3_remove, 
+      krb5_stdccv3_set_flags,
+      krb5_stdccv3_get_flags
+#else
       krb5_stdcc_get_name,
       krb5_stdcc_resolve,
       krb5_stdcc_generate_new,
@@ -78,7 +99,8 @@ krb5_cc_ops krb5_cc_stdcc_ops = {
       krb5_stdcc_end_seq_get,
       krb5_stdcc_remove, 
       krb5_stdcc_set_flags,
-      krb5_stdcc_get_flags,
+      krb5_stdcc_get_flags
+#endif
 };
 
 #if defined(_WIN32)
@@ -114,6 +136,36 @@ struct err_xlate
 
 static const struct err_xlate err_xlate_table[] =
 {
+#ifdef USE_CCAPI_V3
+        { ccIteratorEnd,                       KRB5_CC_END },
+        { ccErrBadParam,                       KRB5_FCC_INTERNAL },
+        { ccErrNoMem,                          KRB5_CC_NOMEM },
+        { ccErrInvalidContext,                         KRB5_FCC_INTERNAL },
+        { ccErrInvalidCCache,                  KRB5_FCC_INTERNAL },
+        { ccErrInvalidString,                  KRB5_FCC_INTERNAL },
+        { ccErrInvalidCredentials,             KRB5_FCC_INTERNAL },
+        { ccErrInvalidCCacheIterator,          KRB5_FCC_INTERNAL },
+        { ccErrInvalidCredentialsIterator,     KRB5_FCC_INTERNAL },
+        { ccErrInvalidLock,                    KRB5_FCC_INTERNAL },
+        { ccErrBadName,                                KRB5_CC_BADNAME },
+        { ccErrBadCredentialsVersion,          KRB5_FCC_INTERNAL },
+        { ccErrBadAPIVersion,                  KRB5_FCC_INTERNAL },
+        { ccErrContextLocked,                  KRB5_FCC_INTERNAL },
+        { ccErrContextUnlocked,                        KRB5_FCC_INTERNAL },
+        { ccErrCCacheLocked,                   KRB5_FCC_INTERNAL },
+        { ccErrCCacheUnlocked,                 KRB5_FCC_INTERNAL },
+        { ccErrBadLockType,                    KRB5_FCC_INTERNAL },
+        { ccErrNeverDefault,                   KRB5_FCC_INTERNAL },
+        { ccErrCredentialsNotFound,            KRB5_CC_NOTFOUND },
+        { ccErrCCacheNotFound,                 KRB5_FCC_NOFILE },
+        { ccErrContextNotFound,                        KRB5_FCC_INTERNAL },
+        { ccErrServerUnavailable,              KRB5_FCC_NOFILE },
+        { ccErrServerInsecure,                 KRB5_FCC_INTERNAL },
+        { ccErrServerCantBecomeUID,            KRB5_FCC_INTERNAL },
+        { ccErrTimeOffsetNotSet,               KRB5_FCC_INTERNAL },
+        { ccErrBadInternalMessage,             KRB5_FCC_INTERNAL },
+        { ccErrNotImplemented,                 KRB5_FCC_INTERNAL },
+#else
        { CC_BADNAME,                           KRB5_CC_BADNAME },
        { CC_NOTFOUND,                          KRB5_CC_NOTFOUND },
        { CC_END,                               KRB5_CC_END },
@@ -131,6 +183,7 @@ static const struct err_xlate err_xlate_table[] =
        { CC_ERR_CACHE_RELEASE,                 KRB5_FCC_INTERNAL /* XXX */ },
        { CC_ERR_CACHE_FULL,                    KRB5_FCC_INTERNAL /* XXX */ },
        { CC_ERR_CRED_VERSION,                  KRB5_FCC_INTERNAL /* XXX */ },
+#endif
        { 0,                                    0 }
 };
 
@@ -138,8 +191,13 @@ static krb5_error_code cc_err_xlate(int err)
 {
        const struct err_xlate *p;
 
-       if (err == CC_NOERROR)
+#ifdef USE_CCAPI_V3
+       if (err == ccNoError)
                return 0;
+#else
+        if (err == CC_NOERROR)
+               return 0;
+#endif
 
        for (p = err_xlate_table; p->cc_err; p++) {
                if (err == p->cc_err)
@@ -148,6 +206,537 @@ static krb5_error_code cc_err_xlate(int err)
        return KRB5_FCC_INTERNAL; /* XXX we need a miscellaneous return */
 }
 
+
+#ifdef USE_CCAPI_V3
+static krb5_error_code stdccv3_setup(krb5_context context,
+                                    stdccCacheDataPtr ccapi_data)
+{
+       cc_int32        err;
+
+       /* make sure the API has been intialized */
+       if (gCntrlBlock == NULL) {
+               err = cc_initialize(&gCntrlBlock, ccapi_version_max, NULL, NULL);
+               if (err != ccNoError)
+                       return cc_err_xlate(err);
+       }
+
+       /*
+        * No ccapi_data structure, so we don't need to make sure the
+        * ccache exists.
+        */
+       if (!ccapi_data)
+               return 0;
+
+       /*
+        * The ccache already exists
+        */
+       if (ccapi_data->NamedCache)
+               return 0;
+
+       err = cc_context_open_ccache(gCntrlBlock, ccapi_data->cache_name,
+                     &ccapi_data->NamedCache);
+       if (err == ccNoError)
+               return 0;
+
+       ccapi_data->NamedCache = NULL;
+       return cc_err_xlate(err);
+}
+
+/* krb5_stdcc_shutdown is exported; use the old name */
+void krb5_stdcc_shutdown()
+{
+       if (gCntrlBlock)
+               cc_context_release(gCntrlBlock);
+       gCntrlBlock = NULL;
+}
+
+/*
+ * -- generate_new --------------------------------
+ * 
+ * create a new cache with a unique name, corresponds to creating a
+ * named cache initialize the API here if we have to.
+ */
+krb5_error_code KRB5_CALLCONV  krb5_stdccv3_generate_new 
+       (krb5_context context, krb5_ccache *id ) 
+{
+       krb5_ccache             newCache = NULL;
+       krb5_error_code         retval;
+       stdccCacheDataPtr       ccapi_data = NULL;
+       char                    *name = NULL;
+       cc_time                 time;
+       int                     err;
+
+       if ((retval = stdccv3_setup(context, NULL)))
+               return retval;
+       
+       retval = KRB5_CC_NOMEM;
+       if (!(newCache = (krb5_ccache) malloc(sizeof(struct _krb5_ccache))))
+               goto errout;
+       if (!(ccapi_data = (stdccCacheDataPtr)malloc(sizeof(stdccCacheData))))
+               goto errout;
+       if (!(name = malloc(256)))
+               goto errout;
+       
+       /* create a unique name */
+       if (retval = cc_context_get_change_time(gCntrlBlock, &time))
+               goto errout;
+       sprintf(name, "gen_new_cache%d", time);
+       
+       /* create the new cache */
+       err = cc_context_create_ccache(gCntrlBlock, name, cc_credentials_v5, 0L,
+                       &ccapi_data->NamedCache);
+       if (err != ccNoError) {
+               retval = cc_err_xlate(err);
+               goto errout;
+       }
+
+       /* setup some fields */
+       newCache->ops = &krb5_cc_stdcc_ops;
+       newCache->data = ccapi_data;
+       ccapi_data->cache_name = name;
+       
+       /* return a pointer to the new cache */
+       *id = newCache;
+               
+       return 0;
+
+errout:
+       if (newCache)
+               free(newCache);
+       if (ccapi_data)
+               free(ccapi_data);
+       if (name)
+               free(name);
+       return retval;
+}
+  
+/*
+ * resolve
+ *
+ * create a new cache with the name stored in residual
+ */
+krb5_error_code KRB5_CALLCONV  krb5_stdccv3_resolve 
+        (krb5_context context, krb5_ccache *id , const char *residual ) 
+{
+       krb5_ccache             newCache = NULL;
+       stdccCacheDataPtr       ccapi_data = NULL;
+       int                     err;
+       krb5_error_code         retval;
+       char                    *cName = NULL;
+       
+       if ((retval = stdccv3_setup(context, NULL)))
+               return retval;
+       
+       retval = KRB5_CC_NOMEM;
+       if (!(newCache = (krb5_ccache) malloc(sizeof(struct _krb5_ccache))))
+               goto errout;
+       
+       if (!(ccapi_data = (stdccCacheDataPtr)malloc(sizeof(stdccCacheData))))
+               goto errout;
+
+       if (!(cName = malloc(strlen(residual)+1)))
+               goto errout;
+       
+       newCache->ops = &krb5_cc_stdcc_ops;
+       newCache->data = ccapi_data;
+       ccapi_data->cache_name = cName;
+
+       strcpy(cName, residual);
+       
+       err = cc_context_open_ccache(gCntrlBlock, cName,
+                                    &ccapi_data->NamedCache);
+        if (err != ccNoError) {
+               ccapi_data->NamedCache = NULL;
+               goto errout;
+       }
+
+       /* return new cache structure */
+       *id = newCache;
+       
+       return 0;
+       
+errout:
+       if (newCache)
+               free(newCache);
+       if (ccapi_data)
+               free(ccapi_data);
+       if (cName)
+               free(cName);
+       return retval;
+}
+  
+/*
+ * initialize
+ *
+ * initialize the cache, check to see if one already exists for this
+ * principal if not set our principal to this principal. This
+ * searching enables ticket sharing
+ */
+krb5_error_code KRB5_CALLCONV  krb5_stdccv3_initialize 
+       (krb5_context context, krb5_ccache id,  krb5_principal princ) 
+{
+       stdccCacheDataPtr       ccapi_data = NULL;
+       int                     err;
+       char                    *cName = NULL;
+       krb5_error_code         retval;
+       
+       if ((retval = stdccv3_setup(context, NULL)))
+               return retval;
+       
+       /* test id for null */
+       if (id == NULL) return KRB5_CC_NOMEM;
+       
+       if ((retval = krb5_unparse_name(context, princ, &cName)))
+               return retval;
+
+       ccapi_data = id->data;
+
+
+        if (ccapi_data->NamedCache) {
+               err = cc_ccache_release(ccapi_data->NamedCache);
+               ccapi_data->NamedCache = NULL;
+       }
+
+       err = cc_context_create_ccache(gCntrlBlock, ccapi_data->cache_name, 
+                                      cc_credentials_v5, cName,
+                                      &ccapi_data->NamedCache);
+       if (err != ccNoError) {
+               krb5_free_unparsed_name(context, cName);
+               return cc_err_xlate(err);
+       }
+
+       krb5_free_unparsed_name(context, cName);
+       cache_changed();
+       
+       return cc_err_xlate(err);
+}
+
+/*
+ * store
+ *
+ * store some credentials in our cache
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_store 
+        (krb5_context context, krb5_ccache id, krb5_creds *creds )
+{
+       krb5_error_code         retval;
+       stdccCacheDataPtr       ccapi_data = id->data;
+       cc_credentials_t        c = NULL;
+       int err;
+
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+       
+       /* copy the fields from the almost identical structures */
+       dupK5toCC3(context, creds, &c);
+                       
+       /*
+        * finally store the credential
+        * store will copy (that is duplicate) everything
+        */
+       err = cc_ccache_store_credentials(((stdccCacheDataPtr)(id->data))->NamedCache, c->data);
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+             
+       err = cc_credentials_release(c);
+                
+       cache_changed();
+       return err;
+}
+
+/*
+ * start_seq_get
+ *
+ * begin an iterator call to get all of the credentials in the cache
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_start_seq_get 
+(krb5_context context, krb5_ccache id , krb5_cc_cursor *cursor )
+{
+       stdccCacheDataPtr               ccapi_data = id->data;
+       krb5_error_code                 retval;
+       int                             err;
+       cc_credentials_iterator_t       iterator;
+
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+
+       err = cc_ccache_new_credentials_iterator(ccapi_data->NamedCache,
+                                                &iterator);
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+       *cursor = iterator;
+       return 0;
+}
+
+/*
+ * next cred
+ * 
+ * - get the next credential in the cache as part of an iterator call
+ * - this maps to call to cc_seq_fetch_creds
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_next_cred 
+        (krb5_context context, krb5_ccache id,  krb5_cc_cursor *cursor, 
+        krb5_creds *creds)
+{
+       krb5_error_code                 retval;
+       stdccCacheDataPtr               ccapi_data = id->data;
+       int                             err;
+       cc_credentials_t                cu;
+       cc_credentials_iterator_t       iterator;
+       
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+       
+       iterator = *cursor;
+       if (iterator == 0)
+               return KRB5_CC_END;
+       err = cc_credentials_iterator_next(iterator, &cu);
+
+       if (err == ccIteratorEnd) {
+               cc_credentials_iterator_release(iterator);
+               *cursor = 0;
+       }
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+       
+       /* copy data    (with translation) */
+       dupCC3toK5(context, cu, creds);
+       
+       cc_credentials_release(cu);
+       
+       return 0;
+}
+
+
+/*
+ * retrieve
+ *
+ * - try to find a matching credential in the cache
+ */
+krb5_error_code KRB5_CALLCONV
+krb5_stdccv3_retrieve(context, id, whichfields, mcreds, creds)
+   krb5_context context;
+   krb5_ccache id;
+   krb5_flags whichfields;
+   krb5_creds *mcreds;
+   krb5_creds *creds;
+{
+    return krb5_cc_retrieve_cred_default (context, id, whichfields,
+                                         mcreds, creds);
+}
+
+/*
+ *  end seq
+ *
+ * just free up the storage assoicated with the cursor (if we can)
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_end_seq_get 
+        (krb5_context context, krb5_ccache id, krb5_cc_cursor *cursor)
+{
+       krb5_error_code                 retval;
+       stdccCacheDataPtr               ccapi_data = NULL;
+       int                             err;
+        cc_credentials_iterator_t      iterator;
+
+       ccapi_data = id->data;
+       
+        if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+
+       if (*cursor == NULL)
+               return 0;
+
+        iterator = *cursor;
+
+       err = cc_credentials_iterator_release(iterator);
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+       return(0);
+}
+     
+/*
+ * close
+ *
+ * - free our pointers to the NC
+ */
+krb5_error_code KRB5_CALLCONV 
+krb5_stdccv3_close(krb5_context context, krb5_ccache id)
+{
+       krb5_error_code retval;
+       stdccCacheDataPtr       ccapi_data = id->data;
+
+       if ((retval = stdccv3_setup(context, NULL)))
+               return retval;
+       
+       /* free it */
+       if (ccapi_data) {
+               if (ccapi_data->cache_name)
+                       free(ccapi_data->cache_name);
+               if (ccapi_data->NamedCache)
+                       cc_ccache_release(ccapi_data->NamedCache);
+               free(ccapi_data);
+               id->data = NULL;
+       }
+       free(id);
+       
+       return 0;
+}
+
+/*
+ * destroy
+ *
+ * - free our storage and the cache
+ */
+krb5_error_code KRB5_CALLCONV
+krb5_stdccv3_destroy (krb5_context context, krb5_ccache id)
+{
+       int err;
+       krb5_error_code retval;
+       stdccCacheDataPtr       ccapi_data = id->data;
+
+       if ((retval = stdccv3_setup(context, ccapi_data))) {
+               return retval;
+       }
+
+       /* free memory associated with the krb5_ccache */
+       if (ccapi_data) {
+               if (ccapi_data->cache_name)
+                       free(ccapi_data->cache_name);
+               if (ccapi_data->NamedCache) {
+                       /* destroy the named cache */
+                       err = cc_ccache_destroy(ccapi_data->NamedCache);
+                       retval = cc_err_xlate(err);
+                       cache_changed();
+               }
+               free(ccapi_data);
+               id->data = NULL;
+       }
+       free(id);
+
+       /* If the cache does not exist when we tried to destroy it,
+          that's fine.  That means someone else destroyed it since
+          we resolved it. */
+       if (retval == ccErrCCacheNotFound)
+               return 0;
+       return retval;
+}
+
+/*
+ *  getname
+ *
+ * - return the name of the named cache
+ */
+const char * KRB5_CALLCONV krb5_stdccv3_get_name 
+        (krb5_context context, krb5_ccache id )
+{
+       stdccCacheDataPtr       ccapi_data = id->data;
+
+       if (!ccapi_data)
+               return 0;
+
+       return (ccapi_data->cache_name);
+}
+
+
+/* get_principal
+ *
+ * - return the principal associated with the named cache
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_get_principal
+       (krb5_context context, krb5_ccache id , krb5_principal *princ) 
+{
+       int                     err;
+       cc_string_t             name = NULL;
+       stdccCacheDataPtr       ccapi_data = id->data;
+       krb5_error_code         retval;
+       
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+
+       /* another wrapper */
+       err = cc_ccache_get_principal(ccapi_data->NamedCache, cc_credentials_v5, &name);
+
+       if (err != ccNoError) 
+               return cc_err_xlate(err);
+               
+       /* turn it into a krb principal */
+       err = krb5_parse_name(context, name->data, princ);
+
+       cc_string_release(name);
+       
+       return err;     
+}
+
+/*
+ * set_flags
+ *
+ * - currently a NOP since we don't store any flags in the NC
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_set_flags 
+        (krb5_context context, krb5_ccache id , krb5_flags flags)
+{
+       stdccCacheDataPtr       ccapi_data = id->data;
+       krb5_error_code         retval;
+       
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+
+       return 0;
+}
+
+/*
+ * get_flags
+ *
+ * - currently a NOP since we don't store any flags in the NC
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_get_flags 
+        (krb5_context context, krb5_ccache id , krb5_flags *flags)
+{
+       stdccCacheDataPtr       ccapi_data = id->data;
+       krb5_error_code         retval;
+       
+       if ((retval = stdccv3_setup(context, ccapi_data)))
+               return retval;
+
+       return 0;
+}
+
+/*
+ * remove
+ *
+ * - remove the specified credentials from the NC
+ */
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_remove 
+        (krb5_context context, krb5_ccache id,
+        krb5_flags flags, krb5_creds *creds)
+{
+       cc_credentials_t        c = NULL;
+       int                     err;
+       stdccCacheDataPtr       ccapi_data = id->data;
+       krb5_error_code         retval;
+       
+       if ((retval = stdccv3_setup(context, ccapi_data))) {
+               if (retval == KRB5_FCC_NOFILE)
+                       return 0;
+               return retval;
+       }
+       
+       /* convert to a cred union */
+       dupK5toCC3(context, creds, &c);
+       
+       /* remove it */
+       err = cc_ccache_remove_credentials(ccapi_data->NamedCache, c);
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+       
+       err = cc_credentials_release(c);
+       cache_changed();
+       if (err != ccNoError)
+               return cc_err_xlate(err);
+
+        return 0;
+}
+#else /* !USE_CCAPI_V3 */
 static krb5_error_code stdcc_setup(krb5_context context,
                                   stdccCacheDataPtr ccapi_data)
 {
@@ -192,7 +781,7 @@ void krb5_stdcc_shutdown()
 {
        if (gCntrlBlock)
                cc_shutdown(&gCntrlBlock);
-       gCntrlBlock = 0;
+       gCntrlBlock = NULL;
 }
 
 /*
@@ -289,9 +878,10 @@ krb5_error_code KRB5_CALLCONV  krb5_stdcc_resolve
        
        err = cc_open(gCntrlBlock, cName, CC_CRED_V5, 0L,
                      &ccapi_data->NamedCache);
-       if (err != CC_NOERROR)
-               ccapi_data->NamedCache = NULL;
-       
+        if (err != CC_NOERROR) {
+               ccapi_data->NamedCache = NULL;
+               goto errout;
+       }
        /* return new cache structure */
        *id = newCache;
        
@@ -388,7 +978,7 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_store
                
        /* free the cred union using our local version of cc_free_creds()
           since we allocated it locally */
-       err = krb5_free_cc_cred_union(&cu);
+       err = krb5int_free_cc_cred_union(&cu);
                 
        cache_changed();
        return err;
@@ -523,7 +1113,6 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_retrieve
        return KRB5_CC_NOTFOUND;
 }
 #else
-#include "k5-int.h"
 
 krb5_error_code KRB5_CALLCONV
 krb5_stdcc_retrieve(context, id, whichfields, mcreds, creds)
@@ -763,10 +1352,11 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_remove
        
        /* free the cred union using our local version of cc_free_creds()
               since we allocated it locally */
-       err = krb5_free_cc_cred_union(&cu);
+       err = krb5int_free_cc_cred_union(&cu);
        cache_changed();
        if (err != CC_NOERROR)
                return cc_err_xlate(err);
 
         return 0;
 }
+#endif /* !USE_CCAPI_V3 */
\ No newline at end of file
index 81ce883cb6c08d5226b2be10d16e0e8552aa649c..c0ce13b420494017b98d9cf61efc37a6a22c6c31 100644 (file)
@@ -1,13 +1,17 @@
-#include "krb5.h"
-#include "k5-int.h"
+#include "k5-int.h"    /* loads krb5.h */
        
+#ifdef USE_CCAPI_V3
+#include <CredentialsCache.h>
+#else
 #ifdef USE_CCAPI
 #include <CredentialsCache2.h>
-#endif
-
+#else
 #if defined(_WIN32)
 #include "cacheapi.h"
 #endif
+#endif
+#endif
+
 
 #define kStringLiteralLen 255
 
@@ -19,12 +23,71 @@ extern krb5_cc_ops krb5_cc_stdcc_ops;
  */
 typedef struct _stdccCacheData {
        char *cache_name;
+#ifdef USE_CCAPI_V3
+        cc_ccache_t NamedCache;
+#else
        ccache_p *NamedCache;
+#endif
 } stdccCacheData, *stdccCacheDataPtr;
 
 
 /* function protoypes  */
 
+#ifdef USE_CCAPI_V3
+void krb5_stdccv3_shutdown(void);
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_close
+        (krb5_context, krb5_ccache id );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_destroy 
+        (krb5_context, krb5_ccache id );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_end_seq_get 
+        (krb5_context, krb5_ccache id , krb5_cc_cursor *cursor );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_generate_new 
+        (krb5_context, krb5_ccache *id );
+
+const char * KRB5_CALLCONV krb5_stdccv3_get_name 
+        (krb5_context, krb5_ccache id );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_get_principal 
+        (krb5_context, krb5_ccache id , krb5_principal *princ );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_initialize 
+        (krb5_context, krb5_ccache id , krb5_principal princ );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_next_cred 
+        (krb5_context, 
+                  krb5_ccache id , 
+                  krb5_cc_cursor *cursor , 
+                  krb5_creds *creds );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_resolve 
+        (krb5_context, krb5_ccache *id , const char *residual );
+     
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_retrieve 
+        (krb5_context, 
+                  krb5_ccache id , 
+                  krb5_flags whichfields , 
+                  krb5_creds *mcreds , 
+                  krb5_creds *creds );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_start_seq_get 
+        (krb5_context, krb5_ccache id , krb5_cc_cursor *cursor );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_store 
+        (krb5_context, krb5_ccache id , krb5_creds *creds );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_set_flags 
+        (krb5_context, krb5_ccache id , krb5_flags flags );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_get_flags 
+        (krb5_context, krb5_ccache id , krb5_flags *flags );
+
+krb5_error_code KRB5_CALLCONV krb5_stdccv3_remove 
+        (krb5_context, krb5_ccache id , krb5_flags flags, krb5_creds *creds);
+#else
 void krb5_stdcc_shutdown(void);
 
 krb5_error_code KRB5_CALLCONV krb5_stdcc_close
@@ -78,3 +141,4 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags
 
 krb5_error_code KRB5_CALLCONV krb5_stdcc_remove 
         (krb5_context, krb5_ccache id , krb5_flags flags, krb5_creds *creds);
+#endif
\ No newline at end of file
index 7f9358dca5644ba15b8e988b1c4a56aac26b7934..1969b6e718af29341818d82741be5cb263d99b5c 100644 (file)
 
 #define fieldSize 255
 
+#ifdef USE_CCAPI_V3
+/* krb5int_cc_credentials_release(cc_credentials_t creds)
+ * - function used to release internally generated cc_credentials_t objects
+ */
+static cc_int32 
+krb5int_cc_credentials_release(cc_credentials_t creds) {
+    free(creds);
+    return ccNoError;
+}
+
+static cc_int32 
+krb5int_cc_credentials_compare(cc_credentials_t creds,
+                              cc_credentials_t compare_to,
+                              cc_uint32* equal) {
+    return ccErrNotImplemented;
+}
+
+/*
+ * CopyCC3DataArrayToK5
+ * - copy and translate the null terminated arrays of data records
+ *      used in k5 tickets
+ */
+int 
+copyCC3DataArrayToK5(cc_credentials_v5_t *ccCreds, krb5_creds *v5Creds, char whichArray) {
+
+    switch (whichArray) {
+    case kAddressArray: 
+       if (ccCreds->addresses == NULL) {
+           v5Creds->addresses = NULL;
+       } else {
+
+           krb5_address        **addrPtr, *addr;
+           cc_data             **dataPtr, *data;
+           unsigned int        numRecords = 0;
+
+           /* Allocate the array of pointers: */
+           for (dataPtr = ccCreds->addresses; *dataPtr != NULL; numRecords++, dataPtr++) {}
+
+           v5Creds->addresses = (krb5_address **) malloc (sizeof(krb5_address *) * (numRecords + 1));
+           if (v5Creds->addresses == NULL)
+               return ENOMEM;
+
+           /* Fill in the array, allocating the address structures: */
+           for (dataPtr = ccCreds->addresses, addrPtr = v5Creds->addresses; *dataPtr != NULL; addrPtr++, dataPtr++) {
+
+               *addrPtr = (krb5_address *) malloc (sizeof(krb5_address));
+               if (*addrPtr == NULL)
+                   return ENOMEM;
+               data = *dataPtr;
+               addr = *addrPtr;
+
+               addr->addrtype = data->type;
+               addr->magic    = KV5M_ADDRESS;
+               addr->length   = data->length;
+               addr->contents = (krb5_octet *) malloc (sizeof(krb5_octet) * addr->length);
+               if (addr->contents == NULL)
+                   return ENOMEM;
+               memmove(addr->contents, data->data, addr->length); /* copy contents */
+           }
+
+           /* Write terminator: */
+           *addrPtr = NULL;
+       }
+       break;
+    case kAuthDataArray:
+       if (ccCreds->authdata == NULL) {
+           v5Creds->authdata = NULL;
+       } else {
+           krb5_authdata       **authPtr, *auth;
+           cc_data             **dataPtr, *data;
+           unsigned int        numRecords = 0;
+
+           /* Allocate the array of pointers: */
+           for (dataPtr = ccCreds->authdata; *dataPtr != NULL; numRecords++, dataPtr++) {}
+
+           v5Creds->authdata = (krb5_authdata **) malloc (sizeof(krb5_authdata *) * (numRecords + 1));
+           if (v5Creds->authdata == NULL)
+               return ENOMEM;
+
+           /* Fill in the array, allocating the address structures: */
+           for (dataPtr = ccCreds->authdata, authPtr = v5Creds->authdata; *dataPtr != NULL; authPtr++, dataPtr++) {
+
+               *authPtr = (krb5_authdata *) malloc (sizeof(krb5_authdata));
+               if (*authPtr == NULL)
+                   return ENOMEM;
+               data = *dataPtr;
+               auth = *authPtr;
+
+               auth->ad_type  = data->type;
+               auth->magic    = KV5M_AUTHDATA;
+               auth->length   = data->length;
+               auth->contents = (krb5_octet *) malloc (sizeof(krb5_octet) * auth->length);
+               if (auth->contents == NULL)
+                   return ENOMEM;
+               memmove(auth->contents, data->data, auth->length); /* copy contents */
+           }
+
+           /* Write terminator: */
+           *authPtr = NULL;
+       }
+       break;
+    }
+
+    return 0;
+}
+
+/*
+ * copyK5DataArrayToCC
+ * - analagous to above, but in the other direction
+ */
+int 
+copyK5DataArrayToCC3(krb5_creds *v5Creds, cc_credentials_v5_t * ccCreds, char whichArray)
+{
+    switch (whichArray) {
+    case kAddressArray:
+       if (v5Creds->addresses == NULL) {
+           ccCreds->addresses = NULL;
+       } else {
+
+           krb5_address        **addrPtr, *addr;
+           cc_data             **dataPtr, *data;
+           unsigned int        numRecords = 0;
+
+           /* Allocate the array of pointers: */
+           for (addrPtr = v5Creds->addresses; *addrPtr != NULL; numRecords++, addrPtr++) {}
+
+           ccCreds->addresses = (cc_data **) malloc (sizeof(cc_data *) * (numRecords + 1));
+           if (ccCreds->addresses == NULL)
+               return ENOMEM;
+
+           /* Fill in the array, allocating the address structures: */
+           for (dataPtr = ccCreds->addresses, addrPtr = v5Creds->addresses; *addrPtr != NULL; addrPtr++, dataPtr++) {
+
+               *dataPtr = (cc_data *) malloc (sizeof(cc_data));
+               if (*dataPtr == NULL)
+                   return ENOMEM;
+               data = *dataPtr;
+               addr = *addrPtr;
+
+               data->type   = addr->addrtype;
+               data->length = addr->length;
+               data->data   = malloc (sizeof(char) * data->length);
+               if (data->data == NULL)
+                   return ENOMEM;
+               memmove(data->data, addr->contents, data->length); /* copy contents */
+           }
+
+           /* Write terminator: */
+           *dataPtr = NULL;
+       }
+       break;
+    case kAuthDataArray:
+       if (v5Creds->authdata == NULL) {
+           ccCreds->authdata = NULL;
+       } else {
+           krb5_authdata       **authPtr, *auth;
+           cc_data                     **dataPtr, *data;
+           unsigned int                        numRecords = 0;
+
+           /* Allocate the array of pointers: */
+           for (authPtr = v5Creds->authdata; *authPtr != NULL; numRecords++, authPtr++) {}
+
+           ccCreds->authdata = (cc_data **) malloc (sizeof(cc_data *) * (numRecords + 1));
+           if (ccCreds->authdata == NULL)
+               return ENOMEM;
+
+           /* Fill in the array, allocating the address structures: */
+           for (dataPtr = ccCreds->authdata, authPtr = v5Creds->authdata; *authPtr != NULL; authPtr++, dataPtr++) {
+
+               *dataPtr = (cc_data *) malloc (sizeof(cc_data));
+               if (*dataPtr == NULL)
+                   return ENOMEM;
+               data = *dataPtr;
+               auth = *authPtr;
+
+               data->type   = auth->ad_type;
+               data->length = auth->length;
+               data->data   = malloc (sizeof(char) * data->length);
+               if (data->data == NULL)
+                   return ENOMEM;
+               memmove(data->data, auth->contents, data->length); /* copy contents */
+           }
+
+           /* Write terminator: */
+           *dataPtr = NULL;
+       }
+       break;
+    }
+
+    return 0;
+
+}
+
+/*
+ * dupCC3toK5
+ * - allocate an empty k5 style ticket and copy info from the cc_creds ticket
+ */
+
+krb5_error_code
+dupCC3toK5(krb5_context context, cc_credentials_t src, krb5_creds *dest)
+{
+    const cc_credentials_union         *cu = src->data;
+    cc_credentials_v5_t                *cv5;
+    krb5_int32 offset_seconds = 0, offset_microseconds = 0;
+    krb5_error_code err;
+
+    if (cu->version != cc_credentials_v5) 
+       return KRB5_CC_NOT_KTYPE;
+
+    cv5 = cu->credentials.credentials_v5;
+
+    /*
+     * allocate and copy
+     * copy all of those damn fields back
+     */
+    err = krb5_parse_name(context, cv5->client, &(dest->client));
+    err = krb5_parse_name(context, cv5->server, &(dest->server));
+    if (err) 
+       return err; /* parsename fails w/o krb5.ini for example */
+
+    /* copy keyblock */
+    dest->keyblock.enctype = cv5->keyblock.type;
+    dest->keyblock.length = cv5->keyblock.length;
+    dest->keyblock.contents = (krb5_octet *)malloc(dest->keyblock.length);
+    memcpy(dest->keyblock.contents, cv5->keyblock.data, dest->keyblock.length);
+
+    /* copy times */
+#if TARGET_OS_MAC
+    err = krb5_get_time_offsets(context, &offset_seconds, &offset_microseconds);
+    if (err) 
+       return err;
+#endif
+    dest->times.authtime   = cv5->authtime     + offset_seconds;
+    dest->times.starttime  = cv5->starttime    + offset_seconds;
+    dest->times.endtime    = cv5->endtime      + offset_seconds;
+    dest->times.renew_till = cv5->renew_till   + offset_seconds;
+    dest->is_skey          = cv5->is_skey;
+    dest->ticket_flags     = cv5->ticket_flags;
+
+    /* more branching fields */
+    err = copyCC3DataArrayToK5(cv5, dest, kAddressArray);
+    if (err) 
+       return err;
+
+    /* first ticket */
+    dest->ticket.length = cv5->ticket.length;
+    dest->ticket.data = (char *)malloc(cv5->ticket.length);
+    memcpy(dest->ticket.data, cv5->ticket.data, cv5->ticket.length);
+
+    /* second ticket */
+    dest->second_ticket.length = cv5->second_ticket.length;
+    (dest->second_ticket).data = ( char *)malloc(cv5->second_ticket.length);
+    memcpy(dest->second_ticket.data, cv5->second_ticket.data, cv5->second_ticket.length);
+
+    /* zero out magic number */
+    dest->magic = 0;
+
+    /* authdata */
+    err = copyCC3DataArrayToK5(cv5, dest, kAuthDataArray);
+    if (err) 
+       return err;
+
+    return 0;
+}
+
+/*
+ * dupK5toCC3
+ * - analagous to above but in the reverse direction
+ */
+krb5_error_code
+dupK5toCC3(krb5_context context, krb5_creds *src, cc_credentials_t *dest)
+{
+    cc_credentials_v5_t *c;
+    cc_credentials_union *cu;
+    cc_credentials_f    *f;
+    int err;
+    krb5_int32 offset_seconds = 0, offset_microseconds = 0;
+    cc_credentials_t           creds = NULL;
+
+    if (dest == NULL) 
+       return KRB5_CC_NOMEM;
+
+    /* allocate the cc_credentials_t */
+    creds = (cc_credentials_t)malloc(sizeof(cc_credentials_d));
+    if (!creds) {
+       err = KRB5_CC_NOMEM;
+       goto cleanup;
+    }
+
+    /* allocate the cred_union */
+    creds->data = NULL;
+    creds->functions = NULL;
+#ifdef TARGET_OS_MAC
+    creds->otherFunctions = NULL;
+#endif
+    f = (cc_credentials_f *)malloc(sizeof(cc_credentials_f));
+    if (!f) {
+       err = KRB5_CC_NOMEM;
+       goto cleanup;
+    }
+    creds->functions = f;
+
+    cu = (cc_credentials_union *)malloc(sizeof(cc_credentials_union));
+    if (!creds->data) {
+       err = KRB5_CC_NOMEM;
+       goto cleanup;
+    }
+    creds->data = cu; 
+
+    f->release = krb5int_cc_credentials_release;
+    f->compare = krb5int_cc_credentials_compare;
+
+    cu->version = cc_credentials_v5;
+
+    c = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));
+    if (!c) {
+       err = KRB5_CC_NOMEM;
+       goto cleanup;
+    }
+    cu->credentials.credentials_v5 = c;
+
+    /* convert krb5 principals to flat principals */
+    err = krb5_unparse_name(context, src->client, &(c->client));
+    if (err) 
+       goto cleanup;
+
+    err = krb5_unparse_name(context, src->server, &(c->server));
+    if (err) 
+       goto cleanup;
+
+    /* copy more fields */
+    c->keyblock.type = src->keyblock.enctype;
+    c->keyblock.length = src->keyblock.length;
+
+    if (src->keyblock.contents != NULL) {
+       c->keyblock.data = (unsigned char *)malloc(src->keyblock.length);
+       memcpy(c->keyblock.data, src->keyblock.contents, src->keyblock.length);
+    } else {
+       c->keyblock.data = NULL;
+    }
+
+#if TARGET_OS_MAC
+    err = krb5_get_time_offsets(context, &offset_seconds, &offset_microseconds);
+    if (err) 
+       goto cleanup;
+#endif
+    c->authtime     = src->times.authtime   - offset_seconds;
+    c->starttime    = src->times.starttime  - offset_seconds;
+    c->endtime      = src->times.endtime    - offset_seconds;
+    c->renew_till   = src->times.renew_till - offset_seconds;
+    c->is_skey      = src->is_skey;
+    c->ticket_flags = src->ticket_flags;
+
+    err = copyK5DataArrayToCC3(src, c, kAddressArray);
+    if (err) 
+       goto cleanup;
+
+    c->ticket.length = src->ticket.length;
+    if (src->ticket.data != NULL) {
+       c->ticket.data = (unsigned char *)malloc(src->ticket.length);
+       memcpy(c->ticket.data, src->ticket.data, src->ticket.length);
+    } else {
+       c->ticket.data = NULL;
+    }
+
+    c->second_ticket.length = src->second_ticket.length;
+    if (src->second_ticket.data != NULL) {
+       c->second_ticket.data = (unsigned char *)malloc(src->second_ticket.length);
+       memcpy(c->second_ticket.data, src->second_ticket.data, src->second_ticket.length);
+    } else {
+       c->second_ticket.data = NULL;
+    }
+
+    err = copyK5DataArrayToCC3(src, c, kAuthDataArray);
+    if (err) 
+       goto cleanup;
+
+    *dest = creds;
+    return 0;
+
+  cleanup:
+    if (creds) {
+       if (creds->functions)
+           free((void *)creds->functions);
+       if (creds->data) {
+           if (creds->data->credentials.credentials_v5)
+               free(creds->data->credentials.credentials_v5);
+           free((void *)creds->data);
+       }
+       free(creds);
+    }
+
+    return err;
+}
+#else /* !USE_CCAPI_V3 */
 /*
  * CopyCCDataArrayToK5
  * - copy and translate the null terminated arrays of data records
@@ -323,6 +718,86 @@ void dupK5toCC(krb5_context context, krb5_creds *creds, cred_union **cu)
     return;
 }
 
+/* ----- free_cc_cred_union, etc -------------- */
+/*
+  Since the Kerberos5 library allocates a credentials cache structure
+  (in dupK5toCC() above) with its own memory allocation routines - which
+  may be different than how the CCache allocates memory - the Kerb5 library
+  must have its own version of cc_free_creds() to deallocate it.  These
+  functions do that.  The top-level function to substitue for cc_free_creds()
+  is krb5_free_cc_cred_union().
+
+  If the CCache library wants to use a cred_union structure created by
+  the Kerb5 library, it should make a deep copy of it to "translate" to its
+  own memory allocation space.
+*/
+static void deep_free_cc_data (cc_data data)
+{
+    if (data.data != NULL)
+       free (data.data);
+}
+
+static void deep_free_cc_data_array (cc_data** data) {
+
+    unsigned int       index;
+
+    if (data == NULL)
+       return;
+
+    for (index = 0; data [index] != NULL; index++) {
+       deep_free_cc_data (*(data [index]));
+       free (data [index]);
+    }
+
+    free (data);
+}
+
+static void deep_free_cc_v5_creds (cc_creds* creds)
+{
+    if (creds == NULL)
+       return;
+
+    if (creds -> client != NULL)
+       free (creds -> client);
+    if (creds -> server != NULL)
+       free (creds -> server);
+
+    deep_free_cc_data (creds -> keyblock);
+    deep_free_cc_data (creds -> ticket);
+    deep_free_cc_data (creds -> second_ticket);
+
+    deep_free_cc_data_array (creds -> addresses);
+    deep_free_cc_data_array (creds -> authdata);
+
+    free(creds);
+}
+
+static void deep_free_cc_creds (cred_union creds)
+{
+    if (creds.cred_type == CC_CRED_V4) {
+       /* we shouldn't get this, of course */
+       free (creds.cred.pV4Cred);
+    } else if (creds.cred_type == CC_CRED_V5) {
+       deep_free_cc_v5_creds (creds.cred.pV5Cred);
+    }
+}
+
+/* top-level exported function */
+cc_int32 krb5int_free_cc_cred_union (cred_union** creds)
+{
+    if (creds == NULL)
+       return CC_BAD_PARM;
+
+    if (*creds != NULL) {
+       deep_free_cc_creds (**creds);
+       free (*creds);
+       *creds = NULL;
+    }
+
+    return CC_NOERROR;
+}
+#endif
+
 /*
  * Utility functions...
  */
@@ -475,81 +950,4 @@ int stdccCredsMatch(krb5_context context, krb5_creds *base,
     return FALSE;
 }
 
-/* ----- free_cc_cred_union, etc -------------- */
-/*
-  Since the Kerberos5 library allocates a credentials cache structure
-  (in dupK5toCC() above) with its own memory allocation routines - which
-  may be different than how the CCache allocates memory - the Kerb5 library
-  must have its own version of cc_free_creds() to deallocate it.  These
-  functions do that.  The top-level function to substitue for cc_free_creds()
-  is krb5_free_cc_cred_union().
-
-  If the CCache library wants to use a cred_union structure created by
-  the Kerb5 library, it should make a deep copy of it to "translate" to its
-  own memory allocation space.
-*/
-static void deep_free_cc_data (cc_data data)
-{
-    if (data.data != NULL)
-       free (data.data);
-}
-
-static void deep_free_cc_data_array (cc_data** data) {
-
-    unsigned int       index;
-
-    if (data == NULL)
-       return;
 
-    for (index = 0; data [index] != NULL; index++) {
-       deep_free_cc_data (*(data [index]));
-       free (data [index]);
-    }
-
-    free (data);
-}
-
-static void deep_free_cc_v5_creds (cc_creds* creds)
-{
-    if (creds == NULL)
-       return;
-
-    if (creds -> client != NULL)
-       free (creds -> client);
-    if (creds -> server != NULL)
-       free (creds -> server);
-
-    deep_free_cc_data (creds -> keyblock);
-    deep_free_cc_data (creds -> ticket);
-    deep_free_cc_data (creds -> second_ticket);
-
-    deep_free_cc_data_array (creds -> addresses);
-    deep_free_cc_data_array (creds -> authdata);
-
-    free(creds);
-}
-
-static void deep_free_cc_creds (cred_union creds)
-{
-    if (creds.cred_type == CC_CRED_V4) {
-       /* we shouldn't get this, of course */
-       free (creds.cred.pV4Cred);
-    } else if (creds.cred_type == CC_CRED_V5) {
-       deep_free_cc_v5_creds (creds.cred.pV5Cred);
-    }
-}
-
-/* top-level exported function */
-cc_int32 krb5_free_cc_cred_union (cred_union** creds)
-{
-    if (creds == NULL)
-       return CC_BAD_PARM;
-
-    if (*creds != NULL) {
-       deep_free_cc_creds (**creds);
-       free (*creds);
-       *creds = NULL;
-    }
-
-    return CC_NOERROR;
-}
index 92bafc8fa6e682d3ca8300859142c2f68ceb4275..7476313dfa5c953ea38a7cb3d70dd0c365381c55 100644 (file)
@@ -5,6 +5,9 @@
 
 #include "autoconf.h"
 
+#if USE_CCAPI_V3
+#include <CredentialsCache.h>
+#else
 #if USE_CCAPI
 #include <CredentialsCache2.h>
 #endif
 #if defined(_WIN32)
 #include "cacheapi.h"
 #endif
+#endif
 
 #include "krb5.h"
 
 /* protoypes for private functions declared in stdcc_util.c */
+#ifdef USE_CCAPI_V3
+krb5_error_code dupCC3toK5(krb5_context context, cc_credentials_t src, krb5_creds *dest);
+krb5_error_code dupK5toCC3(krb5_context context, krb5_creds *src, cc_credentials_t *dest);
+cc_int32 krb5int_cc_credentials_release(cc_credentials_t creds);
+cc_int32 krb5int_cc_credentials_compare(cc_credentials_t creds,
+                                       cc_credentials_t compare_to,
+                                       cc_uint32* equal);
+int copyCC3DataArrayToK5(cc_credentials_v5_t *ccCreds, krb5_creds *v5Creds, char whichArray);
+int copyK5DataArrayToCC3(krb5_creds *v5Creds, cc_credentials_v5_t * ccCreds, char whichArray);
+#else
 int copyCCDataArrayToK5(cc_creds *cc, krb5_creds *kc, char whichArray);
 int copyK5DataArrayToCC(krb5_creds *kc, cc_creds *cc, char whichArray);
 void dupCCtoK5(krb5_context context, cc_creds *src, krb5_creds *dest);
 void dupK5toCC(krb5_context context, krb5_creds *creds, cred_union **cu);
+cc_int32 krb5int_free_cc_cred_union (cred_union** creds);
+#endif
 int stdccCredsMatch(krb5_context context, krb5_creds *base, krb5_creds *match, int whichfields);
 int bitTst(int var, int mask);
-cc_int32 krb5_free_cc_cred_union (cred_union** creds);
 
 #define kAddressArray 4 
 #define kAuthDataArray 5
index e285d1faf66e99efe6c950e185f5c0d8e6208ff4..245ae245e2f0db708c8950f3b95d11d36ea18969 100644 (file)
@@ -6,12 +6,24 @@
 #ifndef KRB5_WINCCLD_H_
 #define KRB5_WINCCLD_H_
 
+#ifdef USE_CCAPI_V3
+#include <CredentialsCache.h>
+#else
+
 #ifndef CC_API_VER2
 #define CC_API_VER2
 #endif
 
 #include "cacheapi.h"
+#endif
 
+#ifdef USE_CCAPI_V3
+typedef CCACHE_API cc_int32 (*FP_cc_initialize) (
+        cc_context_t*           outContext,
+        cc_int32                inVersion,
+        cc_int32*               outSupportedVersion,
+        char const**            outVendor);
+#else
 typedef cc_int32 (*FP_cc_initialize)(apiCB**, const cc_int32, 
                        cc_int32*, const char**);     
 typedef cc_int32 (*FP_cc_shutdown)(apiCB**);            
@@ -49,6 +61,7 @@ typedef cc_int32 (*FP_cc_seq_fetch_creds_end)(apiCB*, ccache_cit**);
 typedef cc_int32 (*FP_cc_free_principal)(apiCB*, char**);
 typedef cc_int32 (*FP_cc_free_name)(apiCB*, char** name);
 typedef cc_int32 (*FP_cc_free_creds)(apiCB*, cred_union** pCred);
+#endif
 
 #ifdef KRB5_WINCCLD_C_
 typedef struct _FUNC_INFO {
@@ -64,6 +77,7 @@ typedef struct _FUNC_INFO {
 #endif
 
 DECL_FUNC_PTR(cc_initialize);
+#ifndef USE_CCAPI_V3
 DECL_FUNC_PTR(cc_shutdown);
 DECL_FUNC_PTR(cc_get_change_time);
 DECL_FUNC_PTR(cc_create);
@@ -100,10 +114,12 @@ DECL_FUNC_PTR(cc_seq_fetch_creds);
 DECL_FUNC_PTR(cc_free_principal);
 DECL_FUNC_PTR(cc_free_name);
 DECL_FUNC_PTR(cc_free_creds);
+#endif
 
 #ifdef KRB5_WINCCLD_C_
 FUNC_INFO krbcc_fi[] = {
     MAKE_FUNC_INFO(cc_initialize),
+#ifndef USE_CCAPI_V3
     MAKE_FUNC_INFO(cc_shutdown),
     MAKE_FUNC_INFO(cc_get_change_time),
     MAKE_FUNC_INFO(cc_create),
@@ -134,6 +150,7 @@ FUNC_INFO krbcc_fi[] = {
     MAKE_FUNC_INFO(cc_free_principal),
     MAKE_FUNC_INFO(cc_free_name),
     MAKE_FUNC_INFO(cc_free_creds),
+#endif
     END_FUNC_INFO
 };
 #undef MAKE_FUNC_INFO
@@ -141,6 +158,7 @@ FUNC_INFO krbcc_fi[] = {
 #else
 
 #define cc_initialize pcc_initialize
+#ifndef USE_CCAPI_V3
 #define cc_shutdown pcc_shutdown
 #define cc_get_change_time pcc_get_change_time
 #define cc_create pcc_create
@@ -178,6 +196,7 @@ FUNC_INFO krbcc_fi[] = {
 #define cc_free_name pcc_free_name
 #define cc_free_creds pcc_free_creds
 #endif
+#endif
 
 #undef DECL_FUNC_PTR
 
index 2b15ff6f32bdbdf99470a76e7a34eb8281fbe497..df63e259d4cf3278b43a3c366fe04e3acb2c6186 100644 (file)
@@ -151,7 +151,7 @@ krb5_cc_resolve (krb5_context context, const char *name, krb5_ccache *cache)
 
     pfxlen = cp - name;
 
-    if ( pfxlen == 1 && isalpha(name[0]) ) {
+    if ( pfxlen == 1 && isalpha((unsigned char) name[0]) ) {
         /* We found a drive letter not a prefix - use FILE: */
         pfx = strdup("FILE:");
         if (!pfx)
index df4191ff6dcb8d85f995b06ade031c8ca40cad10..323af486075da85c3446c7286c9329d2785c1d5a 100644 (file)
@@ -63,7 +63,7 @@ $(OUTPRE)krb524_err.$(OBJEXT): krb524_err.c
 clean-unix:: clean-libobjs
        $(RM) $(HDRS) $(ETSRCS)
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 73b11f72a4dfa49eee4cda63a96375b9972129a3..98e1e7981dce5272d771af0dc563b476df2afe5d 100644 (file)
@@ -55,7 +55,7 @@ clean-windows::
        $(RM) $(OBJFILE)
 
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index e633c0c3a76debb7830602c57ddd9d07b47b81c6..8374e65468b6bd275d0cdec6b10690a69dd3bff9 100644 (file)
@@ -131,7 +131,7 @@ krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid)
 
     pfxlen = cp - name;
 
-    if ( pfxlen == 1 && isalpha(name[0]) ) {
+    if ( pfxlen == 1 && isalpha((unsigned char) name[0]) ) {
         /* We found a drive letter not a prefix - use FILE: */
         pfx = strdup("FILE:");
         if (!pfx)
index edf6d5f2f172445e9355b903bc28edcb88a9b526..4cbc4b9b05a33db0244d54b1f302cd8d14ed9c8f 100644 (file)
@@ -360,7 +360,7 @@ clean::
                $(OUTPRE)t_deltat$(EXEEXT) $(OUTPRE)t_deltat.$(OBJEXT) \
                $(OUTPRE)t_expand$(EXEEXT) $(OUTPRE)t_expand.$(OBJEXT)
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 885dc995adc0a26e805a6fc3c0b60bdf82977f33..67768835f2f5411c9d73c2fd01a1bb3a14651e51 100644 (file)
@@ -329,8 +329,8 @@ krb5_425_conv_principal(krb5_context context, const char *name, const char *inst
                      return retval;
                  if (domain) {
                      for (cp = domain; *cp; cp++)
-                         if (isupper((int) (*cp)))
-                             *cp = tolower((int) *cp);
+                         if (isupper((unsigned char) (*cp)))
+                             *cp = tolower((unsigned char) *cp);
                      strncat(buf, ".", sizeof(buf) - 1 - strlen(buf));
                      strncat(buf, domain, sizeof(buf) - 1 - strlen(buf));
                      krb5_xfree(domain);
index e1e1e755e7d1e404cdd11b4ee675629d17667df3..8e4ce8c3b3a4fbc041a3c252bd2f4232bc46ec48 100644 (file)
@@ -485,3 +485,90 @@ krb5_is_permitted_enctype(krb5_context context, krb5_enctype etype)
 
     return(ret);
 }
+
+static krb5_error_code
+copy_ktypes(krb5_context ctx,
+           unsigned int nktypes,
+           krb5_enctype *oldktypes,
+           krb5_enctype **newktypes)
+{
+    unsigned int i;
+
+    *newktypes = NULL;
+    if (!nktypes)
+       return 0;
+
+    *newktypes = malloc(nktypes * sizeof(krb5_enctype));
+    if (*newktypes == NULL)
+       return ENOMEM;
+    for (i = 0; i < nktypes; i++)
+       (*newktypes)[i] = oldktypes[i];
+    return 0;
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_copy_context(krb5_context ctx, krb5_context *nctx_out)
+{
+    krb5_error_code ret;
+    krb5_context nctx;
+
+    *nctx_out = NULL;
+    if (ctx == NULL)
+       return EINVAL;          /* XXX */
+
+    nctx = malloc(sizeof(*nctx));
+    if (nctx == NULL)
+       return ENOMEM;
+
+    *nctx = *ctx;
+
+    nctx->in_tkt_ktypes = NULL;
+    nctx->in_tkt_ktype_count = 0;
+    nctx->tgs_ktypes = NULL;
+    nctx->tgs_ktype_count = 0;
+    nctx->default_realm = NULL;
+    nctx->profile = NULL;
+    nctx->db_context = NULL;
+    nctx->ser_ctx_count = 0;
+    nctx->ser_ctx = NULL;
+    nctx->prompt_types = NULL;
+    nctx->os_context->default_ccname = NULL;
+
+    memset(&nctx->libkrb5_plugins, 0, sizeof(nctx->libkrb5_plugins));
+    nctx->vtbl = NULL;
+    nctx->locate_fptrs = NULL;
+
+    memset(&nctx->err, 0, sizeof(nctx->err));
+
+    ret = copy_ktypes(nctx, ctx->in_tkt_ktype_count,
+                     ctx->in_tkt_ktypes, &nctx->in_tkt_ktypes);
+    if (ret)
+       goto errout;
+    nctx->in_tkt_ktype_count = ctx->in_tkt_ktype_count;
+
+    ret = copy_ktypes(nctx, ctx->tgs_ktype_count,
+                     ctx->tgs_ktypes, &nctx->in_tkt_ktypes);
+    if (ret)
+       goto errout;
+    nctx->tgs_ktype_count = ctx->tgs_ktype_count;
+
+    if (ctx->os_context->default_ccname != NULL) {
+       nctx->os_context->default_ccname =
+           strdup(ctx->os_context->default_ccname);
+       if (nctx->os_context->default_ccname == NULL) {
+           ret = ENOMEM;
+           goto errout;
+       }
+    }
+    ret = krb5_get_profile(ctx, &nctx->profile);
+    if (ret)
+       goto errout;
+
+errout:
+    if (ret) {
+       krb5_free_context(nctx);
+    } else {
+       *nctx_out = nctx;
+    }
+    return ret;
+}
index 6de62b7806019ca5821614f7483582d61b3c513d..448b38910b1279cd371b95226d0514dd37176378 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdarg.h>
 #include "k5-int.h"
 
-void
+void KRB5_CALLCONV_C
 krb5_set_error_message (krb5_context ctx, krb5_error_code code,
                        const char *fmt, ...)
 {
@@ -40,7 +40,7 @@ krb5_set_error_message (krb5_context ctx, krb5_error_code code,
     va_end (args);
 }
 
-void
+void KRB5_CALLCONV
 krb5_vset_error_message (krb5_context ctx, krb5_error_code code,
                         const char *fmt, va_list args)
 {
@@ -49,7 +49,7 @@ krb5_vset_error_message (krb5_context ctx, krb5_error_code code,
     krb5int_vset_error (&ctx->err, code, fmt, args);
 }
 
-char *
+char * KRB5_CALLCONV
 krb5_get_error_message (krb5_context ctx, krb5_error_code code)
 {
     if (ctx == NULL)
@@ -57,7 +57,7 @@ krb5_get_error_message (krb5_context ctx, krb5_error_code code)
     return krb5int_get_error (&ctx->err, code);
 }
 
-void
+void KRB5_CALLCONV
 krb5_free_error_message (krb5_context ctx, char *msg)
 {
     if (ctx == NULL)
@@ -65,7 +65,7 @@ krb5_free_error_message (krb5_context ctx, char *msg)
     krb5int_free_error (&ctx->err, msg);
 }
 
-void
+void KRB5_CALLCONV
 krb5_clear_error_message (krb5_context ctx)
 {
     if (ctx == NULL)
index 898b3f6878235ede926d5d7ee749ca371ee81090..da51b70b7d5805e67f38f8269c484f38c3561826 100644 (file)
@@ -115,17 +115,13 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece,
     retval = krb5_rc_recover_or_initialize(context, rcache, context->clockskew);
     if (retval) {
        krb5_rc_close(context, rcache);
-       rcache = 0;
        goto cleanup;
     }
 
     *rcptr = rcache;
-    rcache = 0;
     retval = 0;
 
 cleanup:
-    if (rcache)
-       krb5_xfree(rcache);
     if (cachename)
        krb5_xfree(cachename);
     return retval;
index b2fd14e575478641634bcdc46c1764d2312fed2b..94e94e45dbb9f9292eeadfe52b71931daebefd24 100644 (file)
@@ -323,6 +323,7 @@ krb5_copy_addresses
 krb5_copy_authdata
 krb5_copy_authenticator
 krb5_copy_checksum
+krb5_copy_context
 krb5_copy_creds
 krb5_copy_data
 krb5_copy_keyblock
index db391ab15fde7552a2c8a8a90f5abc818e48775b..6f74ad61a46e0dfde2dd549c1a6314856d2bbdb0 100644 (file)
@@ -7,6 +7,7 @@ PROG_LIBPATH=-L$(TOPLIBD)
 PROG_RPATH=$(KRB5_LIBDIR)
 DEFS=
 DEFINES=-DLIBDIR=\"$(KRB5_LIBDIR)\"
+LOCALINCLUDES=-I$(SRCTOP)/util/profile
 
 ##DOS##BUILDTOP = ..\..\..
 ##DOS##PREFIXDIR=os
@@ -161,8 +162,7 @@ shared:
 
 TEST_PROGS= t_std_conf t_an_to_ln t_locate_kdc
 
-T_STD_CONF_OBJS= t_std_conf.o def_realm.o get_krbhst.o realm_dom.o \
-               hst_realm.o init_os_ctx.o locate_kdc.o dnsglue.o
+T_STD_CONF_OBJS= t_std_conf.o 
 
 T_AN_TO_LN_OBJS = t_an_to_ln.o an_to_ln.o 
 
@@ -239,7 +239,7 @@ check-unix::
 clean:: 
        $(RM) $(TEST_PROGS) test.out t_std_conf.o t_an_to_ln.o
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
@@ -392,7 +392,8 @@ init_os_ctx.so init_os_ctx.po $(OUTPRE)init_os_ctx.$(OBJEXT): \
   $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \
   $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/krb5.h \
   $(SRCTOP)/include/krb5/locate_plugin.h $(SRCTOP)/include/port-sockets.h \
-  $(SRCTOP)/include/socket-utils.h init_os_ctx.c os-proto.h
+  $(SRCTOP)/include/socket-utils.h $(SRCTOP)/util/profile/prof_int.h \
+  init_os_ctx.c os-proto.h
 krbfileio.so krbfileio.po $(OUTPRE)krbfileio.$(OBJEXT): \
   $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
   $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
index b5c8f66ff492860291ac627136ab713afce0bd1f..17b1e42c492350bf3828fa089a90cd5015e9bf67 100644 (file)
@@ -235,8 +235,8 @@ krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp)
     }
 
     for (cp = local_host; *cp; cp++) {
-       if (isupper((int) (*cp)))
-           *cp = tolower((int) *cp);
+       if (isupper((unsigned char) (*cp)))
+           *cp = tolower((unsigned char) *cp);
     }
     l = strlen(local_host);
     /* strip off trailing dot */
@@ -318,8 +318,8 @@ krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp)
 
             /* Assume the realm name is upper case */
             for (cp = realm; *cp; cp++)
-                if (islower((int) (*cp)))
-                    *cp = toupper((int) *cp);
+                if (islower((unsigned char) (*cp)))
+                    *cp = toupper((unsigned char) *cp);
         } else {    
             /* We are defaulting to the local realm */
             retval = krb5_get_default_realm(context, &realm);
index d26743ac69ce636690eb356c76360049bc653ce0..893355ef93d7ae4f9964dd1f51d0d37ca9254ee9 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "k5-int.h"
 #include "os-proto.h"
+#include "prof_int.h"          /* XXX for profile_copy, not public yet */
 
 #ifdef USE_LOGIN_LIBRARY
 #include "KerberosLoginPrivate.h"
@@ -414,30 +415,7 @@ krb5_os_init_context(krb5_context ctx, krb5_boolean kdc)
 krb5_error_code KRB5_CALLCONV
 krb5_get_profile (krb5_context ctx, profile_t *profile)
 {
-    krb5_error_code    retval = 0;
-    profile_filespec_t *files = 0;
-
-    retval = os_get_default_config_files(&files, ctx->profile_secure);
-
-    if (!retval) {
-        retval = profile_init((const_profile_filespec_t *) files,
-                             profile);
-    }
-
-    if (files)
-        free_filespecs(files);
-
-    if (retval == ENOENT)
-        return KRB5_CONFIG_CANTOPEN;
-
-    if ((retval == PROF_SECTION_NOTOP) ||
-        (retval == PROF_SECTION_SYNTAX) ||
-        (retval == PROF_RELATION_SYNTAX) ||
-        (retval == PROF_EXTRA_CBRACE) ||
-        (retval == PROF_MISSING_OBRACE))
-        return KRB5_CONFIG_BADFORMAT;
-
-    return retval;
+    return profile_copy (ctx->profile, profile);
 }      
 
 
index 65678c8294b573d06a95fa814dcc4d40f84bc589..2ba7e8ae2a351e5f1b231e8a49c6e4315a39876f 100644 (file)
@@ -148,8 +148,8 @@ krb5_sname_to_principal(krb5_context context, const char *hostname, const char *
 
        if (type == KRB5_NT_SRV_HST)
            for (cp = remote_host; *cp; cp++)
-               if (isupper((int) (*cp)))
-                   *cp = tolower((int) (*cp));
+               if (isupper((unsigned char) (*cp)))
+                   *cp = tolower((unsigned char) (*cp));
 
        /*
         * Windows NT5's broken resolver gratuitously tacks on a
index 64a0773276e141c5304dcb1e5c7c9acdd1bda59b..65a7b601d53e12230decbe340f627d2679653497 100644 (file)
@@ -15,4 +15,4 @@ all-unix:: all-libobjs
 clean-unix:: clean-libobjs
 
 ##WIN32##LIBOBJS = $(OUTPRE)syslog.obj
-@libobj_frag@
+@libobj_frag@
index 05b76095581fbbe33d4d88badc799ad36c709bb6..5ade48900718a2cc0ae956f25b1bae08c424cc58 100644 (file)
@@ -43,7 +43,7 @@ SRCS= \
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
 
-@libobj_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index db0be8c617fa7e050b9061451b614cde39cbbd68..9785df56300e730c7a815ffbc4ff5e926e6b4da1 100644 (file)
@@ -100,6 +100,7 @@ krb5_c_string_to_key_with_params
        krb5_copy_authdata
        krb5_copy_authenticator
        krb5_copy_checksum
+       krb5_copy_context
        krb5_copy_creds
        krb5_copy_data
        krb5_copy_keyblock
index 1d3c6eacbfe60a19674c852539c6ce7483c2023f..1e28cc22c950bbd0d352ab40183bd2d55e22c92b 100644 (file)
@@ -280,8 +280,8 @@ clean-windows::
 $(HDRS): includes
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 1a7bc741b6b366d9634b7ec4365cedb73757be64..79a29ccf4fd83340ca309067411986e93f21ce8e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * patchlevel.h
  *
- * Copyright (C) 2004 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2004-2006 by the Massachusetts Institute of Technology.
  * All rights reserved.
  *
  * Export of this software from the United States of America may
@@ -51,8 +51,8 @@
  * organization.
  */
 #define KRB5_MAJOR_RELEASE 1
-#define KRB5_MINOR_RELEASE 5
+#define KRB5_MINOR_RELEASE 6
 #define KRB5_PATCHLEVEL 0
-#define KRB5_RELTAIL "alpha1-postrelease"
+#define KRB5_RELTAIL "prerelease"
 /* #undef KRB5_RELDATE */
 /* #undef KRB5_RELTAG */
index bf1a6c05e6be57b6b8f8dc8c9c93b23319d26db0..d79063701846c19c59587f8bacaef2b5435c6dd4 100644 (file)
@@ -76,8 +76,8 @@ $(DB_DEPS) $(DBOBJLISTS-k5) $(DBSHOBJLISTS): all-recurse
 clean::
        $(RM) lib$(LIBBASE)$(SO_EXT) db2_exp.o
 
-@libnover_frag@
-@libobj_frag@
+@libnover_frag@
+@libobj_frag@
 
 .depend-verify-db: depend-verify-db-$(DB_VERSION)
 depend-verify-db-k5:
index 93fed6f3c0d8265da3bd91c0339d85fe908950b9..1d977ed86853fe0b42b0fb714c1e5844b27b68f8 100644 (file)
@@ -40,4 +40,4 @@ $(srcdir)/include/autoconf.stmp: $(srcdir)/configure.in $(SRCTOP)/aclocal.m4
 
 clean-includes::
        $(RM) $(HDRS) include/*.stmp
-@lib_frag@
+@lib_frag@
index 52243b4607d7d2da1174fe15b556bffb04c9c4c2..eb166d37b3b0277d100a42eafb1549366ae67013 100644 (file)
@@ -11,4 +11,4 @@ LOCALINCLUDES=        -I. -I$(srcdir)/../include -I../include -I$(srcdir)/../mpool \
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index 09f8089672c321627e055298c3839866aaccc4c1..8ea1ec8d633ade6712cb682313b71f5c331aa30f 100644 (file)
@@ -8,4 +8,4 @@ LOCALINCLUDES=-I../include
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index 074bb7f32944e0d467c571aae9eb4ed27b76c1a7..e40c69186fd404ff46b63c0c3b9620cef3fcde4d 100644 (file)
@@ -8,4 +8,4 @@ LOCALINCLUDES=  -I. -I$(srcdir)/../include -I../include -I$(srcdir)/../mpool
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index 1e60e9a18cb46e0bbc548c75aa352a427c948a8b..232376012bc1ff5cf56823a5951f933620bed401 100644 (file)
@@ -10,4 +10,4 @@ LOCALINCLUDES=        -I. -I$(srcdir)/../include -I../include -I$(srcdir)/../mpool \
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index 9745c4e3007f52da5f2a12320dc9aa6b54064a5e..d06b69a9c21cb5fe2ffb74ea35b1ed5f57020f40 100644 (file)
@@ -8,4 +8,4 @@ LOCALINCLUDES=  -I. -I$(srcdir)/../include -I../include -I$(srcdir)/../db
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index 4d6b9a508416b7411f4b9915f8a215913b576b15..ba0697cb80c4049a83f0fa4a00f62153c9a74954 100644 (file)
@@ -10,4 +10,4 @@ LOCALINCLUDES=        -I. -I$(srcdir)/../include -I../include -I$(srcdir)/../mpool \
 
 all-unix:: all-libobjs
 clean-unix:: clean-libobjs
-@libobj_frag@
+@libobj_frag@
index fc8009c8f6686e5b3c0a7df9b4f9ef98b1d8baec..9915052aa864febb5dd3dd189ac11c6d1e8d9b1a 100644 (file)
@@ -25,8 +25,8 @@ all-unix:: $(LIBBASE)$(SO_EXT)
 install-unix:: install-libs
 clean-unix:: clean-libs clean-libobjs
 
-@libnover_frag@
-@libobj_frag@
+@libnover_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 98035fcf951d7a08593a7712209d84bed1c5b08f..1d53b101b1270fa81bb48857f972b2f5703689af 100644 (file)
@@ -119,11 +119,19 @@ allow for an alternate port number for
 .I kpropd
 to listen on. This is only useful if the program is run in standalone
 mode.
+.TP
+.B \-a
+allows the user to specify the path to the
+.KR kpropd.acl
+file; by default the path used is KPROPD_ACL_FILE
+(normally /usr/local/var/krb5kdc/kpropd.acl).
 .SH FILES
 .TP "\w'kpropd.acl\ \ 'u"
 kpropd.acl
 Access file for
-.BR kpropd .
+.BR kpropd ;
+the default location is KPROPD_ACL_FILE (normally
+/usr/local/var/krb5kdc/kpropd.acl).
 Each entry is a line containing the principal of a host from which the
 local machine will allow Kerberos database propagation via kprop.
 .SH SEE ALSO
index 9d87b9ebf5594279b2287fb7581f9acb57815e19..77c2703917348f2997a0ee9603c6045a6c20d60d 100644 (file)
@@ -478,7 +478,7 @@ void PRS(argv)
                                case 'S':
                                        standalone++;
                                        break;
-                                  case 'a':
+                               case 'a':
                                        if (*word)
                                             acl_file_name = word;
                                        else
index 660161fa19b3a7d25d12ba64e3419da8544e309f..6ad2e9de857bea2eb1a28c021c5ea7f881337080 100644 (file)
@@ -77,9 +77,9 @@ krb5_error_code krb5_data_hex_parse(krb5_data *d, const char *s)
     for (lo = 0, dp = d->data, cp = s; *cp; cp++) {
        if (*cp < 0)
            return ASN1_PARSE_ERROR;
-       else if (isspace(*cp))
+       else if (isspace((unsigned char) *cp))
            continue;
-       else if (isxdigit(*cp)) {
+       else if (isxdigit((unsigned char) *cp)) {
            buf[0] = *cp;
            v = strtol(buf, NULL, 16);
        } else
index 8d78c58c81530c24184fe469778e3961c46340e1..b9284fcc47eb6d79e579cadaab8d2c8b742e2540 100644 (file)
@@ -198,7 +198,7 @@ proc ftp_test { } {
     start_ftp_daemon
 
     # Make an ftp client connection to it.
-    spawn $FTP $hostname [expr 8 + $portbase]
+    spawn $FTP -d -v $hostname [expr 8 + $portbase]
 
     expect_after {
        "GSSAPI authentication failed" {
index dbe9b950c43cda5a35b4e93255fcfadd80def105..554906e4462da8764c3d593ab7a96008f746a8c5 100644 (file)
@@ -31,6 +31,8 @@ proc doit { } {
     global spawn_id
     global supported_enctypes
     global KRBIV
+    global portbase
+    global mode
 
     # Start up the kerberos and kadmind daemons.
     if ![start_kerberos_daemons 1] {
@@ -143,6 +145,36 @@ proc doit { } {
            pass "kadmin.local correct high kvno"
        }
     }
+
+    if { $mode == "tcp" } {
+       set response {}
+       set got_response 0
+       set kdcsock ""
+       catch {
+           send_log "connecting to $hostname [expr 3 + $portbase]\n"
+           set kdcsock [socket $hostname [expr 3 + $portbase]]
+           fconfigure $kdcsock -encoding binary -blocking 0 -buffering none
+           puts -nonewline $kdcsock [binary format H* ffffffff]
+           # XXX
+           sleep 3
+           set response [read $kdcsock]
+           set got_response 1
+       } msg
+       if [string length $kdcsock] { catch "close $kdcsock" }
+       if $got_response {
+#      send_log [list sent length -1, got back $response]
+#      send_log "\n"
+           if [string length $response]>10 {
+               pass "too-long TCP request"
+           } else {
+               send_log "response too short\n"
+               fail "too-long TCP request"
+           }
+       } else {
+           send_log "too-long connect/exchange failure: $msg\n"
+           fail "too-long TCP request"
+       }
+    }
 }
 
 set status [catch doit msg]
index 447421e8e792ea0b50bc046ad29aee081d087215..b007c9cecd963c637fcb898cb8d8b20015f80c2f 100644 (file)
@@ -9,7 +9,10 @@ eval 'exec /usr/athena/bin/perl -S $0 ${1+"$@"}'
 use strict;
 use IO::File;
 
-my $h_filename = shift @ARGV || die "usage: $0 header-file [def-file]\n";
+my $verbose = 0;
+my $error = 0;
+if ( $ARGV[0] eq "-v" ) { $verbose = 1; shift @ARGV; }
+my $h_filename = shift @ARGV || die "usage: $0 [-v] header-file [def-file]\n";
 my $d_filename = shift @ARGV;
 
 my $h = open_always($h_filename);
@@ -47,14 +50,12 @@ while (! $h->eof()) {
     }
   Top:
     # drop KRB5INT_BEGIN_DECLS and KRB5INT_END_DECLS
-    if (/^ *KRB5INT_BEGIN_DECLS/) {
-        next LINE;
-    }
-    if (/^ *KRB5INT_END_DECLS/) {
+    if (/^ *(KRB5INT|GSSAPI[A-Z]*)_(BEGIN|END)_DECLS/) {
         next LINE;
     }
     # drop preprocessor directives
     if (/^ *#/) {
+       while (/\\$/) { $_ .= $h->getline(); }
         next LINE;
     }
     if (/^ *\?==/) {
@@ -75,7 +76,7 @@ while (! $h->eof()) {
     }
     # multi-line comments?
     if (/\/\*$/) {
-       $_ .= "\n";
+       $_ .= " ";
        $len1 = length;
        $_ .= $h->getline();
        chop if $len1 < length;
@@ -85,7 +86,7 @@ while (! $h->eof()) {
     if (/^[ \t]*$/) {
         next LINE;
     }
-    if (/ *extern "C" {/) {
+    if (/^ *extern "C" {/) {
         next LINE;
     }
     # elide struct definitions
@@ -180,11 +181,13 @@ while (! $h->eof()) {
     }
 }
 
-print join("\n\t", "Using default calling convention:", sort(@convD));
-print join("\n\t", "\nUsing KRB5_CALLCONV:", sort(@convK));
-print join("\n\t", "\nUsing KRB5_CALLCONV_C:", sort(@convC));
-print join("\n\t", "\nUsing KRB5_CALLCONV_WRONG:", sort(@convW));
-print "\n","-"x70,"\n";
+if ( $verbose ) {
+    print join("\n\t", "Using default calling convention:", sort(@convD));
+    print join("\n\t", "\nUsing KRB5_CALLCONV:", sort(@convK));
+    print join("\n\t", "\nUsing KRB5_CALLCONV_C:", sort(@convC));
+    print join("\n\t", "\nUsing KRB5_CALLCONV_WRONG:", sort(@convW));
+    print "\n","-"x70,"\n";
+}
 
 %conv = ();
 map { $conv{$_} = "default"; } @convD;
@@ -196,8 +199,8 @@ my %vararg = ();
 map { $vararg{$_} = 1; } @vararg;
 
 if (!$d) {
-    print "No .DEF file specified\n";
-    exit;
+    print "No .DEF file specified\n" if $verbose;
+    exit 0;
 }
 
 LINE2:
@@ -213,7 +216,7 @@ while (! $d->eof()) {
         $printit = 0;
         next LINE2;
     }
-    if (/^EXPORTS/) {
+    if (/^EXPORTS/ || /^DESCRIPTION/ || /^HEAPSIZE/) {
         $printit = 0;
         next LINE2;
     }
@@ -221,6 +224,8 @@ while (! $d->eof()) {
     my($xconv);
     if (/PRIVATE/ || /INTERNAL/) {
        $xconv = "PRIVATE";
+    } elsif (/DATA/) {
+       $xconv = "DATA";
     } elsif (/!CALLCONV/ || /KRB5_CALLCONV_WRONG/) {
        $xconv = "KRB5_CALLCONV_WRONG";
     } elsif ($vararg{$_}) {
@@ -231,16 +236,23 @@ while (! $d->eof()) {
     s/;.*$//;
 
     if ($xconv eq "PRIVATE") {
-       print "\t private $_\n";
+       print "\t private $_\n" if $verbose;
+       next LINE2;
+    }
+    if ($xconv eq "DATA") {
+       print "\t data $_\n" if $verbose;
        next LINE2;
     }
     if (!defined($conv{$_})) {
        print "No calling convention specified for $_!\n";
+       $error = 1;
     } elsif (! ($conv{$_} eq $xconv)) {
        print "Function $_ should have calling convention '$xconv', but has '$conv{$_}' instead.\n";
+       $error = 1;
     } else {
 #      print "Function $_ is okay.\n";
     }
 }
 
 #print "Calling conventions defined for: ", keys(%conv);
+exit $error;
index 184ca50fb07534d201edfe892a129af39de1ef6c..fd311296378324d38a3e7fd2d4ca9695925677a9 100644 (file)
@@ -245,8 +245,8 @@ TAGS:       et_name.c error_message.c compile_et.c error_table.c \
 depend::  et_lex.lex.c
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 51d47afc924f7da38ce9e5a0d4751c919372c9bf..2384b7dee0b9d43cfc4fd2a4567673e13b731b76 100755 (executable)
@@ -139,22 +139,6 @@ if test $checkout = t; then
        svn export $repository/$reltag $reldir
 fi
 
-if test $dosrc = t; then
-       if test -d $reldir/src/util/autoconf; then
-               echo "Building autoconf..."
-               (cd $reldir/src/util/autoconf
-                       M4=gm4 ./configure
-                       make)
-       fi
-       echo "Creating configure scripts..."
-       (cd $reldir/src; util/reconf)
-
-       if test -d $reldir/src/util/autoconf; then
-               echo "Cleaning src/util/autoconf..."
-               (cd $reldir/src/util/autoconf; make distclean)
-       fi
-fi
-
 echo "Editing release-specific files..."
 
 if test $newstyle = t; then 
@@ -162,6 +146,9 @@ if test $newstyle = t; then
                sed -e '/RELDATE/c\
 #define KRB5_RELDATE "'"$reldate"'"' patchlevel.h > patchlevel.h.new && \
                mv patchlevel.h.new patchlevel.h)
+       if test $checkout = t; then
+               (cd $reldir && svn log -v $repository/$reltag > doc/CHANGES)
+       fi
 else
 
        (cd $reldir/src/lib/krb5/krb && \
@@ -182,6 +169,22 @@ EOF
        )
 fi
 
+if test $dosrc = t; then
+       if test -d $reldir/src/util/autoconf; then
+               echo "Building autoconf..."
+               (cd $reldir/src/util/autoconf
+                       M4=gm4 ./configure
+                       make)
+       fi
+       echo "Creating configure scripts..."
+       (cd $reldir/src; util/reconf)
+
+       if test -d $reldir/src/util/autoconf; then
+               echo "Cleaning src/util/autoconf..."
+               (cd $reldir/src/util/autoconf; make distclean)
+       fi
+fi
+
 echo "Nuking unneeded files..."
 find $reldir \( -name TODO -o -name todo -o -name .cvsignore \
        -o -name BADSYMS -o -name .Sanitize -o -name .rconf \) -print \
index 1175a3ef10793e307f2c5c634546a03ce7f072fd..3d99ea70effd7f4fcb23d62713bbf5dada84d793 100644 (file)
@@ -151,8 +151,8 @@ check-windows:: $(OUTPRE)test_profile.exe $(OUTPRE)test_parse.exe
        $(OUTPRE)test_parse test.ini
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 888d46d0a61ac72db3f639c91166517cc3378cbb..e5c6f9c8c5b3535360c197d3595a922858d8ed2e 100644 (file)
@@ -66,6 +66,39 @@ profile_init(const_profile_filespec_t *files, profile_t *ret_profile)
         return 0;
 }
 
+#define COUNT_LINKED_LIST(COUNT, PTYPE, START, FIELD)  \
+       {                                               \
+           int cll_counter = 0;                        \
+           PTYPE cll_ptr = (START);                    \
+           while (cll_ptr != NULL) {                   \
+               cll_counter++;                          \
+               cll_ptr = cll_ptr->FIELD;               \
+           }                                           \
+           (COUNT) = cll_counter;                      \
+       }
+
+errcode_t KRB5_CALLCONV
+profile_copy(profile_t old_profile, profile_t *new_profile)
+{
+    size_t size, i;
+    const_profile_filespec_t *files;
+    prf_file_t file;
+    errcode_t err;
+
+    /* The fields we care about are read-only after creation, so
+       no locking is needed.  */
+    COUNT_LINKED_LIST (size, prf_file_t, old_profile->first_file, next);
+    files = malloc ((size+1) * sizeof(*files));
+    if (files == NULL)
+       return errno;
+    for (i = 0, file = old_profile->first_file; i < size; i++, file = file->next)
+       files[i] = file->data->filespec;
+    files[size] = NULL;
+    err = profile_init (files, new_profile);
+    free (files);
+    return err;
+}
+
 errcode_t KRB5_CALLCONV
 profile_init_path(const_profile_filespec_list_t filepath,
                  profile_t *ret_profile)
index 70a8dd920853a7f5cb56551a6059b9f114473644..d6349afd725ea34f01931adbfbb27edaa34cf5c9 100644 (file)
@@ -192,6 +192,8 @@ errcode_t profile_rename_node
 
 /* prof_file.c */
 
+errcode_t KRB5_CALLCONV profile_copy (profile_t, profile_t *);
+
 errcode_t profile_open_file
        (const_profile_filespec_t file, prf_file_t *ret_prof);
 
index b9a492a86890e38f63689fbd246eea747df14aa8..fe39c391831e11493764ca55d566d2384adfdf5d 100644 (file)
@@ -166,8 +166,8 @@ clean::
                TAGS test_ss
 
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 4b0ea81bb684b0cfe38e1edeeb5698b141706f9b..a6aa3fccf4af67a102f2bb25691d902f569c3920 100644 (file)
@@ -19,8 +19,8 @@ PROG_LIBPATH=-L$(TOPLIBD)
 PROG_RPATH=$(KRB5_LIBDIR)
 
 LIBBASE=krb5support
-LIBMAJOR=1
-LIBMINOR=0
+LIBMAJOR=@SUPPORTLIB_MAJOR@
+LIBMINOR=1
 
 LIBINITFUNC=krb5int_thread_support_init
 LIBFINIFUNC=krb5int_thread_support_fini
@@ -76,8 +76,8 @@ $(BUILDTOP)/include/autoconf.h: $(SRCTOP)/include/autoconf.h.in
 t_mktime: gmt_mktime.c
        $(CC) $(ALL_CFLAGS) -DTEST_LEAP -o t_mktime $(srcdir)/gmt_mktime.c
 
-@lib_frag@
-@libobj_frag@
+@lib_frag@
+@libobj_frag@
 
 # +++ Dependency line eater +++
 # 
index 67ddf625c67057ee357659b07ca9af35bf13edab..7c93753d47234e25277df4c504981f6e4b319931 100644 (file)
@@ -48,6 +48,8 @@ void
 krb5int_vset_error (struct errinfo *ep, long code,
                    const char *fmt, va_list args)
 {
+    char *p;
+
     if (ep->msg && ep->msg != ep->scratch_buf) {
        free (ep->msg);
        ep->msg = NULL;
@@ -63,18 +65,20 @@ krb5int_vset_error (struct errinfo *ep, long code,
     }
 #endif
     vsnprintf(ep->scratch_buf, sizeof(ep->scratch_buf), fmt, args);
-    ep->msg = ep->scratch_buf;
+    p = strdup(ep->scratch_buf);
+    ep->msg = p ? p : ep->scratch_buf;
 }
 
 char *
 krb5int_get_error (struct errinfo *ep, long code)
 {
     char *r, *r2;
-    if (code != ep->code)
-       krb5int_clear_error (ep);
-    if (ep->msg) {
-       r = ep->msg;
-       ep->msg = NULL;
+    if (code == ep->code && ep->msg) {
+       r = strdup(ep->msg);
+       if (r == NULL) {
+           strcpy(ep->scratch_buf, _("Out of memory"));
+           r = ep->scratch_buf;
+       }
        return r;
     }
     if (initialize() != 0) {
@@ -88,8 +92,12 @@ krb5int_get_error (struct errinfo *ep, long code)
     if (fptr == NULL) {
        unlock();
 #ifdef HAVE_STRERROR_R
-       if (strerror_r (code, ep->scratch_buf, sizeof(ep->scratch_buf)) == 0)
+       if (strerror_r (code, ep->scratch_buf, sizeof(ep->scratch_buf)) == 0) {
+           char *p = strdup(ep->scratch_buf);
+           if (p)
+               return p;
            return ep->scratch_buf;
+       }
        /* If strerror_r didn't work with the 1K buffer, we can try a
           really big one.  This seems kind of gratuitous though.  */
 #define BIG_ERR_BUFSIZ 8192
index 922dc8d9b116f1059d1102098763d19cc54fe019..eba4c74b604ed9638fc9cc00ad35208d9c4559b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001,2002,2003,2004,2005 by the Massachusetts Institute of Technology,
+ * Copyright (C) 2001,2002,2003,2004,2005,2006 by the Massachusetts Institute of Technology,
  * Cambridge, MA, USA.  All Rights Reserved.
  * 
  * This software is being provided to you, the LICENSEE, by the 
@@ -162,20 +162,23 @@ extern /*@dependent@*/ char *gai_strerror (int code) /*@*/;
    either getaddrinfo or one of these two flavors of
    gethostbyname_r?  */
 #if !defined(HAVE_GETHOSTBYNAME_R) || defined(THREADSAFE_GETHOSTBYNAME)
-#define GET_HOST_BY_NAME(NAME, HP, ERR) \
-    { (HP) = gethostbyname (NAME); (ERR) = h_errno; }
-#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR) \
-    { (HP) = gethostbyaddr ((ADDR), (ADDRLEN), (FAMILY)); (ERR) = h_errno; }
+typedef struct hostent *GET_HOST_TMP;
+#define GET_HOST_BY_NAME(NAME, HP, ERR, TMP) \
+    { TMP = gethostbyname (NAME); (ERR) = h_errno; (HP) = TMP; }
+#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR, TMP) \
+    { TMP = gethostbyaddr ((ADDR), (ADDRLEN), (FAMILY)); (ERR) = h_errno; (HP) = TMP; }
 #else
 #ifdef _AIX /* XXX should have a feature test! */
-#define GET_HOST_BY_NAME(NAME, HP, ERR) \
-    {                                                                  \
-       struct hostent my_h_ent;                                        \
-       struct hostent_data my_h_ent_data;                              \
-       (HP) = (gethostbyname_r((NAME), &my_h_ent, &my_h_ent_data)      \
-               ? 0                                                     \
-               : &my_h_ent);                                           \
-       (ERR) = h_errno;                                                \
+typedef struct {
+    struct hostent ent;
+    struct hostent_data data;
+} GET_HOST_TMP;
+#define GET_HOST_BY_NAME(NAME, HP, ERR, TMP) \
+    {                                                          \
+       (HP) = (gethostbyname_r((NAME), &TMP.ent, &TMP.data)    \
+               ? 0                                             \
+               : &my_h_ent);                                   \
+       (ERR) = h_errno;                                        \
     }
 /*
 #define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR) \
@@ -191,47 +194,51 @@ extern /*@dependent@*/ char *gai_strerror (int code) /*@*/;
 */
 #else
 #ifdef GETHOSTBYNAME_R_RETURNS_INT
-#define GET_HOST_BY_NAME(NAME, HP, ERR) \
+typedef struct {
+    struct hostent ent;
+    char buf[8192];
+} GET_HOST_TMP;
+#define GET_HOST_BY_NAME(NAME, HP, ERR, TMP) \
     {                                                                  \
-       struct hostent my_h_ent, *my_hp;                                \
-       int my_h_err;                                                   \
-       char my_h_buf[8192];                                            \
-       (HP) = (gethostbyname_r((NAME), &my_h_ent,                      \
-                               my_h_buf, sizeof (my_h_buf), &my_hp,    \
-                               &my_h_err)                              \
+       struct hostent *my_hp = NULL;                                   \
+       int my_h_err, my_ret;                                           \
+       my_ret = gethostbyname_r((NAME), &TMP.ent,                      \
+                                TMP.buf, sizeof (TMP.buf), &my_hp,     \
+                                &my_h_err);                            \
+       (HP) = (((my_ret != 0) || (my_hp != &TMP.ent))                  \
                ? 0                                                     \
-               : &my_h_ent);                                           \
+               : &TMP.ent);                                            \
        (ERR) = my_h_err;                                               \
     }
-#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR) \
+#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR, TMP) \
     {                                                                  \
-       struct hostent my_h_ent, *my_hp;                                \
-       int my_h_err;                                                   \
-       char my_h_buf[8192];                                            \
-       (HP) = (gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &my_h_ent, \
-                               my_h_buf, sizeof (my_h_buf), &my_hp,    \
-                               &my_h_err)                              \
+       struct hostent *my_hp;                                          \
+       int my_h_err, my_ret;                                           \
+       my_ret = gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &TMP.ent, \
+                                TMP.buf, sizeof (TMP.buf), &my_hp,     \
+                                &my_h_err);                            \
+       (HP) = (((my_ret != 0) || (my_hp != &TMP.ent))                  \
                ? 0                                                     \
-               : &my_h_ent);                                           \
+               : &TMP.ent);                                            \
        (ERR) = my_h_err;                                               \
     }
 #else
-#define GET_HOST_BY_NAME(NAME, HP, ERR) \
+typedef struct {
+    struct hostent ent;
+    char buf[8192];
+} GET_HOST_TMP;
+#define GET_HOST_BY_NAME(NAME, HP, ERR, TMP) \
     {                                                                  \
-       struct hostent my_h_ent;                                        \
        int my_h_err;                                                   \
-       char my_h_buf[8192];                                            \
-       (HP) = gethostbyname_r((NAME), &my_h_ent,                       \
-                              my_h_buf, sizeof (my_h_buf), &my_h_err); \
+       (HP) = gethostbyname_r((NAME), &TMP.ent,                        \
+                              TMP.buf, sizeof (TMP.buf), &my_h_err);   \
        (ERR) = my_h_err;                                               \
     }
-#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR) \
+#define GET_HOST_BY_ADDR(ADDR, ADDRLEN, FAMILY, HP, ERR, TMP) \
     {                                                                  \
-       struct hostent my_h_ent;                                        \
        int my_h_err;                                                   \
-       char my_h_buf[8192];                                            \
-       (HP) = gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &my_h_ent,  \
-                              my_h_buf, sizeof (my_h_buf), &my_h_err); \
+       (HP) = gethostbyaddr_r((ADDR), (ADDRLEN), (FAMILY), &TMP.ent,   \
+                              TMP.buf, sizeof (TMP.buf), &my_h_err);   \
        (ERR) = my_h_err;                                               \
     }
 #endif /* returns int? */
@@ -240,53 +247,57 @@ extern /*@dependent@*/ char *gai_strerror (int code) /*@*/;
 
 /* Now do the same for getservby* functions.  */
 #ifndef HAVE_GETSERVBYNAME_R
-#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR) \
-    ((SP) = getservbyname (NAME, PROTO), (ERR) = (SP) ? 0 : -1)
-#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR) \
-    ((SP) = getservbyport (PORT, PROTO), (ERR) = (SP) ? 0 : -1)
+typedef struct servent *GET_SERV_TMP;
+#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR, TMP) \
+    (TMP = getservbyname (NAME, PROTO), (SP) = TMP, (ERR) = (SP) ? 0 : -1)
+#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR, TMP) \
+    (TMP = getservbyport (PORT, PROTO), (SP) = TMP, (ERR) = (SP) ? 0 : -1)
 #else
 #ifdef GETSERVBYNAME_R_RETURNS_INT
-#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR) \
+typedef struct {
+    struct servent ent;
+    char buf[8192];
+} GET_SERV_TMP;
+#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR, TMP) \
     {                                                                  \
-       struct servent my_s_ent, *my_sp;                                \
+       struct servent *my_sp;                                          \
        int my_s_err;                                                   \
-       char my_s_buf[8192];                                            \
-       (SP) = (getservbyname_r((NAME), (PROTO), &my_s_ent,             \
-                               my_s_buf, sizeof (my_s_buf), &my_sp,    \
+       (SP) = (getservbyname_r((NAME), (PROTO), &TMP.ent,              \
+                               TMP.buf, sizeof (TMP.buf), &my_sp,      \
                                &my_s_err)                              \
                ? 0                                                     \
-               : &my_s_ent);                                           \
+               : &TMP.ent);                                            \
        (ERR) = my_s_err;                                               \
     }
-#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR) \
+#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR, TMP) \
     {                                                                  \
-       struct servent my_s_ent, *my_sp;                                \
+       struct servent *my_sp;                                          \
        int my_s_err;                                                   \
-       char my_s_buf[8192];                                            \
-       (SP) = (getservbyport_r((PORT), (PROTO), &my_s_ent,             \
-                               my_s_buf, sizeof (my_s_buf), &my_sp,    \
+       (SP) = (getservbyport_r((PORT), (PROTO), &TMP.ent,              \
+                               TMP.buf, sizeof (TMP.buf), &my_sp,      \
                                &my_s_err)                              \
                ? 0                                                     \
-               : &my_s_ent);                                           \
+               : &TMP.ent);                                            \
        (ERR) = my_s_err;                                               \
     }
 #else
 /* returns ptr -- IRIX? */
-#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR) \
+typedef struct {
+    struct servent ent;
+    char buf[8192];
+} GET_SERV_TMP;
+#define GET_SERV_BY_NAME(NAME, PROTO, SP, ERR, TMP) \
     {                                                                  \
-       struct servent my_s_ent;                                        \
-       char my_s_buf[8192];                                            \
-       (SP) = getservbyname_r((NAME), (PROTO), &my_s_ent,              \
-                              my_s_buf, sizeof (my_s_buf));            \
+       (SP) = getservbyname_r((NAME), (PROTO), &TMP.ent,               \
+                              TMP.buf, sizeof (TMP.buf));              \
        (ERR) = (SP) == NULL;                                           \
     }
 
-#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR) \
+#define GET_SERV_BY_PORT(PORT, PROTO, SP, ERR, TMP) \
     {                                                                  \
-       struct servent my_s_ent, *my_sp;                                \
-       char my_s_buf[8192];                                            \
-       my_sp = getservbyport_r((PORT), (PROTO), &my_s_ent,             \
-                               my_s_buf, sizeof (my_s_buf));           \
+       struct servent *my_sp;                                          \
+       my_sp = getservbyport_r((PORT), (PROTO), &TMP.ent,              \
+                               TMP.buf, sizeof (TMP.buf));             \
        (SP) = my_sp;                                                   \
        (ERR) = my_sp == 0;                                             \
        (ERR) = (ERR);  /* avoid "unused" warning */                    \
@@ -774,8 +785,9 @@ static inline int fai_add_hosts_by_name (const char *name,
     struct hostent *hp;
     int i, r;
     int herr;
+    GET_HOST_TMP htmp;
 
-    GET_HOST_BY_NAME (name, hp, herr);
+    GET_HOST_BY_NAME (name, hp, herr, htmp);
     if (hp == 0)
        return translate_h_errno (herr);
     for (i = 0; hp->h_addr_list[i]; i++) {
@@ -840,6 +852,7 @@ fake_getaddrinfo (const char *name, const char *serv,
        } else {
            struct servent *sp;
            int try_dgram_too = 0, s_err;
+           GET_SERV_TMP stmp;
 
            if (socktype == 0) {
                try_dgram_too = 1;
@@ -847,7 +860,7 @@ fake_getaddrinfo (const char *name, const char *serv,
            }
        try_service_lookup:
            GET_SERV_BY_NAME(serv, socktype == SOCK_STREAM ? "tcp" : "udp",
-                            sp, s_err);
+                            sp, s_err, stmp);
            if (sp == 0) {
                if (try_dgram_too) {
                    socktype = SOCK_DGRAM;
@@ -952,9 +965,11 @@ fake_getnameinfo (const struct sockaddr *sa, socklen_t len,
 #endif
        } else {
            int herr;
+           GET_HOST_TMP htmp;
+
            GET_HOST_BY_ADDR((const char *) &sinp->sin_addr,
                             sizeof (struct in_addr),
-                            sa->sa_family, hp, herr);
+                            sa->sa_family, hp, herr, htmp);
            if (hp == 0) {
                if (herr == NO_ADDRESS && !(flags & NI_NAMEREQD)) /* ??? */
                    goto numeric_host;
@@ -980,9 +995,11 @@ fake_getnameinfo (const struct sockaddr *sa, socklen_t len,
            strncpy (service, numbuf, slen);
        } else {
            int serr;
+           GET_SERV_TMP stmp;
+
            GET_SERV_BY_PORT(sinp->sin_port,
                             (flags & NI_DGRAM) ? "udp" : "tcp",
-                            sp, serr);
+                            sp, serr, stmp);
            if (sp == 0)
                goto numeric_service;
            strncpy (service, sp->s_name, slen);
@@ -1185,13 +1202,14 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint,
        struct hostent *hp;
        const char *name2 = 0;
        int i, herr;
+       GET_HOST_TMP htmp;
 
        /*
         * Current versions of GET_HOST_BY_NAME will fail if the
         * target hostname has IPv6 addresses only.  Make sure it
         * fails fairly cleanly.
         */
-       GET_HOST_BY_NAME (name, hp, herr);
+       GET_HOST_BY_NAME (name, hp, herr, htmp);
        if (hp == 0) {
            /*
             * This case probably means it's an IPv6-only name.  If
index 9d025942ecd9907737259ac8d7623219a058ac31..bccb522508718a76329bf84d70775799c0594358 100644 (file)
@@ -95,9 +95,14 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
 #if USE_DLOPEN
     if (!err && (statbuf.st_mode & S_IFMT) == S_IFREG) {
         void *handle = NULL;
+#ifdef RTLD_GROUP
+#define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | RTLD_GROUP)
+#else
+#define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL)
+#endif
 
         if (!err) {
-            handle = dlopen(filepath, RTLD_NOW | RTLD_GLOBAL);
+            handle = dlopen(filepath, PLUGIN_DLOPEN_FLAGS);
             if (handle == NULL) {
                 const char *e = dlerror();
                 Tprintf ("dlopen(%s): %s\n", filepath, e);
@@ -495,11 +500,11 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
             }
             
             if (dir != NULL) { closedir (dir); }
-        }
 #else
-       /* Until a Windows implementation of this code is implemented */
-       err = ENOENT;
+           /* Until a Windows implementation of this code is implemented */
+           err = ENOENT;
 #endif /* _WIN32 */
+        }
     }
         
     if (err == ENOENT) {
index 008510fba06e4d1c75e53df6f7a9fa007c33742d..72456acd3ab5464729d987891de355464be9e8bf 100644 (file)
@@ -120,15 +120,41 @@ Date=(TBD)
 # Flag for error events to signal that the error event has been committed.\r
 \r
 +khui_action_trigger()\r
+# Function for triggerring an action.\r
 \r
 +khui_action_set_hwnd()\r
+# internal API.  Should not be used by anyone.  Basically sets the HWND that should receive event notifications from the UI library.\r
 \r
 +KEPT_PTR\r
+# error library data type for pointers\r
 \r
 +_cptr\r
+# type cast macro for pointer types\r
 \r
 !khc_open_space\r
 # name parameter is now a const string\r
 \r
 !KCDB_ATTRNAME_ISSUE\r
-# Fixed typo
\ No newline at end of file
+# Fixed typo\r
+\r
+!kherr_val\r
+# is now an inline function instead of a macro\r
+\r
+!kherr_param\r
+# is now a structure instead of an integer type\r
+\r
++KEPT_NONE\r
+# new constant signifying a NULL parameter\r
+\r
+!_int32, _uint32, _int64, _uint64, _cstr, _tstr, _cptr\r
+# appropriate typecasts added\r
+\r
++vnull\r
+# macro to insert a NULL parameter\r
+\r
+!_report_cs0, _report_cs1, _report_cs2, _report_cs3\r
+!_report_sr0, _report_sr1, _report_sr2, _report_sr3\r
+!_report_mr0, _report_mr1, _report_mr2, _report_mr3\r
+!_report_ts0, _report_ts1, _report_ts2, _report_ts3\r
+# modified to use _vnull() instead of 0 for NULL parameters\r
+\r
index 81c33546aebde4275a8bd24a84c850d56a58e3e8..4ea6b8856e44932d6d844d9604683b3bc2ed1c2a 100644 (file)
@@ -211,11 +211,20 @@ khcwarn=$(khcwarn) /WX
 ldebug=$(ldebug) /DEBUG\r
 cdebug=$(cdebug) -Os -Zi\r
 \r
+# Additionally, suppress conflicting default library directives that we\r
+# might pull in from external libraries.\r
+\r
+!ifndef NODEBUG\r
+lndeflibflag=/NODEFAULTLIB:MSVCRT\r
+!else\r
+lndeflibflag=/NODEFAULTLIB:MSVCRTD\r
+!endif\r
+\r
 khcflags=$(cdebug) $(cflags) $(incflags) $(khdefines) $(khcwarn)\r
-khlguiflags=$(ldebug) $(guilflags)\r
-khlconflags=$(ldebug) $(conlflags)\r
-khldllguiflags=$(ldebug) $(dlllflags)\r
-khldllconflags=$(ldebug) $(dlllflags)\r
+khlguiflags=$(ldebug) $(guilflags) $(lndeflibflag)\r
+khlconflags=$(ldebug) $(conlflags) $(lndeflibflag)\r
+khldllguiflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
+khldllconflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
 \r
 !if "$(KH_RUNTIME)" == "STATIC"\r
 khcflags=$(khcflags) $(cvarsmt)\r
index ed966d7b51280abc42e543e131f0cb4ad289deec..503e44dc1dbe680ca9e73fd97264b7a1b6fdaeb1 100644 (file)
@@ -224,11 +224,20 @@ khcwarn=$(khcwarn) /WX
 ldebug=$(ldebug) /DEBUG\r
 cdebug=$(cdebug) -Os -Zi\r
 \r
+# Additionally, suppress conflicting default library directives that we\r
+# might pull in from external libraries.\r
+\r
+!ifndef NODEBUG\r
+lndeflibflag=/NODEFAULTLIB:MSVCRT\r
+!else\r
+lndeflibflag=/NODEFAULTLIB:MSVCRTD\r
+!endif\r
+\r
 khcflags=$(cdebug) $(cflags) $(incflags) $(khdefines) $(khcwarn)\r
-khlguiflags=$(ldebug) $(guilflags)\r
-khlconflags=$(ldebug) $(conlflags)\r
-khldllguiflags=$(ldebug) $(dlllflags)\r
-khldllconflags=$(ldebug) $(dlllflags)\r
+khlguiflags=$(ldebug) $(guilflags) $(lndeflibflag)\r
+khlconflags=$(ldebug) $(conlflags) $(lndeflibflag)\r
+khldllguiflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
+khldllconflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
 \r
 !if "$(KH_RUNTIME)" == "STATIC"\r
 khcflags=$(khcflags) $(cvarsmt)\r
@@ -294,4 +303,28 @@ etag::
 \r
 .SUFFIXES: .h\r
 \r
+#\r
+# Manifest handling\r
+#\r
+# Starting with Visual Studio 8, the C compiler and the linker\r
+# generate manifests so that the applications will link with the\r
+# correct side-by-side DLLs at run-time.  These are required for\r
+# correct operation under Windows XP.  We also have custom manifests\r
+# which need to be merged with the manifests that VS creates.\r
+#\r
+# The syntax for invoking the _VC_MANIFEST_EMBED_foo macro is:\r
+# $(_VC_MANIFEST_EMBED_???) <any additional manifests that need to be merged in>\r
+#\r
+\r
+!ifndef MT\r
+MT=mt.exe -nologo\r
+!endif\r
+\r
+_VC_MANIFEST_EMBED_EXE= \\r
+if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest\r
+\r
+_VC_MANIFEST_EMBED_DLL=$(_VC_MANIFEST_EMBED_EXE)\r
+\r
+# End of manifest handling\r
+\r
 !endif\r
index b590e056bbf8d0b7a6dbe863663f9eb7e75ed667..686a9717f697c9416273bfa2236938f6e885da77 100644 (file)
     This message notifies credentials providers that a password change\r
     request has been received.\r
 \r
+    A plug-in handling this message that wishes to participate in the\r
+    password change operation is expected to add a\r
+    ::khui_new_creds_by_type to the list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
+\r
+    The password change operation requires user interaction.  Any\r
+    plug-ins that are participating in the operation need to provide a\r
+    user-interface.\r
+\r
     Message parameters:\r
     - \b vparam : pointer to a ::khui_new_creds structure\r
+\r
+    \see khui_cw_add_type(), ::khui_new_creds, ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_PASSWORD  16\r
 \r
 /*! \brief Initiate the process of obtaining new credentials\r
 \r
     The UI sends this message to start the process of obtaining new\r
-    credentials.  See \ref cred_acq for more information about handling this\r
-    message.\r
+    credentials.  See \ref cred_acq for more information about\r
+    handling this message.\r
+\r
+    A plug-in handling this message that wishes to participate in the\r
+    new credentials acquisition operation is expected to add a\r
+    ::khui_new_creds_by_type to hte list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
 \r
     Message parameters:\r
     - \b vparam : pointer to a ::khui_new_creds structure\r
 \r
-    \see \ref cred_acq\r
+    \see \ref cred_acq, khui_cw_add_type(), ::khui_new_creds,\r
+    ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_NEW_CREDS 17\r
 \r
     This is a notification sent to individual credentials providers\r
     that a specified identity's credentials should be renewed.\r
 \r
+    A plug-in handling this message that wishes to participate in the\r
+    renew credentials operation is expected to add a\r
+    ::khui_new_creds_by_type to the list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
+\r
     Message parameters:\r
     - \b vparam : Pointer to a khui_new_creds object\r
+\r
+    \see khui_cw_add_type(), ::khui_new_creds,\r
+    ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_RENEW_CREDS       18\r
 \r
     dialog completion.\r
 \r
     Currently, the dialog messages are:\r
-    - ::KMSG_CRED_INITIAL_CREDS\r
     - ::KMSG_CRED_NEW_CREDS\r
     - ::KMSG_CRED_RENEW_CREDS\r
     - ::KMSG_CRED_DIALOG_SETUP\r
index 83aa0657cd2efb71bf79ab7a6e93b4e76e9aedcb..ef182fe32c6514dd40df79843ef22052ec1638a9 100644 (file)
@@ -677,6 +677,7 @@ khcint_open_space(kconf_conf_space * parent,
     HKEY pkey = NULL;\r
     HKEY ckey = NULL;\r
     wchar_t buf[KCONF_MAXCCH_NAME];\r
+    size_t cb_regpath = 0;\r
 \r
     if(!parent)\r
         p = conf_root;\r
@@ -686,10 +687,7 @@ khcint_open_space(kconf_conf_space * parent,
     if(n_sname >= KCONF_MAXCCH_NAME || n_sname <= 0)\r
         return KHM_ERROR_INVALID_PARAM;\r
 \r
-    /* SAFE: buf: buffer size == KCONF_MAXCCH_NAME * wchar_t >\r
-       n_sname * wchar_t */\r
-    wcsncpy(buf, sname, n_sname);\r
-    buf[n_sname] = L'\0';\r
+    StringCchCopyN(buf, ARRAYLENGTH(buf), sname, n_sname);\r
 \r
     /* see if there is already a config space by this name. if so,\r
        return it.  Note that if the configuration space is specified\r
@@ -760,19 +758,18 @@ khcint_open_space(kconf_conf_space * parent,
     /*SAFE: p->regpath: is valid since it was set using this same\r
       function. */\r
     /*SAFE: buf: see above */\r
-    c->regpath = PMALLOC((wcslen(p->regpath) + wcslen(buf) + 2) * sizeof(wchar_t));\r
+    cb_regpath = (wcslen(p->regpath) + wcslen(buf) + 2) * sizeof(wchar_t);\r
+    c->regpath = PMALLOC(cb_regpath);\r
 \r
     assert(c->regpath != NULL);\r
 \r
-#pragma warning( push )\r
-#pragma warning( disable: 4995 )\r
     /*SAFE: c->regpath: allocated above to be big enough */\r
     /*SAFE: p->regpath: see above */\r
-    wcscpy(c->regpath, p->regpath);\r
-    wcscat(c->regpath, L"\\");\r
+    StringCbCopy(c->regpath, cb_regpath, p->regpath);\r
+    StringCbCat(c->regpath, cb_regpath, L"\\");\r
+\r
     /*SAFE: buf: see above */\r
-    wcscat(c->regpath, buf);\r
-#pragma warning( pop )\r
+    StringCbCat(c->regpath, cb_regpath, buf);\r
 \r
     khcint_space_hold(c);\r
 \r
index 6886cc5b6c0516b9e2d2df5fb43cbf881b7cfc8c..98854dab46dfe7b9dad9ba4058ad864a01bae792 100644 (file)
@@ -943,12 +943,18 @@ kcdb_creds_is_equal(khm_handle vcred1,
 \r
     kcdb_cred_lock_read();\r
     if(!kcdb_cred_is_active_cred(vcred1) ||\r
-       !kcdb_cred_is_active_cred(vcred2))\r
+       !kcdb_cred_is_active_cred(vcred2)) {\r
+\r
+        code = FALSE;\r
         goto _exit;\r
 \r
+    }\r
+\r
     if(vcred1 == vcred2) {\r
+\r
         code = TRUE;\r
         goto _exit;\r
+\r
     }\r
 \r
     cred1 = vcred1;\r
index e57b22b5309ebfde62d7e1edea2c479c195317e1..89e0175f008593f9d3f761214c362b9fe0778261 100644 (file)
@@ -281,11 +281,7 @@ KHMEXP khm_int32 KHMAPI kcdb_credtype_describe(
             *cbbuf = s;\r
             rv = KHM_ERROR_TOO_LONG;\r
         } else {\r
-#pragma warning(push)\r
-#pragma warning(disable:4995)\r
-            wcscpy(buf, str); /* str is one of the string fields in t->ct which has \r
-                              been validated when the type was registered. */\r
-#pragma warning(pop)\r
+            StringCbCopy(buf, *cbbuf, str);\r
             *cbbuf = s;\r
         }\r
     } else {\r
@@ -321,10 +317,7 @@ KHMEXP khm_int32 KHMAPI kcdb_credtype_get_name(
             *cbbuf = s;\r
             rv = KHM_ERROR_TOO_LONG;\r
         } else {\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
-            wcscpy(buf, t->ct.name); /* t->ct.name was validated when the type was registered */\r
-#pragma warning(pop)\r
+            StringCbCopy(buf, *cbbuf, t->ct.name);\r
             *cbbuf = s;\r
         }\r
     } else {\r
index baf5f9730dc9f7a85cc464d5f6cf78df5d4a5246..c1215f583425b506e50cff5a5e5339573f6cee99 100644 (file)
@@ -391,9 +391,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(h == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1H, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1H, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_H, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_H, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, h);\r
             }\r
         }\r
@@ -415,9 +417,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(m == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1M, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1M, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_M, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_M, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, m);\r
             }\r
         }\r
@@ -434,9 +438,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(s == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1S, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1S, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_S, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_S, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, s);\r
             }\r
         }\r
index d3f50021c6b5de1ee89f9a9008e86a8cd5200d07..701a79d7de06699a2832f9fabec12690b8e92f75 100644 (file)
@@ -113,8 +113,10 @@ SCLIB=
 
 $(DLLFILE): $(OBJFILES) $(RESFILES)
        $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 all: mkdirs $(DLLFILE)
 
 clean::
        $(RM) $(DLLFILE)
+       $(RM) $(DLLFILE).manifest
index de1cea4abf9c8faa41465c7bda0669545ed44b26..5ba59df4e7d3dffac935380c700ff81ccac80e03 100644 (file)
@@ -31,6 +31,7 @@
 #ifdef DEBUG\r
 #include<assert.h>\r
 #endif\r
+#include<strsafe.h>\r
 \r
 /**************************************/\r
 /* khm_krb5_error():           */\r
index bd6337192a77481b03955cf9660b0a50541a81e4..df3db93ae14f5a67fd3915188bbbd0f8a9ccf171 100644 (file)
 \r
 #ifndef NO_KRB5\r
 int khm_krb5_error(krb5_error_code rc, LPCSTR FailedFunctionName, \r
-                     int FreeContextFlag, krb5_context *ctx,\r
-                     krb5_ccache *cache);\r
+                   int FreeContextFlag, krb5_context *ctx,\r
+                   krb5_ccache *cache);\r
 \r
+int\r
+khm_krb5_get_error_string(krb5_error_code rc,\r
+                          wchar_t * buffer,\r
+                          khm_size cb_buffer);\r
 \r
 int khm_krb5_initialize(khm_handle ident, krb5_context *, krb5_ccache *);\r
 \r
index b1ad963f080ab0448f61f9bd75414ca45c11fb31..c5226aaaa07d33000a1f02d692746adccfbd708a 100644 (file)
@@ -70,6 +70,7 @@ $(OBJ)\krb4config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg
 
 $(DLLFILE): $(OBJFILES) $(VERRESFILE) $(MSGRESFILE)
        $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 all: mkdirs $(MSGRESFILE) $(DLLFILE) lang
 
index 5adc66b9143ebd50ff8b66d20d5a800d07c324ca..f1aa63d88b87806c173e4b97e7966524e02f94c7 100644 (file)
@@ -27,6 +27,8 @@
 #include<krbcred.h>\r
 #include<kherror.h>\r
 \r
+#include<strsafe.h>\r
+\r
 extern void (__cdecl *pinitialize_krb_error_func)();\r
 extern void (__cdecl *pinitialize_kadm_error_table)();\r
 \r
@@ -89,8 +91,7 @@ LPSTR err_describe(LPSTR buf, size_t len, long code)
     case kadm_err_base:\r
        break;\r
     default:\r
-       strncpy(buf, com_err_msg, len);\r
-       buf[len-1] = '\0';\r
+        StringCbCopyA(buf, len, com_err_msg);\r
        return buf;\r
     }\r
 \r
@@ -194,8 +195,7 @@ LPSTR err_describe(LPSTR buf, size_t len, long code)
             break;\r
         }\r
     if(com_err_msg != buf) {\r
-        strncpy(buf, com_err_msg, len);\r
-       buf[len-1] = '\0';\r
+        StringCbCopyA(buf, len, com_err_msg);\r
     }\r
     cp = buf + strlen(buf);\r
     *cp++ = '\n';\r
index 8928f71fdea924a4019bee9603a258aca0d3b857..18c05981fc499800600663954f12e8eb3bd4059d 100644 (file)
@@ -243,10 +243,10 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-               strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-               strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
+\r
         return FALSE;\r
     }\r
     \r
@@ -254,7 +254,7 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     \r
     if (configFile)\r
     {\r
-        strncpy(confname, *configFile, szConfname);\r
+        StringCchCopyA(confname, szConfname, *configFile);\r
         pkrb5_free_config_files(configFile); \r
     }\r
     \r
@@ -262,10 +262,9 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-               strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-               strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
     }\r
     \r
     return FALSE;\r
@@ -274,51 +273,41 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
 BOOL\r
 khm_get_krb4_con_file(LPSTR confname, UINT szConfname)\r
 {\r
-    if (hKrb5 && !hKrb4)\r
-       { // hold krb.con where krb5.ini is located\r
-            CHAR krbConFile[MAX_PATH]="";\r
-            LPSTR pFind;\r
+    if (hKrb5 && !hKrb4) {\r
+        // hold krb.con where krb5.ini is located\r
+        CHAR krbConFile[MAX_PATH]="";\r
+        LPSTR pFind;\r
 \r
-           //strcpy(krbConFile, CLeashApp::m_krbv5_profile->first_file->filename);\r
-            if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile)))     \r
-                {\r
-                   GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, KRB5_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                }\r
+        if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile))) {\r
+            GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
+            krbConFile[MAX_PATH-1] = '\0';\r
 \r
-            pFind = strrchr(krbConFile, '\\');\r
-            if (pFind)\r
-               {\r
-                    *pFind = 0;\r
-                    strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, KRB_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-               }\r
-            else\r
-                krbConFile[0] = 0;\r
-            \r
-            strncpy(confname, krbConFile, szConfname);\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), "\\");\r
+        }\r
+\r
+        pFind = strrchr(krbConFile, '\\');\r
+\r
+        if (pFind) {\r
+            *pFind = '\0';\r
+\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), "\\");\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), KRB_FILE);\r
+        } else {\r
+            krbConFile[0] = '\0';\r
+        }\r
+\r
+        StringCchCopyA(confname, szConfname, krbConFile);\r
+    } else if (hKrb4) { \r
+        unsigned int size = szConfname;\r
+        memset(confname, '\0', szConfname);\r
+        if (!pkrb_get_krbconf2(confname, &size)) {\r
+            GetWindowsDirectoryA(confname,szConfname);\r
             confname[szConfname-1] = '\0';\r
-       }\r
-    else if (hKrb4)\r
-       { \r
-            unsigned int size = szConfname;\r
-            memset(confname, '\0', szConfname);\r
-            if (!pkrb_get_krbconf2(confname, &size))\r
-               { // Error has happened\r
-                   GetWindowsDirectoryA(confname,szConfname);\r
-                    confname[szConfname-1] = '\0';\r
-                    strncat(confname, "\\",szConfname-strlen(confname));\r
-                    confname[szConfname-1] = '\0';\r
-                    strncat(confname,KRB_FILE,szConfname-strlen(confname));\r
-                    confname[szConfname-1] = '\0';\r
-               }\r
-       }\r
+            StringCchCatA(confname, szConfname, "\\");\r
+            StringCchCatA(confname, szConfname, KRB_FILE);\r
+        }\r
+    }\r
+\r
     return FALSE;\r
 }\r
 \r
@@ -433,7 +422,12 @@ wchar_t * khm_krb5_get_realm_list(void)
         wchar_t * d;\r
 \r
         if (!khm_get_krb4_con_file(krb_conf,sizeof(krb_conf)) && \r
-            (file = fopen(krb_conf, "rt")))\r
+#if _MSC_VER >= 1400\r
+            !fopen_s(&file, krb_conf, "rt")\r
+#else\r
+           (file = fopen(krb_conf, "rt"))\r
+#endif\r
+            )\r
         {\r
             char lineBuf[256];\r
 \r
@@ -519,25 +513,32 @@ make_postfix(const char * base,
              const char * postfix,\r
              char ** rcopy)\r
 {\r
-    int base_size;\r
-    int ret_size;\r
+    size_t base_size;\r
+    size_t ret_size;\r
     char * copy = 0;\r
     char * ret = 0;\r
+    size_t t;\r
+\r
+    if (FAILED(StringCbLengthA(base, STRSAFE_MAX_CCH * sizeof(char), &t)))\r
+        goto cleanup;\r
+\r
+    base_size = t + 1;\r
+\r
+    if (FAILED(StringCbLengthA(postfix, STRSAFE_MAX_CCH * sizeof(char), &t)))\r
+        goto cleanup;\r
+\r
+    ret_size = base_size + t + 1;\r
 \r
-    base_size = (int) strlen(base) + 1;\r
-    ret_size = base_size + (int) strlen(postfix) + 1;\r
     copy = malloc(base_size);\r
     ret = malloc(ret_size);\r
 \r
     if (!copy || !ret)\r
         goto cleanup;\r
 \r
-    strncpy(copy, base, base_size);\r
-    copy[base_size - 1] = 0;\r
-\r
-    strncpy(ret, base, base_size);\r
-    strncpy(ret + (base_size - 1), postfix, ret_size - (base_size - 1));\r
-    ret[ret_size - 1] = 0;\r
+    StringCbCopyNA(copy, base_size, base, base_size);\r
+    StringCbCopyNA(ret, ret_size, base, base_size);\r
+    StringCbCopyNA(ret + (base_size - 1), ret_size - (base_size - 1),\r
+                   postfix, ret_size - (base_size - 1));\r
 \r
  cleanup:\r
     if (!copy || !ret) {\r
index b3dd7cea76c087e8faea41eac88f00dc00c8ec2b..407c30fedf914ee30a1cd5a76f92859c978b4959 100644 (file)
@@ -115,10 +115,15 @@ void k4_update_data(k4_dlg_data * d) {
 \r
 khm_boolean k4_should_identity_get_k4(khm_handle ident) {\r
     khm_int32 idflags = 0;\r
+    khm_int32 t = TRUE;\r
     khm_handle csp_ident = NULL;\r
     khm_handle csp_k4 = NULL;\r
     khm_boolean get_k4 = TRUE;\r
 \r
+    if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) &&\r
+        !t)\r
+        return FALSE;\r
+\r
     if (KHM_FAILED(kcdb_identity_get_flags(ident, &idflags)))\r
         return FALSE;\r
 \r
@@ -325,8 +330,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d,
 \r
             l = (khui_htwnd_link *) lParam;\r
 \r
-            wcsncpy(wid, l->id, l->id_len);\r
-            wid[l->id_len] = 0;\r
+            StringCchCopyN(wid, ARRAYLENGTH(wid), l->id, l->id_len);\r
             wids = wcschr(wid, L':');\r
 \r
             if (!wids)\r
index 67475ee010f6837626b1c280825032e47b66c57d..cfee907b2ad13d33ebe50e68ee61424ae44d5951 100644 (file)
@@ -74,6 +74,7 @@ $(OBJ)\krb5config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg
 
 $(DLLFILE):  $(OBJFILES) $(VERRESFILE) 
        $(DLLGUILINK) $(MSGRESFILE) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 $(MSGRESFILE): $(OBJ)\krb5_msgs.rc
 
index 97d629eb4ce9f7409857b97269bc9b81a1eef138..92eabf4daa287bd3718492ba871fefb8cc9bef38 100644 (file)
@@ -274,6 +274,36 @@ krb5flags_toString(const void *d,
     }\r
 }\r
 \r
+khm_int32 KHMAPI\r
+kvno_toString(const void * data, khm_size cbdata,\r
+              wchar_t *destbuf, khm_size *pcbdestbuf,\r
+              khm_int32 flags)\r
+{\r
+    int resid = 0;\r
+    int kvno;\r
+    wchar_t buf[256];\r
+    size_t cblength;\r
+\r
+    if (cbdata != sizeof(khm_int32))\r
+        return KHM_ERROR_INVALID_PARAM;\r
+\r
+    kvno = *((khm_int32 *) data);\r
+\r
+    StringCbPrintf(buf, sizeof(buf), L"#%d", kvno);\r
+\r
+    StringCbLength(buf, ARRAYLENGTH(buf), &cblength);\r
+    cblength += sizeof(wchar_t);\r
+\r
+    if (!destbuf || *pcbdestbuf < cblength) {\r
+        *pcbdestbuf = cblength;\r
+        return KHM_ERROR_TOO_LONG;\r
+    } else {\r
+        StringCbCopy(destbuf, *pcbdestbuf, buf);\r
+        *pcbdestbuf = cblength;\r
+        return KHM_ERROR_SUCCESS;\r
+    }\r
+}\r
+\r
 khm_int32\r
 serialize_krb5_addresses(krb5_address ** a, void * buf, size_t * pcbbuf)\r
 {\r
index eeb6970dade9f9e752e06790462f3551030f8321..90f1923fa00c6fd649b02839ba29957a74a506aa 100644 (file)
@@ -59,6 +59,11 @@ khm_int32 KHMAPI
 krb5flags_toString(const void *, khm_size, wchar_t *,\r
                    khm_size *, khm_int32);\r
 \r
+khm_int32 KHMAPI\r
+kvno_toString(const void * data, khm_size cbdata,\r
+              wchar_t *destbuf, khm_size *pcbdestbuf,\r
+              khm_int32 flags);\r
+\r
 khm_int32 KHMAPI\r
 renew_for_cb(khm_handle cred, khm_int32 id, void * buffer,\r
              khm_size * pcbsize);\r
index 66e7a08d00c7418a313ef56bb795458eddf3d4c3..425d13430f8b6782dcaf07d4935b3031c30b63e0 100644 (file)
 #define _WIN32_WINNT 0x501\r
 #endif\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
 #include<lm.h>\r
 #include<commctrl.h>\r
-\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
 #include<shlwapi.h>\r
-#pragma warning(pop)\r
+\r
+#include<strsafe.h>\r
 \r
 typedef struct tag_k5_file_cc {\r
     wchar_t path[MAX_PATH];\r
@@ -97,7 +97,7 @@ void k5_add_file_cc(k5_ccc_data * d, wchar_t * path) {
 \r
     /* see if it's there first */\r
     for (i=0; i < d->n_file_ccs; i++) {\r
-        if(!wcsicmp(d->file_ccs[i].path, path))\r
+        if(!_wcsicmp(d->file_ccs[i].path, path))\r
             return;\r
     }\r
 \r
@@ -232,7 +232,7 @@ BOOL k5_ccc_get_mod(k5_ccc_dlg_data * d) {
 \r
     for (i=0; i < d->work.n_file_ccs; i++) {\r
         for (j=0; j < d->save.n_file_ccs; j++) {\r
-            if (!wcsicmp(d->work.file_ccs[i].path,\r
+            if (!_wcsicmp(d->work.file_ccs[i].path,\r
                          d->save.file_ccs[j].path))\r
                 break;\r
         }\r
@@ -372,7 +372,7 @@ k5_ccconfig_dlgproc(HWND hwnd,
                     return TRUE; /* nothing to add */\r
 \r
                 for (i=0; i < d->work.n_file_ccs; i++) {\r
-                    if (!wcsicmp(path, d->work.file_ccs[i].path)) {\r
+                    if (!_wcsicmp(path, d->work.file_ccs[i].path)) {\r
 \r
                         /* allow the user to correct case, as appropriate */\r
                         StringCbCopy(d->work.file_ccs[i].path,\r
@@ -522,7 +522,7 @@ k5_ccconfig_dlgproc(HWND hwnd,
                                                      LVNI_SELECTED)) != -1) {\r
                     ListView_GetItemText(lv, lv_idx, 0, buf, ARRAYLENGTH(buf));\r
                     for (i=0; i < d->work.n_file_ccs; i++) {\r
-                        if (!wcsicmp(buf, d->work.file_ccs[i].path)) {\r
+                        if (!_wcsicmp(buf, d->work.file_ccs[i].path)) {\r
                             k5_del_file_cc(&d->work, i);\r
                             break;\r
                         }\r
index ad64d488338a3f6c16e5dd22d9ca9eba76857c49..65f010840e997598670f49c48aa166c2fc8a3eaa 100644 (file)
 
 /* $Id$ */
 
+#define STRSAFE_NO_DEPRECATE
+
 #include<krbcred.h>
 #include<krb5.h>
 #include<assert.h>
 #include<lm.h>
 #include<commctrl.h>
-
-#pragma warning(push)
-#pragma warning(disable: 4995)
 #include<shlwapi.h>
-#pragma warning(pop)
 
+#include<strsafe.h>
 
 typedef struct tag_k5_realm_kdc {
     wchar_t       name[K5_MAXCCH_HOST];
@@ -134,12 +133,12 @@ k5_parse_boolean(const char *s)
     const char *const *p;
 
     for(p=conf_yes; *p; p++) {
-        if (!stricmp(*p,s))
+        if (!_stricmp(*p,s))
             return 1;
     }
 
     for(p=conf_no; *p; p++) {
-        if (!stricmp(*p,s))
+        if (!_stricmp(*p,s))
             return 0;
     }
 
@@ -409,7 +408,7 @@ k5_read_config_data(k5_config_data * d) {
                                      sizeof(kdc_name), values[i]);
 
                     for (j=0; j < d->realms[s].n_kdcs; j++)
-                        if (!wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
+                        if (!_wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
                             break;
 
                     if (j < d->realms[s].n_kdcs) {
@@ -436,7 +435,7 @@ k5_read_config_data(k5_config_data * d) {
                     AnsiStrToUnicode(kdc_name, sizeof(kdc_name), values[i]);
 
                     for (j=0; j < d->realms[s].n_kdcs; j++)
-                        if (!wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
+                        if (!_wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
                             break;
 
                     if (j < d->realms[s].n_kdcs) {
@@ -478,7 +477,7 @@ k5_read_config_data(k5_config_data * d) {
                 AnsiStrToUnicode(wdr_to, sizeof(wdr_to), dr_to);
 
                 for (j=0; j < d->n_realms; j++) {
-                    if (!wcsicmp(wdr_to, d->realms[j].realm))
+                    if (!_wcsicmp(wdr_to, d->realms[j].realm))
                         break;
                 }
 
@@ -588,7 +587,7 @@ k5_write_config_data(k5_config_data * d) {
 
     UnicodeStrToAnsi(astr, sizeof(astr), d->config_file);
 
-    if (stricmp(config_file, astr)) {
+    if (_stricmp(config_file, astr)) {
         assert(FALSE);
     }
 
@@ -1965,7 +1964,7 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[i].flags & K5_RDFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[i].realm, pdisp->item.pszText))
+                                if (!_wcsicmp(d->realms[i].realm, pdisp->item.pszText))
                                     break;
                             }
 
@@ -2084,7 +2083,7 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[r].kdcs[k].flags & K5_RKFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[r].kdcs[k].name,
+                                if (!_wcsicmp(d->realms[r].kdcs[k].name,
                                              pdisp->item.pszText))
                                     break;
                             }
@@ -2283,8 +2282,8 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[r].domain_maps[m].flags & K5_DMFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[r].domain_maps[m].name,
-                                             pdisp->item.pszText))
+                                if (!_wcsicmp(d->realms[r].domain_maps[m].name,
+                                              pdisp->item.pszText))
                                     break;
                             }
 
index ccc38941a6b77ef9a08f70b79440d9a1cb701203..ebec91e997d3bd8f0949f285f6978cd82eb8d8a0 100644 (file)
 \r
 /* $Id$ */\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
 #include<lm.h>\r
 #include<commctrl.h>\r
-\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
 #include<shlwapi.h>\r
-#pragma warning(pop)\r
+\r
+#include<strsafe.h>\r
 \r
 typedef struct tag_k5_id_dlg_data {\r
     khui_config_init_data cfg;\r
@@ -164,7 +164,7 @@ k5_id_is_mod(HWND hw, k5_id_dlg_data * d) {
     SendDlgItemMessage(hw, IDC_CFG_PUBLICIP, IPM_GETADDRESS,\r
                        0, (LPARAM) &dwaddress);\r
 \r
-    if (wcsicmp(ccache, d->ccache) ||\r
+    if (_wcsicmp(ccache, d->ccache) ||\r
 \r
         d->tc_renew.current != d->renew_life ||\r
 \r
@@ -259,7 +259,7 @@ k5_id_write_params(HWND hw, k5_id_dlg_data * d) {
     GetDlgItemText(hw, IDC_CFG_CCACHE, ccache, ARRAYLENGTH(ccache));\r
 \r
     if (SUCCEEDED(StringCbLength(ccache, sizeof(ccache), &cb)) &&\r
-        wcsicmp(ccache, d->ccache)) {\r
+        _wcsicmp(ccache, d->ccache)) {\r
         khc_write_string(csp_ident, L"DefaultCCName", ccache);\r
         StringCbCopy(d->ccache, sizeof(d->ccache), ccache);\r
     } else {\r
index 4eebb9c62994acbe1593095c5fddccf6d472b33f..579b9f712d3194c5cca452076bfc9a08ce40bbd8 100644 (file)
@@ -24,6 +24,8 @@
 \r
 /* $Id$ */\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
index dab522c5dcd30ec51cee924f760a73b4d98e6e6b..1f7b2bdad138b6a07d748e4a6790581a0b593dbd 100644 (file)
@@ -434,12 +434,15 @@ static long get_tickets_from_cache(krb5_context ctx,
         if ( !pkrb5_decode_ticket(&KRBv5Credentials.ticket, &tkt)) {\r
             ti = tkt->enc_part.enctype;\r
             kcdb_cred_set_attr(cred, attr_id_tkt_enctype, &ti, sizeof(ti));\r
+            ti = tkt->enc_part.kvno;\r
+            kcdb_cred_set_attr(cred, attr_id_kvno, &ti, sizeof(ti));\r
             pkrb5_free_ticket(ctx, tkt);\r
             tkt = NULL;\r
         }\r
 \r
         ti = KRBv5Credentials.keyblock.enctype;\r
         kcdb_cred_set_attr(cred, attr_id_key_enctype, &ti, sizeof(ti));\r
+\r
         kcdb_cred_set_attr(cred, KCDB_ATTR_LOCATION, wcc_name, \r
                            KCDB_CBSIZE_AUTO);\r
 \r
@@ -1734,10 +1737,10 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-        strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-        strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
+\r
         return FALSE;\r
     }\r
     \r
@@ -1745,7 +1748,7 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     \r
     if (configFile)\r
     {\r
-        strncpy(confname, *configFile, szConfname);\r
+        StringCchCopyA(confname, szConfname, *configFile);\r
         pkrb5_free_config_files(configFile); \r
     }\r
     \r
@@ -1753,10 +1756,8 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-        strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-        strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
     }\r
     \r
     return FALSE;\r
@@ -1773,25 +1774,19 @@ khm_get_krb4_con_file(LPSTR confname, UINT szConfname)
         if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile))) {\r
             GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
             krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, KRB5_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
+            StringCchCatA(confname, szConfname, "\\");\r
         }\r
         \r
         pFind = strrchr(krbConFile, '\\');\r
         if (pFind) {\r
-            *pFind = 0;\r
-            strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, KRB_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
+            *pFind = '\0';\r
+            StringCchCatA(krbConFile, ARRAYLENGTH(krbConFile), "\\");\r
+            StringCchCatA(krbConFile, ARRAYLENGTH(krbConFile), KRB_FILE);\r
         }\r
         else\r
-            krbConFile[0] = 0;\r
-        \r
-        strncpy(confname, krbConFile, szConfname);\r
-        confname[szConfname-1] = '\0';\r
+            krbConFile[0] = '\0';\r
+\r
+        StringCchCopyA(confname, szConfname, krbConFile);\r
     }\r
     else if (hKrb4) { \r
         unsigned int size = szConfname;\r
@@ -1800,10 +1795,8 @@ khm_get_krb4_con_file(LPSTR confname, UINT szConfname)
             { // Error has happened\r
                 GetWindowsDirectoryA(confname,szConfname);\r
                 confname[szConfname-1] = '\0';\r
-                strncat(confname, "\\",szConfname-strlen(confname));\r
-                confname[szConfname-1] = '\0';\r
-                strncat(confname,KRB_FILE,szConfname-strlen(confname));\r
-                confname[szConfname-1] = '\0';\r
+                StringCchCatA(confname, szConfname, "\\");\r
+                StringCchCatA(confname, szConfname, KRB_FILE);\r
             }\r
     }\r
     return FALSE;\r
@@ -1922,7 +1915,12 @@ khm_krb5_get_realm_list(void)
         wchar_t * d;\r
 \r
         if (!khm_get_krb4_con_file(krb_conf,sizeof(krb_conf)) && \r
-            (file = fopen(krb_conf, "rt")))\r
+#if _MSC_VER >= 1400\r
+            !fopen_s(&file, krb_conf, "rt")\r
+#else\r
+           (file = fopen(krb_conf, "rt"))\r
+#endif\r
+            )\r
         {\r
             char lineBuf[256];\r
 \r
@@ -2151,7 +2149,8 @@ khm_int32 KHMAPI
 khm_krb5_creds_is_equal(khm_handle vcred1, khm_handle vcred2, void * dummy) {\r
     if (kcdb_creds_comp_attr(vcred1, vcred2, KCDB_ATTR_LOCATION) ||\r
         kcdb_creds_comp_attr(vcred1, vcred2, attr_id_key_enctype) ||\r
-        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_tkt_enctype))\r
+        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_tkt_enctype) ||\r
+        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_kvno))\r
         return 1;\r
     else\r
         return 0;\r
index f52e3441ddb167a60bd39c95ea48d0f04844e776..b263e6bf3071c1be284b830c185fbdf45585de40 100644 (file)
@@ -212,7 +212,7 @@ update_crossfeed(khui_new_creds * nc,
                         (WPARAM) idx,\r
                         (LPARAM) srealm);\r
 \r
-            if (!wcsicmp(srealm, un_realm) && wcscmp(srealm, un_realm)) {\r
+            if (!_wcsicmp(srealm, un_realm) && wcscmp(srealm, un_realm)) {\r
                 /* differ only by case */\r
 \r
                 StringCchCopy(un_realm, ARRAYLENGTH(un) - (un_realm - un),\r
@@ -260,7 +260,7 @@ update_crossfeed(khui_new_creds * nc,
                     (WPARAM) idx,\r
                     (LPARAM) srealm);\r
 \r
-        if (!wcsicmp(srealm, realm) && wcscmp(srealm, realm)) {\r
+        if (!_wcsicmp(srealm, realm) && wcscmp(srealm, realm)) {\r
             StringCbCopy(realm, sizeof(realm), srealm);\r
 \r
             SetWindowText(d->hw_realm, srealm);\r
@@ -1145,7 +1145,7 @@ k5_ident_update(khm_int32 msg_type,
     khm_krb5_canon_cc_name(w_ccname, sizeof(w_ccname));\r
     khm_krb5_canon_cc_name(wid_ccname, sizeof(wid_ccname));\r
 \r
-    if (!wcsicmp(w_ccname, wid_ccname))\r
+    if (!_wcsicmp(w_ccname, wid_ccname))\r
         kcdb_identity_set_default_int(ident);\r
 \r
  _iu_cleanup:\r
@@ -1499,7 +1499,7 @@ DWORD WINAPI k5_ccname_monitor_thread(LPVOID lpParameter) {
                 new_ccname[0] = L'\0';\r
             }\r
 \r
-            if (wcsicmp(new_ccname, reg_ccname)) {\r
+            if (_wcsicmp(new_ccname, reg_ccname)) {\r
                 k5_refresh_default_identity(ctx);\r
                 StringCbCopy(reg_ccname, sizeof(reg_ccname), new_ccname);\r
             }\r
index ee85355a0bf254b9fa9cd2162e707fd1df48fb58..97ef85ee9503436022540d26423cba6b6c7a04e1 100644 (file)
@@ -36,23 +36,27 @@ khm_int32 type_id_enctype       = -1;
 khm_int32 type_id_addr_list     = -1;\r
 khm_int32 type_id_krb5_flags    = -1;\r
 khm_int32 type_id_krb5_princ    = -1;\r
+khm_int32 type_id_kvno          = -1;\r
 \r
 BOOL type_regd_enctype      = FALSE;\r
 BOOL type_regd_addr_list    = FALSE;\r
 BOOL type_regd_krb5_flags   = FALSE;\r
 BOOL type_regd_krb5_princ   = FALSE;\r
+BOOL type_regd_kvno         = FALSE;\r
 \r
 khm_int32 attr_id_key_enctype   = -1;\r
 khm_int32 attr_id_tkt_enctype   = -1;\r
 khm_int32 attr_id_addr_list     = -1;\r
 khm_int32 attr_id_krb5_flags    = -1;\r
 khm_int32 attr_id_krb5_ccname   = -1;\r
+khm_int32 attr_id_kvno          = -1;\r
 \r
 BOOL attr_regd_key_enctype  = FALSE;\r
 BOOL attr_regd_tkt_enctype  = FALSE;\r
 BOOL attr_regd_addr_list    = FALSE;\r
 BOOL attr_regd_krb5_flags   = FALSE;\r
 BOOL attr_regd_krb5_ccname  = FALSE;\r
+BOOL attr_regd_kvno         = FALSE;\r
 \r
 khm_handle csp_plugins      = NULL;\r
 khm_handle csp_krbcred   = NULL;\r
@@ -196,6 +200,31 @@ KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module) {
         type_regd_krb5_flags = TRUE;\r
     }\r
 \r
+    if (KHM_FAILED(kcdb_type_get_id(TYPENAME_KVNO, &type_id_kvno))) {\r
+        kcdb_type type;\r
+        kcdb_type *t32;\r
+\r
+        kcdb_type_get_info(KCDB_TYPE_INT32, &t32);\r
+\r
+        type.id = KCDB_TYPE_INVALID;\r
+        type.name = TYPENAME_KVNO;\r
+        type.flags = KCDB_TYPE_FLAG_CB_FIXED;\r
+        type.cb_max = t32->cb_max;\r
+        type.cb_min = t32->cb_min;\r
+        type.isValid = t32->isValid;\r
+        type.comp = t32->comp;\r
+        type.dup = t32->dup;\r
+        type.toString = kvno_toString;\r
+\r
+        rv = kcdb_type_register(&type, &type_id_kvno);\r
+        kcdb_type_release_info(t32);\r
+\r
+        if (KHM_FAILED(rv))\r
+            goto _exit;\r
+\r
+        type_regd_kvno = TRUE;\r
+    }\r
+\r
     /* Register common attributes */\r
     if(KHM_FAILED(kcdb_attrib_get_id(ATTRNAME_KEY_ENCTYPE, &attr_id_key_enctype))) {\r
         kcdb_attrib attrib;\r
@@ -328,6 +357,32 @@ KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module) {
         attr_regd_krb5_ccname = TRUE;\r
     }\r
 \r
+    if (KHM_FAILED(kcdb_attrib_get_id(ATTRNAME_KVNO, &attr_id_kvno))) {\r
+        kcdb_attrib attrib;\r
+        wchar_t sbuf[KCDB_MAXCCH_SHORT_DESC];\r
+        wchar_t lbuf[KCDB_MAXCCH_LONG_DESC];\r
+        /* although we are loading a long description, it still fits\r
+           in the short description buffer */\r
+\r
+        ZeroMemory(&attrib, sizeof(attrib));\r
+\r
+        attrib.name = ATTRNAME_KVNO;\r
+        attrib.id = KCDB_ATTR_INVALID;\r
+        attrib.type = type_id_kvno;\r
+        attrib.flags = KCDB_ATTR_FLAG_TRANSIENT;\r
+        LoadString(hResModule, IDS_KVNO_SHORT_DESC, sbuf, ARRAYLENGTH(sbuf));\r
+        LoadString(hResModule, IDS_KVNO_LONG_DESC, lbuf, ARRAYLENGTH(lbuf));\r
+        attrib.short_desc = sbuf;\r
+        attrib.long_desc = lbuf;\r
+\r
+        rv = kcdb_attrib_register(&attrib, &attr_id_kvno);\r
+\r
+        if (KHM_FAILED(rv))\r
+            goto _exit;\r
+\r
+        attr_regd_kvno = TRUE;\r
+    }\r
+\r
     rv = kmm_get_plugins_config(0, &csp_plugins);\r
     if(KHM_FAILED(rv)) goto _exit;\r
 \r
@@ -359,6 +414,8 @@ KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module) {
         kcdb_attrib_unregister(attr_id_krb5_flags);\r
     if(attr_regd_krb5_ccname)\r
         kcdb_attrib_unregister(attr_id_krb5_ccname);\r
+    if(attr_regd_kvno)\r
+        kcdb_attrib_unregister(attr_id_kvno);\r
 \r
     if(type_regd_enctype)\r
         kcdb_type_unregister(type_id_enctype);\r
@@ -366,6 +423,8 @@ KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module) {
         kcdb_type_unregister(type_id_addr_list);\r
     if(type_regd_krb5_flags)\r
         kcdb_type_unregister(type_id_krb5_flags);\r
+    if(type_regd_kvno)\r
+        kcdb_type_unregister(type_id_kvno);\r
 \r
     if(csp_params) {\r
         khc_close_space(csp_params);\r
index 3e64b00772e8f3491c3ff1d440164af011c8c650..4b9373d08103d4691becbf26b393df7ea84be39b 100644 (file)
@@ -62,12 +62,14 @@ typedef enum tag_k5_lsa_import {
 #define TYPENAME_ADDR_LIST      L"AddrList"\r
 #define TYPENAME_KRB5_FLAGS     L"Krb5Flags"\r
 #define TYPENAME_KRB5_PRINC     L"Krb5Principal"\r
+#define TYPENAME_KVNO           L"Kvno"\r
 \r
 #define ATTRNAME_KEY_ENCTYPE    L"KeyEncType"\r
 #define ATTRNAME_TKT_ENCTYPE    L"TktEncType"\r
 #define ATTRNAME_ADDR_LIST      L"AddrList"\r
 #define ATTRNAME_KRB5_FLAGS     L"Krb5Flags"\r
 #define ATTRNAME_KRB5_CCNAME    L"Krb5CCName"\r
+#define ATTRNAME_KVNO           L"Kvno"\r
 \r
 void init_krb();\r
 void exit_krb();\r
@@ -84,6 +86,7 @@ extern khm_int32 type_id_enctype;
 extern khm_int32 type_id_addr_list;\r
 extern khm_int32 type_id_krb5_flags;\r
 extern khm_int32 type_id_krb5_princ;\r
+extern khm_int32 type_id_kvno;\r
 \r
 extern BOOL      type_regd_krb5_princ;\r
 \r
@@ -92,6 +95,7 @@ extern khm_int32 attr_id_tkt_enctype;
 extern khm_int32 attr_id_addr_list;\r
 extern khm_int32 attr_id_krb5_flags;\r
 extern khm_int32 attr_id_krb5_ccname;\r
+extern khm_int32 attr_id_kvno;\r
 \r
 extern khm_ui_4  k5_commctl_version;\r
 \r
index c54bdb4b1aafbeb4a0d1fa3ea5affef51481b1fe..49673c3781a348e0b7b3a6d9b2c39bc2ccc190a2 100644 (file)
@@ -521,6 +521,8 @@ BEGIN
     IDS_CFG_RE_MMK          "Toggle &master KDC"\r
     IDS_CFG_RE_MND          "&Add new domain mapping"\r
     IDS_CFG_RE_MDD          "&Remove domain mapping"\r
+    IDS_KVNO_LONG_DESC      "Key version number"\r
+    IDS_KVNO_SHORT_DESC     "Kvno"\r
 END\r
 \r
 #endif    // English (U.S.) resources\r
index edda7dd02dd50412aa90737f8a49d6904602a1f6..da8a62ffda537575d99eaea51041fb077a02c093 100644 (file)
 #define IDS_CFG_RE_MMK                  214\r
 #define IDS_CFG_RE_MND                  215\r
 #define IDS_CFG_RE_MDD                  216\r
+#define IDS_KVNO_SHORT_DESC             217\r
+#define IDS_KVNO_LONG_DESC              218\r
 #define IDC_NCK5_RENEWABLE              1002\r
 #define IDC_NCK5_FORWARDABLE            1004\r
 #define IDC_NCK5_REALM                  1005\r
 // \r
 #ifdef APSTUDIO_INVOKED\r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE        118\r
+#define _APS_NEXT_RESOURCE_VALUE        219\r
 #define _APS_NEXT_COMMAND_VALUE         40002\r
 #define _APS_NEXT_CONTROL_VALUE         1079\r
 #define _APS_NEXT_SYMED_VALUE           101\r
index e09d9f8c7cbfe63e96134128f6f19fd99d4ba3ff..35c19bdba16b6862199922d89f738a1e67e85c4b 100644 (file)
@@ -27,7 +27,7 @@ MODULE=ui
 
 EXEFILE=$(BINDIR)\netidmgr.exe
 
-MANIFESTFILE=$(BINDIR)\netidmgr.exe.manifest
+MANIFESTFILE=$(BINDIR)\netidmgr.exe.static.manifest
 
 OBJFILES=                      \
        $(OBJ)\main.obj         \
@@ -88,7 +88,6 @@ $(MANIFESTFILE): netidmgr.manifest.$(CPU).$(KH_CLVER).debug
 !endif
        $(CP) $** $@
 
-
 !if  ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" )
 SCLIB=bufferoverflowu.lib
 !else
@@ -97,6 +96,6 @@ SCLIB=
 
 $(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES)
        $(EXEGUILINK) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_EXE) $(MANIFESTFILE)
 
-all: mkdirs $(EXEFILE) $(MANIFESTFILE)
-
+all: mkdirs $(MANIFESTFILE) $(EXEFILE)
index b68a3f953f19f8b28d0db921f0f3e35f15c0eddc..31df6bdf7079f93ebf4fb604d66216c6c8f6cc28 100644 (file)
@@ -4113,7 +4113,7 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         /* a hyperlink was activated */\r
         khui_htwnd_link * l;\r
         l = (khui_htwnd_link *) lParam;\r
-        wcsncpy(wid, l->id, l->id_len);\r
+        StringCchCopyN(wid, ARRAYLENGTH(wid), l->id, l->id_len);\r
         wid[l->id_len] = 0;\r
 \r
         if(!wcscmp(wid, L"NewCreds")) {\r
index b18ef42bb731dde9f12686b37f9cabf182afccb6..7df6e9d651730864faa306e7bf7067550862e991 100644 (file)
@@ -202,8 +202,12 @@ void khm_start_file_log(void) {
 \r
     khm_get_file_log_path(sizeof(temppath), temppath);\r
 \r
+    logfile = NULL;\r
+#if _MSC_VER >= 1400\r
+    _wfopen_s(&logfile, temppath, L"w");\r
+#else\r
     logfile = _wfopen(temppath, L"w");\r
-\r
+#endif\r
     kherr_add_ctx_handler(debug_event_handler,\r
                          KHERR_CTX_BEGIN |\r
                          KHERR_CTX_END |\r
index a9472585b4f6eb1fde09dba5ed40b411d1a32428..9507fbdd0c228a9181ec326758a7168cb4d1213d 100644 (file)
@@ -121,6 +121,8 @@ typedef struct khui_htwnd_data_t {
     wchar_t * text;\r
     int scroll_left;\r
     int scroll_top;\r
+    int ext_width;\r
+    int ext_height;\r
     COLORREF bk_color;\r
     HCURSOR hc_hand;\r
     int l_pixel_y;\r
@@ -630,6 +632,8 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     int align;\r
     int y;\r
     wchar_t * par_start;\r
+    int ext_width = 0;\r
+    int ext_height = 0;\r
 \r
     d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
@@ -645,8 +649,11 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 \r
     GetClientRect(hwnd, &r);\r
 \r
+#ifdef DRAW_HTWND_CLIENT_EDGE\r
+    /* for the moment, we are skipping on the client edge. */\r
     if(d->flags & KHUI_HTWND_CLIENTEDGE)\r
         DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT);\r
+#endif\r
 \r
     hbk = CreateSolidBrush(RGB(255,255,255));\r
     FillRect(hdc, &r, hbk);\r
@@ -728,8 +735,6 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         p = par_start;\r
         format_unwind(&s_stack, s_start); /* unwind format stack */\r
 \r
-        //MoveToEx(hdc, x, y + l_height, NULL);\r
-\r
         p_width = 0;\r
 \r
         while(*p) {\r
@@ -766,13 +771,14 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 SetTextColor(hdc, format_color(&s_stack));\r
 \r
                 GetTextExtentPoint32(hdc, p, (int)(c - p), &s);\r
-                rd.left = x + p_width;\r
-                rd.top = y;\r
-                rd.right = x + p_width + s.cx;\r
-                rd.bottom = y + l_height;\r
+                rd.left = x + p_width - d->scroll_left;\r
+                rd.top = y - d->scroll_top;\r
+                rd.right = x + p_width + s.cx - d->scroll_left;\r
+                rd.bottom = y + l_height - d->scroll_top;\r
 \r
                 if(IntersectRect(&rt, &rd, &r)) {\r
-                    DrawText(hdc, p, (int)(c - p), &rt, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
+                    DrawText(hdc, p, (int)(c - p), &rd,\r
+                             DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
                 }\r
 \r
                 p_width += s.cx;\r
@@ -782,12 +788,86 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             }\r
         }\r
 \r
+        if (p_width > ext_width)\r
+            ext_width = p_width;\r
+\r
         y += l_height;\r
         par_start = p;\r
     }\r
 \r
+    if (y > ext_height)\r
+        ext_height = y;\r
+\r
     EndPaint(hwnd, &ps);\r
 \r
+    if (d->ext_width < ext_width) {\r
+        SCROLLINFO si;\r
+        LONG l;\r
+\r
+        /* the extents need to be adjusted.  But first check if we\r
+           have exactly the right scroll bars we need. */\r
+        if ((ext_width > (r.right - r.left) &&\r
+             !(d->flags & KHUI_HTWND_HSCROLL)) ||\r
+            (ext_height > (r.bottom - r.top) &&\r
+             !(d->flags & KHUI_HTWND_VSCROLL)) ||\r
+\r
+            (ext_width <= (r.right - r.left) &&\r
+             (d->flags & KHUI_HTWND_HSCROLL)) ||\r
+            (ext_height <= (r.bottom - r.top) &&\r
+             (d->flags & KHUI_HTWND_VSCROLL))) {\r
+\r
+            /* need to add scroll bars */\r
+            if (ext_width > (r.right - r.left))\r
+                d->flags |= KHUI_HTWND_HSCROLL;\r
+            else\r
+                d->flags &= ~KHUI_HTWND_HSCROLL;\r
+\r
+            if (ext_height > (r.bottom - r.top))\r
+                d->flags |= KHUI_HTWND_VSCROLL;\r
+            else\r
+                d->flags &= ~KHUI_HTWND_VSCROLL;\r
+\r
+            l = GetWindowLongPtr(hwnd, GWL_STYLE);\r
+            l &= ~(WS_HSCROLL | WS_VSCROLL);\r
+\r
+            l |= ((d->flags & KHUI_HTWND_HSCROLL) ? WS_HSCROLL : 0) |\r
+                ((d->flags & KHUI_HTWND_VSCROLL) ? WS_VSCROLL : 0);\r
+\r
+            SetWindowLongPtr(hwnd, GWL_STYLE, l);\r
+\r
+            InvalidateRect(hwnd, NULL, FALSE);\r
+            /* since the client area changed, we do another redraw\r
+               before updating the scroll bar positions. */\r
+        } else {\r
+            d->ext_width = ext_width;\r
+            d->ext_height = ext_height;\r
+\r
+            if (d->flags & KHUI_HTWND_HSCROLL) {\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;\r
+                si.nMin = 0;\r
+                si.nMax = ext_width;\r
+                si.nPage = r.right - r.left;\r
+                si.nPos = d->scroll_left;\r
+\r
+                SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);\r
+            }\r
+\r
+            if (d->flags & KHUI_HTWND_VSCROLL) {\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;\r
+                si.nMin = 0;\r
+                si.nMax = ext_height;\r
+                si.nPage = r.bottom - r.top;\r
+                si.nPos = d->scroll_top;\r
+\r
+                SetScrollInfo(hwnd, SB_VERT, &si, TRUE);\r
+            }\r
+        }\r
+    }\r
+\r
     return 0;\r
 }\r
 \r
@@ -798,231 +878,328 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
                                  )\r
 {\r
     switch(uMsg) {\r
-        case WM_CREATE:\r
-            {\r
-                CREATESTRUCT * cs;\r
-                khui_htwnd_data * d;\r
-                size_t cbsize;\r
+    case WM_CREATE:\r
+        {\r
+            CREATESTRUCT * cs;\r
+            khui_htwnd_data * d;\r
+            size_t cbsize;\r
 \r
-                cs = (CREATESTRUCT *) lParam;\r
+            cs = (CREATESTRUCT *) lParam;\r
 \r
-                d = PMALLOC(sizeof(*d));\r
-                ZeroMemory(d, sizeof(*d));\r
+            d = PMALLOC(sizeof(*d));\r
+            ZeroMemory(d, sizeof(*d));\r
 \r
-                if(cs->dwExStyle & WS_EX_TRANSPARENT) {\r
-                    d->flags |= KHUI_HTWND_TRANSPARENT;\r
-                }\r
-                if(cs->dwExStyle & WS_EX_CLIENTEDGE) {\r
-                    d->flags |= KHUI_HTWND_CLIENTEDGE;\r
-                }\r
-                d->id = (int)(INT_PTR) cs->hMenu;\r
+            if(cs->dwExStyle & WS_EX_TRANSPARENT) {\r
+                d->flags |= KHUI_HTWND_TRANSPARENT;\r
+            }\r
+            if(cs->dwExStyle & WS_EX_CLIENTEDGE) {\r
+                d->flags |= KHUI_HTWND_CLIENTEDGE;\r
+            }\r
+            if(cs->style & WS_HSCROLL) {\r
+                d->flags |= KHUI_HTWND_HSCROLL;\r
+            }\r
+            if(cs->style & WS_VSCROLL) {\r
+                d->flags |= KHUI_HTWND_VSCROLL;\r
+            }\r
+            d->id = (int)(INT_PTR) cs->hMenu;\r
 \r
-                d->active_link = -1;\r
-                d->bk_color = RGB(255,255,255);\r
-                d->hc_hand = LoadCursor(NULL, IDC_HAND);\r
+            d->active_link = -1;\r
+            d->bk_color = RGB(255,255,255);\r
+            d->hc_hand = LoadCursor(NULL, IDC_HAND);\r
 \r
-                if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
-                    cbsize += sizeof(wchar_t);\r
-                    d->text = PMALLOC(cbsize);\r
-                    StringCbCopy(d->text, cbsize, cs->lpszName);\r
-                }\r
+            if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
+                cbsize += sizeof(wchar_t);\r
+                d->text = PMALLOC(cbsize);\r
+                StringCbCopy(d->text, cbsize, cs->lpszName);\r
+            }\r
+\r
+            /* this is just a flag to the WM_PAINT handler that the\r
+               extents haven't been set yet. */\r
+            d->ext_width = -1;\r
 \r
 #pragma warning(push)\r
 #pragma warning(disable: 4244)\r
-                SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);\r
+            SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);\r
 #pragma warning(pop)\r
 \r
-                return 0;\r
+            return 0;\r
+        }\r
+        break;\r
+\r
+    case WM_SETTEXT:\r
+        {\r
+            wchar_t * newtext;\r
+            size_t cbsize;\r
+            khui_htwnd_data * d;\r
+            BOOL rv;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            newtext = (wchar_t *) lParam;\r
+\r
+            if(d->text) {\r
+                PFREE(d->text);\r
+                d->text = NULL;\r
             }\r
-            break;\r
 \r
-        case WM_SETTEXT:\r
-            {\r
-                wchar_t * newtext;\r
-                size_t cbsize;\r
-                khui_htwnd_data * d;\r
-                BOOL rv;\r
+            if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
+                cbsize += sizeof(wchar_t);\r
+                d->text = PMALLOC(cbsize);\r
+                StringCbCopy(d->text, cbsize, newtext);\r
+                rv = TRUE;\r
+            } else\r
+                rv = FALSE;\r
+\r
+            clear_styles(d);\r
+\r
+            d->ext_width = -1;\r
+            d->scroll_left = 0;\r
+            d->scroll_top = 0;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
-                newtext = (wchar_t *) lParam;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
 \r
-                if(d->text) {\r
-                    PFREE(d->text);\r
-                    d->text = NULL;\r
+            return rv;\r
+        }\r
+        break;\r
+\r
+    case WM_DESTROY:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int i;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            if(d->text)\r
+                PFREE(d->text);\r
+            d->text = 0;\r
+\r
+            if(d->links) {\r
+                for(i=0;i<d->max_links;i++) {\r
+                    if(d->links[i])\r
+                        PFREE(d->links[i]);\r
                 }\r
+                PFREE(d->links);\r
+            }\r
 \r
-                if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
-                    cbsize += sizeof(wchar_t);\r
-                    d->text = PMALLOC(cbsize);\r
-                    StringCbCopy(d->text, cbsize, newtext);\r
-                    rv = TRUE;\r
-                } else\r
-                    rv = FALSE;\r
+            clear_styles(d);\r
 \r
-                clear_styles(d);\r
+            PFREE(d);\r
+        }\r
+        break;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+    case WM_ERASEBKGND:\r
+        {\r
+            khui_htwnd_data * d;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                return rv;\r
-            }\r
-            break;\r
+            if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+                return TRUE;\r
 \r
-        case WM_DESTROY:\r
-            {\r
-                khui_htwnd_data * d;\r
-                int i;\r
-\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
-                if(d->text)\r
-                    PFREE(d->text);\r
-                d->text = 0;\r
-\r
-                if(d->links) {\r
-                    for(i=0;i<d->max_links;i++) {\r
-                        if(d->links[i])\r
-                            PFREE(d->links[i]);\r
-                    }\r
-                    PFREE(d->links);\r
-                }\r
+            return FALSE;\r
+        }\r
+\r
+    case WM_PAINT:\r
+        htw_paint(hwnd, uMsg, wParam, lParam);\r
+        break;\r
+\r
+    case WM_SETCURSOR:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                clear_styles(d);\r
+            if(hwnd != (HWND)wParam)\r
+                break;\r
+                \r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                PFREE(d);\r
+            if(d->active_link >= 0) {\r
+                SetCursor(d->hc_hand);\r
+                return TRUE;\r
             }\r
-            break;\r
+        }\r
+        break;\r
 \r
-        case WM_ERASEBKGND:\r
-            {\r
-                khui_htwnd_data * d;\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_SETFOCUS:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                if(d->flags & KHUI_HTWND_TRANSPARENT)\r
-                    return TRUE;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                return FALSE;\r
-            }\r
+            d->flags |= KHUI_HTWND_FOCUS;\r
 \r
-        case WM_PAINT:\r
-            htw_paint(hwnd, uMsg, wParam, lParam);\r
-            break;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
+        }\r
+        break;\r
 \r
-        case WM_SETCURSOR:\r
-            {\r
-                khui_htwnd_data * d;\r
+    case WM_KILLFOCUS:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                if(hwnd != (HWND)wParam)\r
-                    break;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            d->flags &= ~KHUI_HTWND_FOCUS;\r
 \r
-                if(d->active_link >= 0) {\r
-                    SetCursor(d->hc_hand);\r
-                    return TRUE;\r
-                }\r
-            }\r
-            break;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
+        }\r
+        break;\r
+\r
+    case WM_LBUTTONDOWN:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-        case WM_SETFOCUS:\r
-            {\r
-                khui_htwnd_data * d;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            d->md_link = d->active_link;\r
 \r
-                d->flags |= KHUI_HTWND_FOCUS;\r
+            SetCapture(hwnd);\r
+        }\r
+        break;\r
+\r
+    case WM_LBUTTONUP:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+            if(d->md_link == d->active_link && d->md_link >= 0) {\r
+                /* clicked */\r
+                SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);\r
             }\r
-            break;\r
 \r
-        case WM_KILLFOCUS:\r
-            {\r
-                khui_htwnd_data * d;\r
+            ReleaseCapture();\r
+        }\r
+        break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_HSCROLL:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int old_pos;\r
+            int new_pos;\r
+            int ext;\r
+            SCROLLINFO si;\r
+            RECT r;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+            old_pos = new_pos = d->scroll_left;\r
+            ext = d->ext_width;\r
+\r
+            switch(HIWORD(wParam)) {\r
+            case SB_THUMBTRACK:\r
+            case SB_THUMBPOSITION:\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_TRACKPOS;\r
+                GetScrollInfo(hwnd, SB_HORZ, &si);\r
+                new_pos = si.nTrackPos;\r
+                break;\r
 \r
-                d->flags &= ~KHUI_HTWND_FOCUS;\r
+            case SB_LINELEFT:\r
+                new_pos -= ext / 12; /* arbitrary unit */\r
+                break;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+            case SB_LINERIGHT:\r
+                new_pos += ext / 12; /* arbitrary unit */\r
+                break;\r
+\r
+            case SB_PAGELEFT:\r
+                GetClientRect(hwnd, &r);\r
+                new_pos -= r.right - r.left;\r
+                break;\r
+\r
+            case SB_PAGERIGHT:\r
+                GetClientRect(hwnd, &r);\r
+                new_pos += r.right - r.left;\r
+                break;\r
             }\r
-            break;\r
 \r
-        case WM_LBUTTONDOWN:\r
-            {\r
-                khui_htwnd_data * d;\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            GetClientRect(hwnd, &r);\r
 \r
-                d->md_link = d->active_link;\r
+#if 0\r
+            if (new_pos > ext - (r.right - r.left))\r
+                new_pos = ext - (r.right - r.left);\r
+#endif\r
+            if (new_pos > ext)\r
+                new_pos = ext;\r
 \r
-                SetCapture(hwnd);\r
-            }\r
-            break;\r
+            if (new_pos < 0)\r
+                new_pos = 0;\r
 \r
-        case WM_LBUTTONUP:\r
-            {\r
-                khui_htwnd_data * d;\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            ZeroMemory(&si, sizeof(si));\r
+            si.cbSize = sizeof(si);\r
+            si.fMask = SIF_POS;\r
+            si.nPos = new_pos;\r
+            SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);\r
+            /* note that Windows sometimes adjusts the position after\r
+               setting it with SetScrollInfo.  We have to look it up\r
+               again to see what value it ended up at. */\r
+            GetScrollInfo(hwnd, SB_HORZ, &si);\r
+            new_pos = si.nPos;\r
+\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                if(d->md_link == d->active_link && d->md_link >= 0) {\r
-                    /* clicked */\r
-                    SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);\r
-                }\r
+            d->scroll_left = new_pos;\r
 \r
-                ReleaseCapture();\r
-            }\r
-            break;\r
+            ScrollWindow(hwnd, old_pos - new_pos, 0, NULL, NULL);\r
 \r
-        case WM_MOUSEMOVE:\r
-            {\r
-                khui_htwnd_data * d;\r
-                int i;\r
-                POINT p;\r
-                int nl;\r
+            return 0;\r
+        }\r
+        break;\r
 \r
-                p.x = GET_X_LPARAM(lParam);\r
-                p.y = GET_Y_LPARAM(lParam);\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_MOUSEMOVE:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int i;\r
+            POINT p;\r
+            int nl;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            p.x = GET_X_LPARAM(lParam) + d->scroll_left;\r
+            p.y = GET_Y_LPARAM(lParam) + d->scroll_top;\r
                 \r
-                for(i=0; i<d->n_links; i++) {\r
-                    if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))\r
-                        break;\r
-                }\r
+            for(i=0; i<d->n_links; i++) {\r
+                if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))\r
+                    break;\r
+            }\r
 \r
-                if(i == d->n_links)\r
-                    nl = -1;\r
-                else\r
-                    nl = i;\r
+            if(i == d->n_links)\r
+                nl = -1;\r
+            else\r
+                nl = i;\r
 \r
-                if(d->active_link != nl) {\r
-                    if(d->active_link >= 0) {\r
-                        if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+            if(d->active_link != nl) {\r
+                if(d->active_link >= 0) {\r
+                    if(d->flags & KHUI_HTWND_TRANSPARENT)\r
                         {\r
                             HWND parent = GetParent(hwnd);\r
                             if(parent) {\r
                                 InvalidateRect(parent, NULL, TRUE);\r
                             }\r
                         }\r
-                        /* although we are invalidating the rect before setting active_link,\r
-                           WM_PAINT will not be issued until wndproc returns */\r
-                        InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
-                    }\r
-                    d->active_link = nl;\r
-                    if(d->active_link >= 0) {\r
-                        /* although we are invalidating the rect before setting active_link,\r
-                           WM_PAINT will not be issued until wndproc returns */\r
-                        if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+                    /* although we are invalidating the rect before setting active_link,\r
+                       WM_PAINT will not be issued until wndproc returns */\r
+                    InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
+                }\r
+                d->active_link = nl;\r
+                if(d->active_link >= 0) {\r
+                    /* although we are invalidating the rect before setting active_link,\r
+                       WM_PAINT will not be issued until wndproc returns */\r
+                    if(d->flags & KHUI_HTWND_TRANSPARENT)\r
                         {\r
                             HWND parent = GetParent(hwnd);\r
                             if(parent) {\r
                                 InvalidateRect(parent, NULL, TRUE);\r
                             }\r
                         }\r
-                        InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
-                    }\r
+                    InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
                 }\r
             }\r
-            break;\r
+        }\r
+        break;\r
     }\r
 \r
     return DefWindowProc(hwnd, uMsg,wParam,lParam);\r
index e83dbb68445be4d909c5f1217fdc6c5ffcd854a4..2ca8c261b8333d382a9e19dd324b04209b3edc55 100644 (file)
@@ -40,6 +40,8 @@ We currently support the following tags:
 \r
 #define KHUI_HTWND_TRANSPARENT  1\r
 #define KHUI_HTWND_CLIENTEDGE   2\r
+#define KHUI_HTWND_HSCROLL      4\r
+#define KHUI_HTWND_VSCROLL      8\r
 #define KHUI_HTWND_FOCUS        2048\r
 \r
 #define KHUI_HTWND_CLASS L"KhmHtWnd"\r
index 56c79294bc7d14f0e3342cc835d921677dabf433..e263f7c87ebc20b720f747ea53c7abff21fb1656 100644 (file)
@@ -967,7 +967,8 @@ nc_handle_wm_command(HWND hwnd,
                    l->param_len < ARRAYLENGTH(sparam) &&\r
                    l->param_len > 0) {\r
 \r
-                    wcsncpy(sparam, l->param, l->param_len);\r
+                    StringCchCopyN(sparam, ARRAYLENGTH(sparam),\r
+                                   l->param, l->param_len);\r
                     sparam[l->param_len] = L'\0';\r
 \r
                 } else {\r
@@ -1006,7 +1007,7 @@ nc_handle_wm_command(HWND hwnd,
                 }\r
 \r
                 /* if it was for us, then we need to process the message */\r
-                if(!wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {\r
+                if(!_wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {\r
                     khm_int32 credtype;\r
                     khui_new_creds_by_type * t;\r
 \r
@@ -1021,10 +1022,10 @@ nc_handle_wm_command(HWND hwnd,
                                                    WMNC_DIALOG_SWITCH_PANEL),\r
                                         0);\r
                     }\r
-                } else if (!wcsicmp(sid, L"NotDef")) {\r
+                } else if (!_wcsicmp(sid, L"NotDef")) {\r
                     d->nc->set_default = FALSE;\r
                     nc_update_credtext(d);\r
-                } else if (!wcsicmp(sid, L"MakeDef")) {\r
+                } else if (!_wcsicmp(sid, L"MakeDef")) {\r
                     d->nc->set_default = TRUE;\r
                     nc_update_credtext(d);\r
                 }\r
index 29699476b3c185233036012bd74e8c7272607f89..f96ec5deecfb3f9abceb1a53abf05245254b7f9a 100644 (file)
@@ -29,6 +29,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 khui_action_ref khui_main_menu[] = {\r
     MENU_SUBMENU(KHUI_MENU_FILE),\r
     MENU_SUBMENU(KHUI_MENU_CRED),\r
index 3d06a07e22b4cf85878226b0ce3e91c4a154771e..96436543a7eee76a1cb92a27f937337c7e901e9b 100644 (file)
@@ -28,6 +28,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 /***********************************************************************\r
   Alerter\r
 ***********************************************************************/\r
index 9aa88cd287cdb10f472d5a485d542fb0b17189ad..79e570820ab8b53df4c75a2508d9cc18adcc2200 100644 (file)
@@ -30,6 +30,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 khm_int32 cfgui_node_serial;\r
 LONG init_once = 0;\r
 CRITICAL_SECTION cs_cfgui;\r
index 154ed18eb4ddff3ab20108207b7741920638ceb9..458218d90b0a2edd98587f5dddadb61e75c8fb54 100644 (file)
@@ -28,6 +28,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 #define CW_ALLOC_INCR 8\r
 \r
 static void cw_free_prompts(khui_new_creds * c);\r
index 45df19779fdbd28381368feb860cdda625002418..e561eb10832e2528e18c1b1a066dbdbf04d880b9 100644 (file)
@@ -415,24 +415,50 @@ typedef struct tag_khui_new_creds {
 #define KHUI_MAXCB_PNAME (KHUI_MAXCCH_PNAME * sizeof(wchar_t))\r
 \r
 /*! \brief A descriptor of a panel in the new credentials acquisition tab\r
+\r
+    When processing certain credentials messages such as\r
+    ::KMSG_CRED_PASSWORD, ::KMSG_CRED_NEW_CREDS,\r
+    ::KMSG_CRED_RENEW_CREDS, a pointer to a ::khui_new_creds structure\r
+    will be passed in to the message handler.  If the handler of the\r
+    message needs to add one or more credentials types as participants\r
+    of the operation, the handler will need to call khui_cw_add_type()\r
+    and specify a ::khui_new_creds_by_type structure.\r
+\r
+    Note that the memory address passed in to the call to\r
+    khui_cw_add_type() will not be copied.  Therefore, the block of\r
+    memory should remain as-is for the lifetime of the\r
+    ::khui_new_creds structure or until it is removed with a call to\r
+    khui_cw_del_type().\r
+\r
+    Some of the credentials messages that require specifying a\r
+    ::khui_new_creds_by_type structure require providing a\r
+    user-interface.  In these cases, the fields marked for providing a\r
+    UI may be required to hold valid values.  If the message does not\r
+    require providing a UI, these fields will be ignored.\r
 */\r
 typedef struct tag_khui_new_creds_by_type {\r
     khui_new_creds * nc;        /*!< Internal use.  Do not set */\r
     khm_int32   flags;          /*!< Internal use.  Do not set */\r
 \r
     khm_int32   type;           /*!< The identifier of the credentials\r
-                                  type */\r
+                                  type.  This is a credentials type\r
+                                  identifier allocated with a call to\r
+                                  kcdb_credtype_register(). */\r
 \r
     khm_int32   type_deps[KHUI_MAX_TYPE_DEPS];\r
                                 /*!< credentials types that this\r
                                     credential type depends on.  Each\r
                                     element defines a credentials type\r
                                     identifier that this type depends\r
-                                    on for this operation. */\r
+                                    on for this operation.  The number\r
+                                    of valid values in this array\r
+                                    should be specified in the \a\r
+                                    n_type_deps field. */\r
 \r
     khm_size    n_type_deps;    /*!< Number of dependencies listed\r
                                   above.  Should be between 0 and\r
-                                  ::KHUI_MAX_TYPE_DEPS */\r
+                                  ::KHUI_MAX_TYPE_DEPS.  Specify 0 if\r
+                                  there are no dependencies. */\r
 \r
     khm_size    ordinal;        /*!< The requested ordinal.  The UI\r
                                   would attempt to place this panel at\r
@@ -446,29 +472,49 @@ typedef struct tag_khui_new_creds_by_type {
     wchar_t    *name;           /*!< Name of the panel (localized,\r
                                   optional).  If NULL, the localized\r
                                   name of the credentials type is\r
-                                  used.  */\r
+                                  used. Only used if providing a\r
+                                  user-interface. */\r
 \r
-    HICON       icon;           /*!< Icon for the panel (optional) */\r
+    HICON       icon;           /*!< Icon for the panel (optional).\r
+                                  Only used if providing a\r
+                                  user-interface. */\r
 \r
     wchar_t    *tooltip;        /*!< Tooltip for the panel (localized,\r
                                   optional).  If NULL, no tooltip will\r
-                                  be assigned for the panel */\r
+                                  be assigned for the panel.  Only\r
+                                  used if providing a\r
+                                  user-interface.  */\r
 \r
     HMODULE     h_module;       /*!< Handle to the module containing\r
-                                  the dialog resource */\r
-\r
-    LPWSTR      dlg_template;   /*!< The dialog resource */\r
-    DLGPROC     dlg_proc;       /*!< The dialog procedure */\r
+                                  the dialog resource.  Only used if\r
+                                  providing a user-interface. */\r
+\r
+    LPWSTR      dlg_template;   /*!< The dialog resource.  Only used\r
+                                  if providing a user-interface. */\r
+    DLGPROC     dlg_proc;       /*!< The dialog procedure. Only used\r
+                                  if providing a user-interface. */\r
+\r
+    HWND        hwnd_panel;     /*!< The dialog window.  Once the\r
+                                  dialog panel is created, a handle to\r
+                                  the panel will be assigned here.\r
+                                  Note that the handle is assigned\r
+                                  after a successful call to\r
+                                  CreateDialogParam and hence would\r
+                                  not be available when handling the\r
+                                  WM_INITDIALOG message from the\r
+                                  dialog procedure.  Only used of\r
+                                  providing a user-interface. */\r
 \r
-    HWND        hwnd_panel;     /*!< The dialog window */\r
     HWND        hwnd_tc;        /*!< Internal use. Do not set */\r
 \r
     wchar_t    *credtext;       /*!< A brief description of the\r
                                   current state of this cred\r
-                                  type. (localized, optional) */\r
+                                  type. (localized, optional).  Only\r
+                                  used if providing a\r
+                                  user-interface. */\r
 \r
     LPARAM      aux;            /*!< auxilliary field.  For use by the\r
-                                  credential provider */\r
+                                  plug-in. */\r
 } khui_new_creds_by_type;\r
 \r
 /*!\name Flags for khui_new_creds_by_type\r
@@ -652,6 +698,22 @@ khui_cw_unlock_nc(khui_new_creds * c);
     See the description of ::khui_new_cred_panel for information on\r
     how to populate it to describe a credentials type panel.\r
 \r
+    Note that the structure pointed to by \a t is added by reference.\r
+    The memory pointed to by \a t is not copied.  Hence, the block of\r
+    memory and any other blocks pointed to by the\r
+    ::khui_new_creds_by_type structure located there should remain\r
+    intact for the lifetime of the ::khui_new_creds structure pointed\r
+    to by \a c or until the credentials type panel is removed from the\r
+    ::khui_new_creds structure with a call to khui_cw_del_type().\r
+\r
+    Generally, a plug-in that calls this function should allocate a\r
+    block of memory to contain the ::khui_new_creds_by_type structure,\r
+    fill it in and then pass in the address in a call to\r
+    khui_cw_add_type() while handling a ::KMSG_CRED_PASSWORD,\r
+    ::KMSG_CRED_NEW_CREDS or ::KMSG_CRED_RENEW_CREDS message.  Then\r
+    the plug-in should remove the reference with a call to\r
+    khui_cw_del_type() while processing ::KMSG_CRED_END.\r
+\r
     \see khui_cw_del_type()\r
     \see \ref cred_acq_panel_spec\r
     \see ::khui_new_cred_panel\r
index 6cf8ae44a0cbb313140295daf85d12c54c5966e5..c9996b31cd1d59ef368ce76a37476fc2b0ca4799 100644 (file)
@@ -247,9 +247,14 @@ perf_dump(char * file) {
     perf_once();\r
 \r
     EnterCriticalSection(&cs_alloc);\r
+#if _MSC_VER >= 1400\r
+    if (fopen_s(&f, file, "w"))\r
+        return;\r
+#else\r
     f = fopen(file, "w");\r
     if (!f)\r
-        return;\r
+       return;\r
+#endif\r
 \r
     fprintf(f, "Leaked allocations list ....\n");\r
     fprintf(f, "File\tLine\tThread\tSize\n");\r