gss-token: implement -S to split tokens up on output.
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
.Fl r
|
.Fl r
|
||||||
.Op Fl MNln
|
.Op Fl MNln
|
||||||
.Op Fl C Ar ccache
|
.Op Fl C Ar ccache
|
||||||
|
.Op Fl S Ar maxsize
|
||||||
.Op Fl c count
|
.Op Fl c count
|
||||||
.Op Ar service@host
|
.Op Ar service@host
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@@ -52,6 +53,11 @@ This can be used to load test the KDC.
|
|||||||
prepend
|
prepend
|
||||||
.Dq Negotiate\
|
.Dq Negotiate\
|
||||||
to generated tokens and expect it on consumed tokens.
|
to generated tokens and expect it on consumed tokens.
|
||||||
|
.It Fl S Ar maxsize
|
||||||
|
split each token that is generated into components of maximum
|
||||||
|
size
|
||||||
|
.Ar maxsize .
|
||||||
|
Each token is base64 encoded and output separately.
|
||||||
.It Fl c Ar count
|
.It Fl c Ar count
|
||||||
repeat the operation
|
repeat the operation
|
||||||
.Ar count
|
.Ar count
|
||||||
|
@@ -89,6 +89,7 @@
|
|||||||
* global variables
|
* global variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int Sflag = 0;
|
||||||
int nflag = 0;
|
int nflag = 0;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@@ -207,18 +208,35 @@ write_token(gss_buffer_t out, int negotiate)
|
|||||||
char *outstr = NULL;
|
char *outstr = NULL;
|
||||||
char *p = out->value;
|
char *p = out->value;
|
||||||
size_t len = out->length;
|
size_t len = out->length;
|
||||||
|
size_t inc;
|
||||||
int ret;
|
int ret;
|
||||||
|
int first = 1;
|
||||||
|
|
||||||
if (nflag)
|
if (nflag)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ret = rk_base64_encode(p, len, &outstr);
|
inc = len;
|
||||||
|
if (Sflag)
|
||||||
|
inc = Sflag;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (first)
|
||||||
|
first = 0;
|
||||||
|
else
|
||||||
|
printf("\n");
|
||||||
|
if (len < inc)
|
||||||
|
inc = len;
|
||||||
|
ret = rk_base64_encode(p, inc, &outstr);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Out of memory.\n");
|
fprintf(stderr, "Out of memory.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("%s%s\n", negotiate?"Negotiate ":"", outstr);
|
printf("%s%s\n", negotiate?"Negotiate ":"", outstr);
|
||||||
free(outstr);
|
free(outstr);
|
||||||
|
p += inc;
|
||||||
|
len -= inc;
|
||||||
|
} while (len > 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,6 +546,7 @@ main(int argc, char **argv)
|
|||||||
{ NULL, 'D', arg_flag, &Dflag, NULL, NULL },
|
{ NULL, 'D', arg_flag, &Dflag, NULL, NULL },
|
||||||
{ NULL, 'M', arg_flag, &Mflag, NULL, NULL },
|
{ NULL, 'M', arg_flag, &Mflag, NULL, NULL },
|
||||||
{ NULL, 'N', arg_flag, &Nflag, NULL, NULL },
|
{ NULL, 'N', arg_flag, &Nflag, NULL, NULL },
|
||||||
|
{ NULL, 'S', arg_integer, &Sflag, NULL, NULL },
|
||||||
{ NULL, 'c', arg_integer, &count, NULL, NULL },
|
{ NULL, 'c', arg_integer, &count, NULL, NULL },
|
||||||
{ NULL, 'l', arg_flag, &lflag, NULL, NULL },
|
{ NULL, 'l', arg_flag, &lflag, NULL, NULL },
|
||||||
{ NULL, 'n', arg_flag, &nflag, NULL, NULL },
|
{ NULL, 'n', arg_flag, &nflag, NULL, NULL },
|
||||||
|
Reference in New Issue
Block a user