diff options
Diffstat (limited to 'src/widget-authen.c')
| -rw-r--r-- | src/widget-authen.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/src/widget-authen.c b/src/widget-authen.c new file mode 100644 index 0000000..dbbd9c0 --- /dev/null +++ b/src/widget-authen.c | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* | ||
| 2 | * Tiny TACACS+ Client Library | ||
| 3 | * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * * Neither the name of David M. Syzdek nor the | ||
| 16 | * names of its contributors may be used to endorse or promote products | ||
| 17 | * derived from this software without specific prior written permission. | ||
| 18 | * | ||
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR | ||
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 29 | * SUCH DAMAGE. | ||
| 30 | */ | ||
| 31 | #define _SRC_TTU_WIDGET_AUTHEN_C 1 | ||
| 32 | #include "tinytacutil.h" | ||
| 33 | |||
| 34 | /////////////// | ||
| 35 | // // | ||
| 36 | // Headers // | ||
| 37 | // // | ||
| 38 | /////////////// | ||
| 39 | #pragma mark - Headers | ||
| 40 | |||
| 41 | #include <stdio.h> | ||
| 42 | #include <stdlib.h> | ||
| 43 | #include <string.h> | ||
| 44 | #include <strings.h> | ||
| 45 | #include <unistd.h> | ||
| 46 | #include <getopt.h> | ||
| 47 | #include <unistd.h> | ||
| 48 | #include <assert.h> | ||
| 49 | #include <errno.h> | ||
| 50 | |||
| 51 | #include <tinytac.h> | ||
| 52 | #ifdef HAVE_BINDLE_PREFIX_H | ||
| 53 | # include <bindle_prefix.h> | ||
| 54 | #else | ||
| 55 | # include <bindle.h> | ||
| 56 | #endif | ||
| 57 | |||
| 58 | |||
| 59 | /////////////////// | ||
| 60 | // // | ||
| 61 | // Definitions // | ||
| 62 | // // | ||
| 63 | /////////////////// | ||
| 64 | #pragma mark - Definitions | ||
| 65 | |||
| 66 | |||
| 67 | ////////////////// | ||
| 68 | // // | ||
| 69 | // Data Types // | ||
| 70 | // // | ||
| 71 | ////////////////// | ||
| 72 | #pragma mark - Data Types | ||
| 73 | |||
| 74 | |||
| 75 | ////////////////// | ||
| 76 | // // | ||
| 77 | // Prototypes // | ||
| 78 | // // | ||
| 79 | ////////////////// | ||
| 80 | #pragma mark - Prototypes | ||
| 81 | |||
| 82 | |||
| 83 | ///////////////// | ||
| 84 | // // | ||
| 85 | // Variables // | ||
| 86 | // // | ||
| 87 | ///////////////// | ||
| 88 | #pragma mark - Variables | ||
| 89 | |||
| 90 | |||
| 91 | ///////////////// | ||
| 92 | // // | ||
| 93 | // Functions // | ||
| 94 | // // | ||
| 95 | ///////////////// | ||
| 96 | #pragma mark - Functions | ||
| 97 | |||
| 98 | int | ||
| 99 | ttu_widget_authen( | ||
| 100 | ttu_config_t * cnf ) | ||
| 101 | { | ||
| 102 | int rc; | ||
| 103 | |||
| 104 | assert(cnf != NULL); | ||
| 105 | |||
| 106 | // initial processing of cli arguments | ||
| 107 | if ((rc = ttu_cli_arguments(cnf, cnf->argc, cnf->argv)) != 0) | ||
| 108 | return((rc == -1) ? 0 : 1); | ||
| 109 | if ((ttu_password(cnf))) | ||
| 110 | return(1); | ||
| 111 | if (!(cnf->pass)) | ||
| 112 | { | ||
| 113 | fprintf(stderr, "%s: missing required argument -W, -w, or -y\n", cnf->prog_name); | ||
| 114 | fprintf(stderr, "Try `%s --help' for more information.\n", cnf->prog_name); | ||
| 115 | return(1); | ||
| 116 | }; | ||
| 117 | |||
| 118 | return(0); | ||
| 119 | } | ||
| 120 | |||
| 121 | |||
| 122 | /* end of source */ | ||
