summaryrefslogtreecommitdiffstats
path: root/src/ccapi/test/test_ccapi_context.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-03-31 00:38:20 +0000
committerGreg Hudson <ghudson@mit.edu>2012-03-31 00:38:20 +0000
commitc49954a13ec5ebfecc20b25f68649983522adb03 (patch)
tree998cb1bc55110c7a1b141c9ca3fa6badd8deb40c /src/ccapi/test/test_ccapi_context.c
parent4ce0974b4d5c37b22ceedb5aa7115eedcfc486ef (diff)
Fix data handling in rd_req_decoded_opt
We shouldn't peer at trans->tr_contents.data[0] if trans->tr_contents.length is 0, even if the data field is non-null. Harmless as long as the ASN.1 decoder uses null data fields for empty krb5_data values, but still wrong. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25797 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/test/test_ccapi_context.c')
0 files changed, 0 insertions, 0 deletions
href='#n126'>126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
@value{PRODUCT} uses a configuration system built using the Free
Software Foundation's @samp{autoconf} program.  This system makes
Kerberos V5 much simpler to build and reduces the amount of effort
required in porting Kerberos V5 to a new platform.

@menu
* Organization of the Source Directory::  Description of the source tree.
* Build Requirements::          How much disk space, etc. you need to
                                           build Kerberos.
* Unpacking the Sources::       Preparing the source tree.
* Doing the Build::             Compiling Kerberos.
* Installing the Binaries::     Installing the compiled binaries.
* Testing the Build::           Making sure Kerberos built correctly.
* Options to Configure::        Command-line options to Configure
* osconf.h::                    Header file-specific configurations
* Shared Library Support::      Building Shared Libraries for Kerberos V5
* OS Incompatibilities::        Special cases to watch for.
* Using Autoconf::              Modifying Kerberos V5's 
                                            configuration scripts.
@end menu

@node Organization of the Source Directory, Build Requirements, Building Kerberos V5, Building Kerberos V5
@section Organization of the Source Directory

Below is a brief overview of the organization of the complete source
directory.  More detailed descriptions follow.

@table @b
@itemx appl
applications with @value{PRODUCT} extensions
@itemx clients
@value{PRODUCT} user programs
@itemx gen-manpages
manpages for @value{PRODUCT} and the @value{PRODUCT} login program
@itemx include
include files
@itemx kadmin
administrative interface to the Kerberos master database
@itemx kdc
the @value{PRODUCT} Authentication Service and Key Distribution Center
@itemx krb524
utilities for converting between Kerberos 4 and Kerberos 5
@itemx lib
libraries for use with/by @value{PRODUCT}
@itemx mac
source code for building @value{PRODUCT} on MacOS
@itemx prototype
templates for source code files
@itemx slave
utilities for propagating the database to slave KDCs
@itemx tests
test suite
@itemx util
various utilities for building/configuring the code, sending bug reports, etc.
@itemx windows
source code for building @value{PRODUCT} on Windows (see windows/README)
@end table

@menu
* The appl Directory::          
* The clients Directory::       
* The gen-manpages Directory::  
* The include Directory::       
* The kadmin Directory::        
* The kdc Directory::           
* The krb524 Directory::        
* The lib Directory::           
* The prototype Directory::     
* The slave Directory::         
* The util Directory::          
@end menu

@node The appl Directory, The clients Directory, Organization of the Source Directory, Organization of the Source Directory
@subsection The appl Directory

The Kerberos release provides certain UNIX utilities, modified to use
Kerberos authentication.  In the @i{appl/bsd} directory are the
Berkeley utilities @i{login}, @i{rlogin}, @i{rsh}, and @i{rcp}, as well as
the associated daemons @i{kshd} and @i{klogind}.  The @i{login} program
obtains ticket-granting tickets for users upon login; the other utilities
provide authenticated Unix network services.

The @i{appl} directory also contains Kerberized telnet and ftp programs,
as well as sample Kerberos application client and server programs.

@node The clients Directory, The gen-manpages Directory, The appl Directory, Organization of the Source Directory
@subsection The clients Directory

This directory contains the code for several user-oriented programs.

@table @b
@itemx kdestroy
This program destroys the user's active Kerberos authorization tickets.
@value{COMPANY} recommends that users @code{kdestroy} before logging out.

@itemx kinit
This program prompts users for their Kerberos principal name and password,
and attempts to get an initial ticket-granting-ticket for that principal.

@itemx klist
This program lists the Kerberos principal and Kerberos tickets held in
a credentials cache, or the keys held in a keytab file.

@itemx kpasswd
This program changes a user's Kerberos password.

@itemx ksu
This program is a Kerberized version of the @code{su} program that is
meant to securely change the real and effective user ID to that of the
target user and to create a new security context.

@itemx kvno
This program acquires a service ticket for the specified Kerberos
principals and prints out the key version numbers of each.
@end table

@node The gen-manpages Directory, The include Directory, The clients Directory, Organization of the Source Directory
@subsection The gen-manpages Directory

There are two manual pages in this directory.  One is an introduction
to the Kerberos system.  The other describes the @code{.k5login} file
which allows users to give access with their UID to other users
authenticated by the Kerberos system.

@node The include Directory, The kadmin Directory, The gen-manpages Directory, Organization of the Source Directory
@subsection The include Directory

This directory contains the @i{include} files needed to build the
Kerberos system.

@node The kadmin Directory, The kdc Directory, The include Directory, Organization of the Source Directory
@subsection The kadmin Directory

In this directory is the code for the utilities @code{kadmin},
@code{kadmin.local}, @code{kdb5_util}, and @code{ktutil}.
@code{ktutil} is the Kerberos keytab file maintenance utility from
which a Kerberos administrator can read, write, or edit entries in a
Kerberos V5 keytab or Kerberos V4 srvtab.  @code{kadmin} and
@code{kadmin.local} are command-line interfaces to the Kerberos V5 KADM5
administration system.  @code{kadmin.local} runs on the master KDC and
does not use Kerberos to authenticate to the database, while
@code{kadmin} uses Kerberos authentication and an encrypted RPC.  The
two provide identical functionalities, which allow administrators to
modify the database of Kerberos principals.  @code{kdb5_util} allows
administrators to perform low-level maintenance procedures on Kerberos
and the KADM5 database.  With this utility, databases can be created,
destroyed, or dumped to and loaded from ASCII files.  It can also be
used to create master key stash files.

@node The kdc Directory, The krb524 Directory, The kadmin Directory, Organization of the Source Directory
@subsection The kdc Directory

This directory contains the code for the @code{krb5kdc} daemon, the
Kerberos Authentication Service and Key Distribution Center.

@node The krb524 Directory, The lib Directory, The kdc Directory, Organization of the Source Directory
@subsection The krb524 Directory

This directory contains the code for @code{krb524}, a service that
converts Kerberos V5 credentials into Kerberos V4 credentials suitable
for use with applications that for whatever reason do not use V5
directly.

@node The lib Directory, The prototype Directory, The krb524 Directory, Organization of the Source Directory
@subsection The lib Directory

The @i{lib} directory contain 10 subdirectories as well as some
definition and glue files.  The @i{crypto} subdirectory contains the
Kerberos V5 encryption library.  The @i{des425} subdirectory exports
the Kerberos V4 encryption API, and translates these functions into
calls to the Kerberos V5 encryption API.  The @i{gssapi} library
contains the Generic Security Services API, which is a library of
commands to be used in secure client-server communication.  The
@i{kadm5} directory contains the libraries for the KADM5 administration
utilities.  The Kerberos 5 database libraries are contained in
@i{kdb}.  The directories @i{krb4} and @i{krb5} contain the Kerberos 4
and Kerberos 5 APIs, respectively.  The @i{rpc} directory contains the
API for the Kerberos Remote Procedure Call protocol.

@node The prototype Directory, The slave Directory, The lib Directory, Organization of the Source Directory
@subsection The prototype Directory

This directory contains several template files.  The @code{prototype.h}
and @code{prototype.c} files contain the MIT copyright message and a
placeholder for the title and description of the file.
@code{prototype.h} also has a short template for writing @code{ifdef}
and @code{ifndef} preprocessor statements.  The @code{getopt.c} file
provides a template for writing code that will parse the options with
which a program was called.

@node The slave Directory, The util Directory, The prototype Directory, Organization of the Source Directory
@subsection The slave Directory

This directory contains code which allows for the propagation of the
Kerberos principal database from the master KDC to slave KDCs over an
encrypted, secure channel.  @code{kprop} is the program which actually
propagates the database dump file.  @code{kpropd} is the Kerberos V5
slave KDC update server which accepts connections from the @code{kprop}
program.  @code{kslave_update} is a script that takes the name of a
slave server, and propagates the database to that server if the
database has been modified since the last dump or if the database has
been dumped since the last propagation.

@node The util Directory,  , The slave Directory, Organization of the Source Directory
@subsection The util Directory

This directory contains several utility programs and libraries.  The
programs used to configure and build the code, such as @code{autoconf},
@code{lndir}, @code{kbuild}, @code{reconf},  and @code{makedepend},
are in this directory.  The @i{profile} directory contains most of the
functions which parse the Kerberos configuration files (@code{krb5.conf}
and @code{kdc.conf}).  Also in this directory are the Kerberos error table
library and utilities (@i{et}), the Sub-system library and utilities
(@i{ss}), database utilities (@i{db2}), pseudo-terminal utilities
(@i{pty}), bug-reporting program @code{send-pr}, and a generic
support library @code{support} used by several of our other libraries.

@node Build Requirements, Unpacking the Sources, Organization of the Source Directory, Building Kerberos V5
@section Build Requirements

In order to build Kerberos V5, you will need approximately 60-70
megabytes of disk space.  The exact amount will vary depending on the
platform and whether the distribution is compiled with debugging symbol
tables or not.

Your C compiler must conform to ANSI C (ISO/IEC 9899:1990, ``c89'').
Some operating systems do not have an ANSI C compiler, or their
default compiler requires extra command-line options to enable ANSI C
conformance.

If you wish to keep a separate @dfn{build tree}, which contains the compiled
@file{*.o} file and executables, separate from your source tree, you
will need a @samp{make} program which supports @samp{VPATH}, or
you will need to use a tool such as @samp{lndir} to produce a symbolic
link tree for your build tree.

@c Library support...

@node Unpacking the Sources, Doing the Build, Build Requirements, Building Kerberos V5
@section Unpacking the Sources

The first step in each of these build procedures is to unpack the
source distribution.  The Kerberos V5 distribution comes in a tar file,
generally named @file{krb5-@value{RELEASE}.tar}, which contains a
compressed tar file consisting of the sources for all of Kerberos
(generally @file{krb5-@value{RELEASE}.tar.gz}) and a PGP signature for
this source tree (generally @file{krb5-@value{RELEASE}.tar.gz.asc}).
@value{COMPANY} highly recommends that you verify the integrity of the
source code using this signature.

Unpack the compressed tar file in some directory, such as
@file{/u1/krb5-@value{RELEASE}}.  (In the rest of this document, we
will assume that you have chosen to unpack the Kerberos V5 source
distribution in this directory.  Note that the tarfiles will by default
all unpack into the @file{./krb5-@value{RELEASE}} directory, so that if
your current directory is @file{/u1} when you unpack the tarfiles, you
will get @file{/u1/krb5-@value{RELEASE}/src}, etc.)


@node Doing the Build, Installing the Binaries, Unpacking the Sources, Building Kerberos V5
@section Doing the Build

You have a number of different options in how to build Kerberos.  If you
only need to build Kerberos for one platform, using a single directory
tree which contains both the source files and the object files is the
simplest.  However, if you need to maintain Kerberos for a large number
of platforms, you will probably want to use separate build trees for
each platform. We recommend that you look at @ref{OS
Incompatibilities}, for notes that we have on particular operating
systems. 

@menu
* Building Within a Single Tree::  
* Building with Separate Build Directories::  
* Building using lndir::        
@end menu

@node Building Within a Single Tree, Building with Separate Build Directories, Doing the Build, Doing the Build
@subsection Building Within a Single Tree

If you don't want separate build trees for each architecture, then
use the following abbreviated procedure.

@enumerate
@item
 @code{cd /u1/krb5-@value{RELEASE}/src}
@item
 @code{./configure}
@item
 @code{make}
@end enumerate

That's it!

@node Building with Separate Build Directories, Building using lndir, Building Within a Single Tree, Doing the Build
@subsection Building with Separate Build Directories

If you wish to keep separate build directories for each platform, you
can do so using the following procedure.  (Note, this requires that your
@samp{make} program support @samp{VPATH}.  GNU's make will provide this
functionality, for example.)  If your @samp{make} program does not
support this, see the next section.

For example, if you wish to create a build directory for @code{pmax} binaries
you might use the following procedure:

@enumerate
@item 
@code{mkdir /u1/krb5-@value{RELEASE}/pmax}
@item
 @code{cd /u1/krb5-@value{RELEASE}/pmax}
@item
 @code{../src/configure}
@item
 @code{make}
@end enumerate

@node Building using lndir,  , Building with Separate Build Directories, Doing the Build
@subsection Building Using @samp{lndir}

If you wish to keep separate build directories for each platform, and
you do not have access to a @samp{make} program which supports @samp{VPATH},
all is not lost.  You can use the @samp{lndir} program to create
symbolic link trees in your build directory.

For example, if you wish to create a build directory for solaris binaries
you might use the following procedure:

@enumerate
@item
 @code{mkdir /u1/krb5-@value{RELEASE}/solaris}
@item
 @code{cd /u1/krb5-@value{RELEASE}/solaris}
@item
 @code{/u1/krb5-@value{RELEASE}/src/util/lndir `pwd`/../src}
@item
 @code{./configure}
@item
 @code{make}
@end enumerate

You must give an absolute pathname to @samp{lndir} because it has a bug that
makes it fail for relative pathnames. Note that this version differs
from the latest version as distributed and installed by the XConsortium
with X11R6. Either version should be acceptable.

@node Installing the Binaries, Testing the Build, Doing the Build, Building Kerberos V5
@section Installing the Binaries

Once you have built Kerberos, you should install the binaries.  You
can do this by running:

@example
% make install
@end example

If you want to install the binaries into a destination directory that
is not their final destination, which may be convenient if you want to
build a binary distribution to be deployed on multiple hosts, you may
use:

@example
% make install DESTDIR=/path/to/destdir
@end example

This will install the binaries under @code{DESTDIR/PREFIX}, e.g., the
user programs will install into @code{DESTDIR/PREFIX/bin}, the
libraries into @code{DESTDIR/PREFIX/lib}, etc.

Note that if you want to test the build (see @ref{Testing the Build}),
you usually do not need to do a @code{make install} first.

Some implementations of @samp{make} allow multiple commands to be run in
parallel, for faster builds.  We test our Makefiles in parallel builds with
GNU @samp{make} only; they may not be compatible with other parallel build
implementations.

@node Testing the Build, Options to Configure, Installing the Binaries, Building Kerberos V5
@section Testing the Build

The Kerberos V5 distribution comes with built-in regression tests.  To
run them, simply type the following command while in the top-level build
directory (i.e., the directory where you sent typed @samp{make} to start
building Kerberos; see @ref{Doing the Build}.): 

@example
% make check
@end example

However, there are several prerequisites that must be satisfied first:

@itemize @bullet
@item
Configure and build Kerberos with Tcl support.  Tcl is used to drive the
test suite.  This often means passing @code{--with-tcl} to configure to
tell it the location of the Tcl configuration script.  (See
@xref{Options to Configure}.)

@item
You have to run @samp{make install} before running @samp{make check}, or
the test suite will often pick up the installed version of Kerberos
rather than the newly built one.  You can install into a prefix that
isn't in the system library search path, though.  This theoretically
could be fixed with the appropriate environment variable magic in the
test suite, but hasn't been yet.

@item
In order to test the RPC layer, the local system has to be running the
@command{portmap} daemon and it has to be listening to the regular
network interface (not just localhost).
@end itemize

@menu
* The DejaGnu Tests::           
* The KADM5 Tests::             
@end menu

@node The DejaGnu Tests, The KADM5 Tests, Testing the Build, Testing the Build
@subsection The DejaGnu Tests 

Some of the built-in regression tests are setup to use the DejaGnu
framework for running tests. These tests tend to be more comprehensive
than the normal built-in tests as they setup test servers and test
client/server activities. 

DejaGnu may be found wherever GNU software is archived.  

Most of the tests are setup to run as a non-privileged user.  For some
of the krb-root tests to work properly, either (a) the user running the
tests must not have a .k5login file in the home directory or (b) the
.k5login file must contain an entry for @code{<username>@@KRBTEST.COM}.
There are two series of tests (@samp{rlogind} and @samp{telnetd}) which
require the ability to @samp{rlogin} as root to the local
machine. Admittedly, this does require the use of a @file{.rhosts} file
or some authenticated means. @footnote{If you are fortunate enough to
have a previous version of Kerberos V5 or V4 installed, and the Kerberos
rlogin is first in your path, you can setup @file{.k5login} or
@file{.klogin} respectively to allow you access.}

If you cannot obtain root access to your machine, all the other tests
will still run. Note however, with DejaGnu 1.2, the "untested testcases"
will cause the testsuite to exit with a non-zero exit status which
@samp{make} will consider a failure of the testing process. Do not worry
about this, as these tests are the last run when @samp{make check} is
executed from the top level of the build tree.  This problem does not
exist with DejaGnu 1.3.

@node The KADM5 Tests,  , The DejaGnu Tests, Testing the Build
@subsection The KADM5 Tests

Regression tests for the KADM5 system, including the GSS-RPC, KADM5
client and server libraries, and kpasswd, are also included in this
release.  Each set of KADM5 tests is contained in a sub-directory called
@code{unit-test} directly below the system being tested.  For example,
lib/rpc/unit-test contains the tests for GSS-RPC.  The tests are all
based on DejaGnu (but they are not actually called part of "The DejaGnu
tests," whose naming predates the inclusion of the KADM5 system).  In
addition, they require the Tool Command Language (TCL) header files and
libraries to be available during compilation and some of the tests also
require Perl in order to operate.  If all of these resources are not
available during configuration, the KADM5 tests will not run.  The TCL
installation directory can be specified with the @code{--with-tcl}
configure option.  (See @xref{Options to Configure}.)  The runtest and
perl programs must be in the current execution path.