remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
54
admin/add.c
54
admin/add.c
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -104,7 +104,7 @@ kt_add(struct add_options *opt, int argc, char **argv)
|
||||
if (opt->hex_flag) {
|
||||
size_t len;
|
||||
void *data;
|
||||
|
||||
|
||||
len = (strlen(opt->password_string) + 1) / 2;
|
||||
|
||||
data = malloc(len);
|
||||
@@ -119,7 +119,7 @@ kt_add(struct add_options *opt, int argc, char **argv)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = krb5_keyblock_init(context, enctype,
|
||||
ret = krb5_keyblock_init(context, enctype,
|
||||
data, len, &entry.keyblock);
|
||||
free(data);
|
||||
} else if (!opt->salt_flag) {
|
||||
@@ -134,7 +134,7 @@ kt_add(struct add_options *opt, int argc, char **argv)
|
||||
ret = krb5_string_to_key_data_salt(context, enctype, pw, salt,
|
||||
&entry.keyblock);
|
||||
} else {
|
||||
ret = krb5_string_to_key(context, enctype, opt->password_string,
|
||||
ret = krb5_string_to_key(context, enctype, opt->password_string,
|
||||
entry.principal, &entry.keyblock);
|
||||
}
|
||||
memset (opt->password_string, 0, strlen(opt->password_string));
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -65,7 +65,7 @@ change_entry (krb5_keytab keytab,
|
||||
return ENOMEM;
|
||||
}
|
||||
conf.mask |= KADM5_CONFIG_REALM;
|
||||
|
||||
|
||||
if (admin_server) {
|
||||
conf.admin_server = strdup(admin_server);
|
||||
if (conf.admin_server == NULL) {
|
||||
@@ -73,7 +73,7 @@ change_entry (krb5_keytab keytab,
|
||||
free(conf.realm);
|
||||
krb5_set_error_message(context, ENOMEM, "malloc failed");
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
conf.mask |= KADM5_CONFIG_ADMIN_SERVER;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ kt_change (struct change_options *opt, int argc, char **argv)
|
||||
int i, j, max;
|
||||
struct change_set *changeset;
|
||||
int errors = 0;
|
||||
|
||||
|
||||
if((keytab = ktutil_open_keytab()) == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -222,20 +222,20 @@ kt_change (struct change_options *opt, int argc, char **argv)
|
||||
if (verbose_flag) {
|
||||
char *client_name;
|
||||
|
||||
ret = krb5_unparse_name (context, changeset[i].principal,
|
||||
ret = krb5_unparse_name (context, changeset[i].principal,
|
||||
&client_name);
|
||||
if (ret) {
|
||||
krb5_warn (context, ret, "krb5_unparse_name");
|
||||
} else {
|
||||
printf("Changing %s kvno %d\n",
|
||||
printf("Changing %s kvno %d\n",
|
||||
client_name, changeset[i].kvno);
|
||||
free(client_name);
|
||||
}
|
||||
}
|
||||
ret = change_entry (keytab,
|
||||
ret = change_entry (keytab,
|
||||
changeset[i].principal, changeset[i].kvno,
|
||||
opt->realm_string,
|
||||
opt->admin_server_string,
|
||||
opt->realm_string,
|
||||
opt->admin_server_string,
|
||||
opt->server_port_integer);
|
||||
if (ret != 0)
|
||||
errors = 1;
|
||||
|
62
admin/copy.c
62
admin/copy.c
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -90,9 +90,9 @@ kt_copy_int (const char *from, const char *to)
|
||||
krb5_warn(context, ret, "krb5_enctype_to_string");
|
||||
etype_str = NULL; /* XXX */
|
||||
}
|
||||
ret = krb5_kt_get_entry(context, dst_keytab,
|
||||
entry.principal,
|
||||
entry.vno,
|
||||
ret = krb5_kt_get_entry(context, dst_keytab,
|
||||
entry.principal,
|
||||
entry.vno,
|
||||
entry.keyblock.keytype,
|
||||
&dummy);
|
||||
if(ret == 0) {
|
||||
@@ -101,7 +101,7 @@ kt_copy_int (const char *from, const char *to)
|
||||
is weird, so complain about that */
|
||||
if(!compare_keyblock(&entry.keyblock, &dummy.keyblock)) {
|
||||
krb5_warnx(context, "entry with different keyvalue "
|
||||
"already exists for %s, keytype %s, kvno %d",
|
||||
"already exists for %s, keytype %s, kvno %d",
|
||||
name_str, etype_str, entry.vno);
|
||||
}
|
||||
krb5_kt_free_entry(context, &dummy);
|
||||
@@ -110,7 +110,7 @@ kt_copy_int (const char *from, const char *to)
|
||||
free(etype_str);
|
||||
continue;
|
||||
} else if(ret != KRB5_KT_NOTFOUND) {
|
||||
krb5_warn (context, ret, "%s: fetching %s/%s/%u",
|
||||
krb5_warn (context, ret, "%s: fetching %s/%s/%u",
|
||||
to, name_str, etype_str, entry.vno);
|
||||
krb5_kt_free_entry (context, &entry);
|
||||
free(name_str);
|
||||
@@ -118,12 +118,12 @@ kt_copy_int (const char *from, const char *to)
|
||||
break;
|
||||
}
|
||||
if (verbose_flag)
|
||||
fprintf (stderr, "copying %s, keytype %s, kvno %d\n", name_str,
|
||||
fprintf (stderr, "copying %s, keytype %s, kvno %d\n", name_str,
|
||||
etype_str, entry.vno);
|
||||
ret = krb5_kt_add_entry (context, dst_keytab, &entry);
|
||||
krb5_kt_free_entry (context, &entry);
|
||||
if (ret) {
|
||||
krb5_warn (context, ret, "%s: adding %s/%s/%u",
|
||||
krb5_warn (context, ret, "%s: adding %s/%s/%u",
|
||||
to, name_str, etype_str, entry.vno);
|
||||
free(name_str);
|
||||
free(etype_str);
|
||||
|
74
admin/get.c
74
admin/get.c
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -37,8 +37,8 @@ RCSID("$Id$");
|
||||
|
||||
static void*
|
||||
open_kadmin_connection(char *principal,
|
||||
const char *realm,
|
||||
char *admin_server,
|
||||
const char *realm,
|
||||
char *admin_server,
|
||||
int server_port)
|
||||
{
|
||||
static kadm5_config_params conf;
|
||||
@@ -54,7 +54,7 @@ open_kadmin_connection(char *principal,
|
||||
}
|
||||
conf.mask |= KADM5_CONFIG_REALM;
|
||||
}
|
||||
|
||||
|
||||
if (admin_server) {
|
||||
conf.admin_server = admin_server;
|
||||
conf.mask |= KADM5_CONFIG_ADMIN_SERVER;
|
||||
@@ -68,11 +68,11 @@ open_kadmin_connection(char *principal,
|
||||
/* should get realm from each principal, instead of doing
|
||||
everything with the same (local) realm */
|
||||
|
||||
ret = kadm5_init_with_password_ctx(context,
|
||||
ret = kadm5_init_with_password_ctx(context,
|
||||
principal,
|
||||
NULL,
|
||||
KADM5_ADMIN_SERVICE,
|
||||
&conf, 0, 0,
|
||||
&conf, 0, 0,
|
||||
&kadm_handle);
|
||||
free(conf.realm);
|
||||
if(ret) {
|
||||
@@ -92,7 +92,7 @@ kt_get(struct get_options *opt, int argc, char **argv)
|
||||
size_t netypes = 0;
|
||||
int i, j;
|
||||
unsigned int failed = 0;
|
||||
|
||||
|
||||
if((keytab = ktutil_open_keytab()) == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -108,8 +108,8 @@ kt_get(struct get_options *opt, int argc, char **argv)
|
||||
}
|
||||
netypes = opt->enctypes_strings.num_strings;
|
||||
for(i = 0; i < netypes; i++) {
|
||||
ret = krb5_string_to_enctype(context,
|
||||
opt->enctypes_strings.strings[i],
|
||||
ret = krb5_string_to_enctype(context,
|
||||
opt->enctypes_strings.strings[i],
|
||||
&etypes[i]);
|
||||
if(ret) {
|
||||
krb5_warnx(context, "unrecognized enctype: %s",
|
||||
@@ -119,7 +119,7 @@ kt_get(struct get_options *opt, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < argc; i++){
|
||||
krb5_principal princ_ent;
|
||||
kadm5_principal_ent_rec princ;
|
||||
@@ -149,9 +149,9 @@ kt_get(struct get_options *opt, int argc, char **argv)
|
||||
r = opt->realm_string;
|
||||
else
|
||||
r = krb5_principal_get_realm(context, princ_ent);
|
||||
kadm_handle = open_kadmin_connection(opt->principal_string,
|
||||
r,
|
||||
opt->admin_server_string,
|
||||
kadm_handle = open_kadmin_connection(opt->principal_string,
|
||||
r,
|
||||
opt->admin_server_string,
|
||||
opt->server_port_integer);
|
||||
if(kadm_handle == NULL)
|
||||
break;
|
||||
@@ -174,7 +174,7 @@ kt_get(struct get_options *opt, int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = kadm5_get_principal(kadm_handle, princ_ent, &princ,
|
||||
ret = kadm5_get_principal(kadm_handle, princ_ent, &princ,
|
||||
KADM5_PRINCIPAL | KADM5_KVNO | KADM5_ATTRIBUTES);
|
||||
if (ret) {
|
||||
krb5_warn(context, ret, "kadm5_get_principal(%s)", argv[i]);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -39,33 +39,33 @@ RCSID("$Id$");
|
||||
static int help_flag;
|
||||
static int version_flag;
|
||||
int verbose_flag;
|
||||
char *keytab_string;
|
||||
char *keytab_string;
|
||||
static char keytab_buf[256];
|
||||
|
||||
static struct getargs args[] = {
|
||||
{
|
||||
{
|
||||
"version",
|
||||
0,
|
||||
arg_flag,
|
||||
&version_flag,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"help",
|
||||
'h',
|
||||
arg_flag,
|
||||
&help_flag,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"keytab",
|
||||
'k',
|
||||
arg_string,
|
||||
&keytab_string,
|
||||
"keytab",
|
||||
"keytab to operate on"
|
||||
{
|
||||
"help",
|
||||
'h',
|
||||
arg_flag,
|
||||
&help_flag,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"keytab",
|
||||
'k',
|
||||
arg_string,
|
||||
&keytab_string,
|
||||
"keytab",
|
||||
"keytab to operate on"
|
||||
},
|
||||
{
|
||||
"verbose",
|
||||
|
@@ -1,37 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
extern krb5_context context;
|
||||
|
||||
extern int verbose_flag;
|
||||
extern char *keytab_string;
|
||||
extern char *keytab_string;
|
||||
|
||||
krb5_keytab ktutil_open_keytab(void);
|
||||
|
||||
|
56
admin/list.c
56
admin/list.c
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -51,7 +51,7 @@ do_list(struct list_options *opt, const char *keytab_str)
|
||||
char buf[1024];
|
||||
keytab_str += 4;
|
||||
ret = 0;
|
||||
while (strsep_copy((const char**)&keytab_str, ",",
|
||||
while (strsep_copy((const char**)&keytab_str, ",",
|
||||
buf, sizeof(buf)) != -1) {
|
||||
if(flag)
|
||||
printf("\n");
|
||||
@@ -93,7 +93,7 @@ do_list(struct list_options *opt, const char *keytab_str)
|
||||
snprintf(buf, sizeof(buf), "%d", entry.vno);
|
||||
rtbl_add_column_entry_by_id(table, 0, buf);
|
||||
|
||||
ret = krb5_enctype_to_string(context,
|
||||
ret = krb5_enctype_to_string(context,
|
||||
entry.keyblock.keytype, &s);
|
||||
if (ret != 0) {
|
||||
snprintf(buf, sizeof(buf), "unknown (%d)", entry.keyblock.keytype);
|
||||
@@ -107,7 +107,7 @@ do_list(struct list_options *opt, const char *keytab_str)
|
||||
rtbl_add_column_entry_by_id(table, 2, buf);
|
||||
|
||||
if (opt->timestamp_flag) {
|
||||
krb5_format_time(context, entry.timestamp, buf,
|
||||
krb5_format_time(context, entry.timestamp, buf,
|
||||
sizeof(buf), FALSE);
|
||||
rtbl_add_column_entry_by_id(table, 3, buf);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ do_list(struct list_options *opt, const char *keytab_str)
|
||||
goto out;
|
||||
}
|
||||
for(i = 0; i < entry.keyblock.keyvalue.length; i++)
|
||||
snprintf(s + 2 * i, 3, "%02x",
|
||||
snprintf(s + 2 * i, 3, "%02x",
|
||||
((unsigned char*)entry.keyblock.keyvalue.data)[i]);
|
||||
rtbl_add_column_entry_by_id(table, 4, s);
|
||||
free(s);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
@@ -66,7 +66,7 @@ kt_remove(struct remove_options *opt, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
if (!principal && !enctype && !opt->kvno_integer) {
|
||||
krb5_warnx(context,
|
||||
krb5_warnx(context,
|
||||
"You must give at least one of "
|
||||
"principal, enctype or kvno.");
|
||||
ret = EINVAL;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ktutil_locl.h"
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2003 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -237,7 +237,7 @@ main(int argc, char **argv)
|
||||
int ret = 0;
|
||||
int failed = 0;
|
||||
struct cell_list *p;
|
||||
|
||||
|
||||
setprogname(argv[0]);
|
||||
|
||||
if(getarg(args, num_args, argc, argv, &optind))
|
||||
@@ -306,7 +306,7 @@ main(int argc, char **argv)
|
||||
afslog_file(argv[i]);
|
||||
else
|
||||
afslog_cell(argv[i], 1);
|
||||
}
|
||||
}
|
||||
if(num == 0) {
|
||||
if(do_afslog(NULL))
|
||||
failed++;
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -141,11 +141,11 @@ main(int argc, char **argv)
|
||||
if (name == NULL)
|
||||
krb5_errx(context, 1, "Failed getting default "
|
||||
"credential cache type");
|
||||
|
||||
|
||||
typename_arg = strdup(name);
|
||||
if (typename_arg == NULL)
|
||||
errx(1, "strdup");
|
||||
|
||||
|
||||
s = strchr(typename_arg, ':');
|
||||
if (s)
|
||||
*s = '\0';
|
||||
@@ -155,7 +155,7 @@ main(int argc, char **argv)
|
||||
if (type == NULL)
|
||||
krb5_err(context, 1, ret, "Failed getting ops for %s "
|
||||
"credential cache", typename_arg);
|
||||
|
||||
|
||||
ret = krb5_cc_gen_new(context, type, &id);
|
||||
if (ret)
|
||||
krb5_err(context, 1, ret, "Failed generating credential cache");
|
||||
@@ -190,7 +190,7 @@ main(int argc, char **argv)
|
||||
if (args == NULL)
|
||||
errx (1, "Out of memory allocating %lu bytes",
|
||||
(unsigned long)((argc + 10)*sizeof(char *)));
|
||||
|
||||
|
||||
if(*argv == NULL) {
|
||||
path = getenv("SHELL");
|
||||
if(path == NULL){
|
||||
@@ -202,7 +202,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
if (path == NULL)
|
||||
errx (1, "Out of memory copying path");
|
||||
|
||||
|
||||
p=strrchr(path, '/');
|
||||
if(p)
|
||||
args[i] = strdup(p+1);
|
||||
@@ -211,7 +211,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (args[i++] == NULL)
|
||||
errx (1, "Out of memory copying arguments");
|
||||
|
||||
|
||||
while(*argv)
|
||||
args[i++] = *argv++;
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* dpagaix.c
|
||||
* On AIX we need to get the kernel extentions
|
||||
* with the DFS kafs_syscall in it.
|
||||
* with the DFS kafs_syscall in it.
|
||||
* We might be running on a system
|
||||
* where DFS is not active.
|
||||
* So we use this dummy routine which
|
||||
* where DFS is not active.
|
||||
* So we use this dummy routine which
|
||||
* might not load to do the dirty work
|
||||
*
|
||||
* DCE does this with the /usr/lib/drivers/dfsloadobj
|
||||
* DCE does this with the /usr/lib/drivers/dfsloadobj
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int dpagaix(parm1, parm2, parm3, parm4, parm5, parm6)
|
||||
int parm1;
|
||||
int parm2;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* dummy K5 routines which are needed to get this to
|
||||
* compile without having access ti the DCE versions
|
||||
/* dummy K5 routines which are needed to get this to
|
||||
* compile without having access ti the DCE versions
|
||||
* of the header files.
|
||||
* Thiis is very crude, and OSF needs to expose the K5
|
||||
* API.
|
||||
@@ -9,7 +9,7 @@
|
||||
/* Transarc obfascates these routines */
|
||||
#ifdef DCE_1_1
|
||||
|
||||
#define krb5_init_ets _dce_PkjKqOaklP
|
||||
#define krb5_init_ets _dce_PkjKqOaklP
|
||||
#define krb5_copy_creds _dce_LuFxPiITzD
|
||||
#define krb5_unparse_name _dce_LWHtAuNgRV
|
||||
#define krb5_get_default_realm _dce_vDruhprWGh
|
||||
@@ -37,17 +37,17 @@
|
||||
#endif
|
||||
|
||||
/* Define the bare minimum k5 structures which are needed
|
||||
* by this program. Since the krb5 includes are not supplied
|
||||
* by this program. Since the krb5 includes are not supplied
|
||||
* with DCE, these were based on the MIT Kerberos 5 beta 3
|
||||
* which should match the DCE as of 1.0.3 at least.
|
||||
* The tricky one is the krb5_creds, since one is allocated
|
||||
* by this program, and it needs access to the client principal
|
||||
* in it.
|
||||
* Note that there are no function prototypes, so there is no
|
||||
* Note that there are no function prototypes, so there is no
|
||||
* compile time checking.
|
||||
* DEE 07/11/95
|
||||
*/
|
||||
#define NPROTOTYPE(x) ()
|
||||
#define NPROTOTYPE(x) ()
|
||||
typedef int krb5_int32; /* assuming all DCE systems are 32 bit */
|
||||
typedef short krb5short; /* assuming short is 16 bit */
|
||||
typedef krb5_int32 krb5_error_code;
|
||||
@@ -126,8 +126,8 @@ typedef struct _krb5_creds {
|
||||
krb5_pointer **authdata;
|
||||
} krb5_creds;
|
||||
|
||||
typedef krb5_pointer krb5_principal;
|
||||
|
||||
typedef krb5_pointer krb5_principal;
|
||||
|
||||
#define KRB5_CC_END 336760974
|
||||
#define KRB5_TC_OPENCLOSE 0x00000001
|
||||
|
||||
|
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* (c) Copyright 1995 HEWLETT-PACKARD COMPANY
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided
|
||||
* "AS IS" without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this
|
||||
* file for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice and this
|
||||
* notice appears in all copies, and that the name of
|
||||
* Hewlett-Packard Company not be used in advertising or
|
||||
* publicity pertaining to distribution of the software
|
||||
* permission to use, copy, modify, and distribute this
|
||||
* file for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice and this
|
||||
* notice appears in all copies, and that the name of
|
||||
* Hewlett-Packard Company not be used in advertising or
|
||||
* publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. Hewlett-
|
||||
* Packard Company makes no representations about the
|
||||
* Packard Company makes no representations about the
|
||||
* suitability of this software for any purpose.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* k5dcecon - Program to convert a K5 TGT to a DCE context,
|
||||
* for use with DFS and its PAG.
|
||||
*
|
||||
* The program is designed to be called as a sub process,
|
||||
* and return via stdout the name of the cache which implies
|
||||
* the PAG which should be used. This program itself does not
|
||||
* use the cache or PAG itself, so the PAG in the kernel for
|
||||
* this program may not be set.
|
||||
*
|
||||
*
|
||||
* The program is designed to be called as a sub process,
|
||||
* and return via stdout the name of the cache which implies
|
||||
* the PAG which should be used. This program itself does not
|
||||
* use the cache or PAG itself, so the PAG in the kernel for
|
||||
* this program may not be set.
|
||||
*
|
||||
* The calling program can then use the name of the cache
|
||||
* to set the KRB5CCNAME and PAG for itself and its children.
|
||||
* to set the KRB5CCNAME and PAG for itself and its children.
|
||||
*
|
||||
* If no ticket was passed, an attemplt to join an existing
|
||||
* PAG will be made.
|
||||
*
|
||||
* If a forwarded K5 TGT is passed in, either a new DCE
|
||||
* PAG will be made.
|
||||
*
|
||||
* If a forwarded K5 TGT is passed in, either a new DCE
|
||||
* context will be created, or an existing one will be updated.
|
||||
* If the same ticket was already used to create an existing
|
||||
* context, it will be joined instead.
|
||||
*
|
||||
* context, it will be joined instead.
|
||||
*
|
||||
* Parts of this program are based on k5dceauth,c which was
|
||||
* given to me by HP and by the k5dcelogin.c which I developed.
|
||||
* given to me by HP and by the k5dcelogin.c which I developed.
|
||||
* A slightly different version of k5dcelogin.c, was added to
|
||||
* DCE 1.2.2
|
||||
*
|
||||
*
|
||||
* D. E. Engert 6/17/97 ANL
|
||||
*/
|
||||
|
||||
@@ -89,9 +89,9 @@ static time_t now;
|
||||
#ifdef _AIX
|
||||
/*---------------------------------------------*/
|
||||
/* AIX with DCE 1.1 does not have the com_err in the libdce.a
|
||||
* do a half hearted job of substituting for it.
|
||||
*/
|
||||
void com_err(char *p1, int code, ...)
|
||||
* do a half hearted job of substituting for it.
|
||||
*/
|
||||
void com_err(char *p1, int code, ...)
|
||||
{
|
||||
int lst;
|
||||
dce_error_string_t err_string;
|
||||
@@ -112,17 +112,17 @@ void krb5_init_ets()
|
||||
/* find a cache to use for our new pag */
|
||||
/* Since there is no simple way to determine which
|
||||
* caches are associated with a pag, we will have
|
||||
* do look around and see what makes most sense on
|
||||
* different systems.
|
||||
* on a Solaris system, and in the DCE source,
|
||||
* the pags always start with a 41.
|
||||
* do look around and see what makes most sense on
|
||||
* different systems.
|
||||
* on a Solaris system, and in the DCE source,
|
||||
* the pags always start with a 41.
|
||||
* this is not true on the IBM, where there does not
|
||||
* appear to be any pattern.
|
||||
*
|
||||
* appear to be any pattern.
|
||||
*
|
||||
* But since we are always certifing our creds when
|
||||
* they are received, we can us that fact, and look
|
||||
* at the first word of the associated data file
|
||||
* to see that it has a "5". If not don't use.
|
||||
* to see that it has a "5". If not don't use.
|
||||
*/
|
||||
|
||||
int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
@@ -139,13 +139,13 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
int better = 0;
|
||||
krb5_creds *xtgt;
|
||||
|
||||
char prev_name[17] = "";
|
||||
char prev_name[17] = "";
|
||||
krb5_timestamp prev_endtime;
|
||||
off_t prev_size;
|
||||
u_long prev_pag = 0;
|
||||
|
||||
char ccname[64] = "FILE:/opt/dcelocal/var/security/creds/";
|
||||
|
||||
|
||||
error_status_t st;
|
||||
sec_login_handle_t lcontext = 0;
|
||||
dce_error_string_t err_string;
|
||||
@@ -160,7 +160,7 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
|
||||
while ( (direntp = readdir( dirp )) != NULL ) {
|
||||
|
||||
/*
|
||||
/*
|
||||
* (but root has the ffffffff which we are not interested in)
|
||||
*/
|
||||
if (!strncmp(direntp->d_name,"dcecred_",8)
|
||||
@@ -171,25 +171,25 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
strcpy(ccname+38,direntp->d_name);
|
||||
if (!k5dcematch(luid, pname, ccname, &size, &xtgt)) {
|
||||
|
||||
/* it's one of our caches, see if it is better
|
||||
/* it's one of our caches, see if it is better
|
||||
* i.e. the endtime is farther, and if the endtimes
|
||||
* are the same, take the larger, as he who has the
|
||||
* are the same, take the larger, as he who has the
|
||||
* most tickets wins.
|
||||
* it must also had the same set of flags at least
|
||||
* i.e. if the forwarded TGT is forwardable, this one must
|
||||
* be as well.
|
||||
* i.e. if the forwarded TGT is forwardable, this one must
|
||||
* be as well.
|
||||
*/
|
||||
|
||||
DEEDEBUG2("Cache:%s",direntp->d_name);
|
||||
DEEDEBUG2(" size:%d",size);
|
||||
DEEDEBUG2(" flags:%8.8x",xtgt->ticket_flags);
|
||||
DEEDEBUG2(" %s",ctime((time_t *)&xtgt->times.endtime));
|
||||
|
||||
|
||||
if ((xtgt->ticket_flags & tflags) == tflags ) {
|
||||
if (prev_name[0]) {
|
||||
if (xtgt->times.endtime > prev_endtime) {
|
||||
better = 1;
|
||||
} else if ((xtgt->times.endtime = prev_endtime)
|
||||
} else if ((xtgt->times.endtime = prev_endtime)
|
||||
&& (size > prev_size)){
|
||||
better = 1;
|
||||
}
|
||||
@@ -207,12 +207,12 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
better = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)closedir( dirp );
|
||||
|
||||
if (!prev_name[0])
|
||||
if (!prev_name[0])
|
||||
return 1; /* failed to find one */
|
||||
|
||||
DEEDEBUG2("Best: %s\n",prev_name);
|
||||
@@ -222,7 +222,7 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
|
||||
strcpy(ccname+38,prev_name);
|
||||
setenv("KRB5CCNAME",ccname,1);
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
|
||||
/*----------------------------------------------*/
|
||||
/* see if this cache is for this this principal */
|
||||
|
||||
int k5dcematch(luid, pname, ccname, sizep, tgt)
|
||||
int k5dcematch(luid, pname, ccname, sizep, tgt)
|
||||
uid_t luid;
|
||||
char *pname;
|
||||
char *ccname;
|
||||
@@ -255,18 +255,18 @@ int k5dcematch(luid, pname, ccname, sizep, tgt)
|
||||
|
||||
if (stat(ccdata, &stbuf))
|
||||
return(1);
|
||||
|
||||
|
||||
if (stbuf.st_uid != luid)
|
||||
return(1);
|
||||
|
||||
if ((fd = open(ccdata,O_RDONLY)) == -1)
|
||||
return(1);
|
||||
|
||||
|
||||
if ((read(fd,&status,4)) != 4) {
|
||||
close(fd);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* DEEDEBUG2(".data file status = %d\n", status); */
|
||||
|
||||
if (status != 5)
|
||||
@@ -306,13 +306,13 @@ int k5dcegettgt(pcache, ccname, pname, tgt)
|
||||
char *sname, *realm, *tgtname = NULL;
|
||||
|
||||
/* Since DCE does not expose much of the Kerberos interface,
|
||||
* we will have to use what we can. This means setting the
|
||||
* we will have to use what we can. This means setting the
|
||||
* KRB5CCNAME for each file we want to test
|
||||
* We will also not worry about freeing extra cache structures
|
||||
* as this this routine is also not exposed, and this should not
|
||||
* effect this module.
|
||||
* as this this routine is also not exposed, and this should not
|
||||
* effect this module.
|
||||
* We should also free the creds contents, but that is not exposed
|
||||
* either.
|
||||
* either.
|
||||
*/
|
||||
|
||||
setenv("KRB5CCNAME",ccname,1);
|
||||
@@ -327,7 +327,7 @@ int k5dcegettgt(pcache, ccname, pname, tgt)
|
||||
DEEDEBUG("Got cache\n");
|
||||
flags = 0;
|
||||
if (code = krb5_cc_set_flags(*pcache, flags)) {
|
||||
com_err(progname, code,"While setting flags");
|
||||
com_err(progname, code,"While setting flags");
|
||||
goto return2;
|
||||
}
|
||||
DEEDEBUG("Set flags\n");
|
||||
@@ -361,7 +361,7 @@ int k5dcegettgt(pcache, ccname, pname, tgt)
|
||||
strcat(tgtname,realm);
|
||||
strcat(tgtname,"@");
|
||||
strcat(tgtname,realm);
|
||||
|
||||
|
||||
DEEDEBUG2("Getting tgt %s\n", tgtname);
|
||||
if (code = krb5_cc_start_seq_get(*pcache, &cur)) {
|
||||
com_err(progname, code, "while starting to retrieve tickets");
|
||||
@@ -384,19 +384,19 @@ int k5dcegettgt(pcache, ccname, pname, tgt)
|
||||
}
|
||||
found = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* we should do a krb5_free_cred_contents(creds); */
|
||||
}
|
||||
|
||||
if (code = krb5_cc_end_seq_get(*pcache, &cur)) {
|
||||
com_err(progname, code, "while finishing retrieval");
|
||||
com_err(progname, code, "while finishing retrieval");
|
||||
goto return2;
|
||||
}
|
||||
|
||||
return1:
|
||||
flags = KRB5_TC_OPENCLOSE;
|
||||
flags = KRB5_TC_OPENCLOSE;
|
||||
krb5_cc_set_flags(*pcache, flags); /* force a close */
|
||||
|
||||
|
||||
return2:
|
||||
if (tgtname)
|
||||
free(tgtname);
|
||||
@@ -442,7 +442,7 @@ int k5dcecon(luid, luser, pname)
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DEEDEBUG2("flags=%x\n",ftgt->ticket_flags);
|
||||
if (!(ftgt->ticket_flags & TKT_FLG_FORWARDABLE)){
|
||||
fprintf(stderr,"Ticket not forwardable\n");
|
||||
@@ -450,21 +450,21 @@ int k5dcecon(luid, luser, pname)
|
||||
}
|
||||
|
||||
setenv("KRB5CCNAME","",1);
|
||||
|
||||
|
||||
#define TKT_ACCEPTABLE (TKT_FLG_FORWARDABLE | TKT_FLG_PROXIABLE \
|
||||
| TKT_FLG_MAY_POSTDATE | TKT_FLG_RENEWABLE | TKT_FLG_HW_AUTH \
|
||||
| TKT_FLG_PRE_AUTH)
|
||||
|
||||
if (!k5dcesession(luid, pname, &tgt, &pag,
|
||||
if (!k5dcesession(luid, pname, &tgt, &pag,
|
||||
(ftgt->ticket_flags & TKT_ACCEPTABLE))) {
|
||||
if (ftgt->times.endtime > tgt->times.endtime) {
|
||||
DEEDEBUG("Updating existing cache\n");
|
||||
DEEDEBUG("Updating existing cache\n");
|
||||
return(k5dceupdate(&ftgt, pag));
|
||||
} else {
|
||||
DEEDEBUG("Using existing cache\n");
|
||||
return(0); /* use the original one */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* see if the tgts match up */
|
||||
|
||||
if ((code = k5dcecreate(luid, luser, pname, &ftgt))) {
|
||||
@@ -473,7 +473,7 @@ int k5dcecon(luid, luser, pname)
|
||||
|
||||
/*
|
||||
* Destroy the Kerberos5 cred cache file.
|
||||
* but dont care aout the return code.
|
||||
* but dont care aout the return code.
|
||||
*/
|
||||
|
||||
DEEDEBUG("Destroying the old cache\n");
|
||||
@@ -488,11 +488,11 @@ int k5dcecon(luid, luser, pname)
|
||||
/* k5dceupdate - update the cache with a new TGT */
|
||||
/* Assumed that the KRB5CCNAME has been set */
|
||||
|
||||
int k5dceupdate(krbtgt, pag)
|
||||
int k5dceupdate(krbtgt, pag)
|
||||
krb5_creds **krbtgt;
|
||||
int pag;
|
||||
{
|
||||
|
||||
|
||||
krb5_ccache ccache;
|
||||
int code;
|
||||
|
||||
@@ -504,7 +504,7 @@ int k5dceupdate(krbtgt, pag)
|
||||
if (code = ccache->ops->init(ccache,(*krbtgt)->client)) {
|
||||
com_err(progname, code, "while reinitilizing cache");
|
||||
return(3);
|
||||
}
|
||||
}
|
||||
|
||||
/* krb5_cc_store_cred */
|
||||
if (code = ccache->ops->store(ccache, *krbtgt)) {
|
||||
@@ -524,7 +524,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
char *pname;
|
||||
krb5_creds **krbtgt;
|
||||
{
|
||||
|
||||
|
||||
char *cp;
|
||||
char *urealm;
|
||||
char *username;
|
||||
@@ -542,7 +542,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
|
||||
uid = getuid();
|
||||
DEEDEBUG2("uid=%d\n",uid);
|
||||
|
||||
|
||||
/* if run as root, change to user, so as to have the
|
||||
* cache created for the local user even if cross-cell
|
||||
* If run as a user, let standard file protection work.
|
||||
@@ -551,7 +551,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
if (uid == 0) {
|
||||
if (seteuid(luid) < 0)
|
||||
goto abort;
|
||||
}
|
||||
}
|
||||
|
||||
cp = strchr(pname,'@');
|
||||
*cp = '\0';
|
||||
@@ -587,7 +587,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
* Setup a DCE login context
|
||||
*/
|
||||
|
||||
if (sec_login_setup_identity((unsigned_char_p_t)username,
|
||||
if (sec_login_setup_identity((unsigned_char_p_t)username,
|
||||
(sec_login_external_tgt|sec_login_proxy_cred),
|
||||
&lcontext, &st)) {
|
||||
/*
|
||||
@@ -598,7 +598,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
if (st) {
|
||||
dce_error_inq_text(st, err_string, &lst);
|
||||
fprintf(stderr,
|
||||
"Error while adding credentials for %s because %s\n",
|
||||
"Error while adding credentials for %s because %s\n",
|
||||
username, err_string);
|
||||
goto abort;
|
||||
}
|
||||
@@ -630,12 +630,12 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
}
|
||||
if (auth_src == sec_login_auth_src_local) {
|
||||
fprintf(stderr,
|
||||
"Credentials obtained from local registry for %s\n",
|
||||
"Credentials obtained from local registry for %s\n",
|
||||
username);
|
||||
}
|
||||
if (auth_src == sec_login_auth_src_overridden) {
|
||||
fprintf(stderr, "Validated %s from local override entry, no network credentials obtained\n", username);
|
||||
goto abort;
|
||||
goto abort;
|
||||
|
||||
}
|
||||
/*
|
||||
@@ -645,14 +645,14 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
sec_login_set_context(lcontext, &st);
|
||||
if (st) {
|
||||
dce_error_inq_text(st, err_string, &lst);
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Unable to set context for %s because %s\n",
|
||||
username, err_string);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now free up the local context and leave the
|
||||
* Now free up the local context and leave the
|
||||
* network context with its pag
|
||||
*/
|
||||
#if 0
|
||||
@@ -670,14 +670,14 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
DEEDEBUG2("validate failed %d\n",st);
|
||||
dce_error_inq_text(st, err_string, &lst);
|
||||
fprintf(stderr,
|
||||
"Unable to validate %s because %s\n", username,
|
||||
"Unable to validate %s because %s\n", username,
|
||||
err_string);
|
||||
goto abort;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dce_error_inq_text(st, err_string, &lst);
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Unable to setup login entry for %s because %s\n",
|
||||
username, err_string);
|
||||
goto abort;
|
||||
@@ -691,7 +691,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
|
||||
if (uid == 0) {
|
||||
seteuid(0);
|
||||
}
|
||||
}
|
||||
|
||||
DEEDEBUG("completed\n");
|
||||
return(0);
|
||||
@@ -699,7 +699,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
|
||||
abort:
|
||||
if (uid == 0) {
|
||||
seteuid(0);
|
||||
}
|
||||
}
|
||||
|
||||
DEEDEBUG("Aborting\n");
|
||||
return(2);
|
||||
@@ -744,14 +744,14 @@ main(argc, argv)
|
||||
DEEDEBUG2("Optarg = %s\n", optarg);
|
||||
break;
|
||||
case 'p': /* principal name */
|
||||
pname = optarg;
|
||||
pname = optarg;
|
||||
DEEDEBUG2("Optarg = %s\n", optarg);
|
||||
break;
|
||||
case 'f': /* convert a forwarded TGT to a context */
|
||||
fflag++;
|
||||
break;
|
||||
case 's': /* old test parameter, ignore it */
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ main(argc, argv)
|
||||
krb5_init_ets();
|
||||
time(&now); /* set time to check expired tickets */
|
||||
|
||||
/* if lusername == NULL, Then user is passed as the USER= variable */
|
||||
/* if lusername == NULL, Then user is passed as the USER= variable */
|
||||
|
||||
if (!lusername) {
|
||||
lusername = getenv("USER");
|
||||
@@ -776,12 +776,12 @@ main(argc, argv)
|
||||
|
||||
luid = pw->pw_uid;
|
||||
|
||||
if (fflag) {
|
||||
status = k5dcecon(luid, lusername, pname);
|
||||
if (fflag) {
|
||||
status = k5dcecon(luid, lusername, pname);
|
||||
} else {
|
||||
status = k5dcesession(luid, pname, &tgt, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
if (!status) {
|
||||
printf("%s",getenv("KRB5CCNAME")); /* return via stdout to caller */
|
||||
DEEDEBUG2("KRB5CCNAME=%s\n",getenv("KRB5CCNAME"));
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/* Test the k5dcepag routine by setting a pag, and
|
||||
* and execing a shell under this pag.
|
||||
*
|
||||
* This allows you to join a PAG which was created
|
||||
* earlier by some other means.
|
||||
/* Test the k5dcepag routine by setting a pag, and
|
||||
* and execing a shell under this pag.
|
||||
*
|
||||
* This allows you to join a PAG which was created
|
||||
* earlier by some other means.
|
||||
* for example k5dcecon
|
||||
*
|
||||
* Must be run as root for testing only.
|
||||
*
|
||||
* Must be run as root for testing only.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -84,12 +84,12 @@ int krb5_dfs_newpag(new_pag)
|
||||
handler_init (sa2, mysig);
|
||||
handler_swap (SIGSYS, sa1, osa1);
|
||||
handler_swap (SIGSEGV, sa2, osa2);
|
||||
|
||||
|
||||
if (sigsetjmp(setpag_buf, 1) == 0) {
|
||||
#if defined(_AIX)
|
||||
int (*dpagaix)(int, int, int, int, int, int);
|
||||
|
||||
if (dpagaix = load(DPAGAIX, 0, 0))
|
||||
if (dpagaix = load(DPAGAIX, 0, 0))
|
||||
pag = (*dpagaix)(AFSCALL_SETPAG, new_pag, 0, 0, 0, 0);
|
||||
#else
|
||||
pag = syscall(AFS_SYSCALL,AFSCALL_SETPAG, new_pag, 0, 0, 0, 0);
|
||||
@@ -118,7 +118,7 @@ main(argc, argv)
|
||||
unsigned int newpag = 0;
|
||||
char ccname[256];
|
||||
int nflag = 0;
|
||||
|
||||
|
||||
while((rv = getopt(argc,argv,"n:")) != -1) {
|
||||
switch(rv) {
|
||||
case 'n':
|
||||
@@ -138,7 +138,7 @@ main(argc, argv)
|
||||
fprintf (stderr,"PAG returned = %8.8x\n",pag);
|
||||
if ((pag != 0) && (pag != -1)) {
|
||||
sprintf (ccname,
|
||||
"FILE:/opt/dcelocal/var/security/creds/dcecred_%8.8x",
|
||||
"FILE:/opt/dcelocal/var/security/creds/dcecred_%8.8x",
|
||||
pag);
|
||||
esetenv("KRB5CCNAME",ccname,1);
|
||||
execl("/bin/csh", "csh", NULL);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -61,7 +61,7 @@ set_buffer_size(int fd, int read)
|
||||
}
|
||||
#endif /* HAVE_GETSOCKOPT */
|
||||
|
||||
while(size >= 131072 &&
|
||||
while(size >= 131072 &&
|
||||
setsockopt(fd, SOL_SOCKET, optname, (void *)&size, sizeof(size)) < 0)
|
||||
size /= 2;
|
||||
#endif
|
||||
|
@@ -189,7 +189,7 @@ setpeer(int argc, char **argv)
|
||||
unix_proxy = 0;
|
||||
else
|
||||
unix_server = 0;
|
||||
if (overbose &&
|
||||
if (overbose &&
|
||||
!strncmp(reply_string, "215 TOPS20", 10))
|
||||
printf(
|
||||
"Remember to set tenex mode when transfering binary files from this machine.\n");
|
||||
@@ -682,15 +682,15 @@ getit(int argc, char **argv, int restartit, char *filemode)
|
||||
tm->tm_year += 1900;
|
||||
|
||||
if ((tm->tm_year > yy) ||
|
||||
(tm->tm_year == yy &&
|
||||
(tm->tm_year == yy &&
|
||||
tm->tm_mon > mo) ||
|
||||
(tm->tm_mon == mo &&
|
||||
(tm->tm_mon == mo &&
|
||||
tm->tm_mday > day) ||
|
||||
(tm->tm_mday == day &&
|
||||
(tm->tm_mday == day &&
|
||||
tm->tm_hour > hour) ||
|
||||
(tm->tm_hour == hour &&
|
||||
(tm->tm_hour == hour &&
|
||||
tm->tm_min > min) ||
|
||||
(tm->tm_min == min &&
|
||||
(tm->tm_min == min &&
|
||||
tm->tm_sec > sec))
|
||||
return (1);
|
||||
}
|
||||
@@ -868,7 +868,7 @@ status(int argc, char **argv)
|
||||
sec_status();
|
||||
printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n",
|
||||
modename, typename, formname, structname);
|
||||
printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n",
|
||||
printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n",
|
||||
onoff(verbose), onoff(bell), onoff(interactive),
|
||||
onoff(doglob));
|
||||
printf("Store unique: %s; Receive unique: %s\n", onoff(sunique),
|
||||
@@ -1171,7 +1171,7 @@ ls(int argc, char **argv)
|
||||
return;
|
||||
}
|
||||
if (strcmp(argv[2], "-") && *argv[2] != '|')
|
||||
if (!globulize(&argv[2]) || !confirm("output to local-file:",
|
||||
if (!globulize(&argv[2]) || !confirm("output to local-file:",
|
||||
argv[2])) {
|
||||
code = -1;
|
||||
return;
|
||||
@@ -1237,7 +1237,7 @@ shell(int argc, char **argv)
|
||||
{
|
||||
pid_t pid;
|
||||
RETSIGTYPE (*old1)(int), (*old2)(int);
|
||||
char shellnam[40], *shellpath, *namep;
|
||||
char shellnam[40], *shellpath, *namep;
|
||||
int waitstatus;
|
||||
|
||||
old1 = signal (SIGINT, SIG_IGN);
|
||||
@@ -1833,7 +1833,7 @@ domap(char *name)
|
||||
break;
|
||||
case '[':
|
||||
LOOP:
|
||||
if (*++cp2 == '$' && isdigit((unsigned char)*(cp2+1))) {
|
||||
if (*++cp2 == '$' && isdigit((unsigned char)*(cp2+1))) {
|
||||
if (*++cp2 == '0') {
|
||||
char *cp3 = name;
|
||||
|
||||
@@ -1852,7 +1852,7 @@ LOOP:
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (*cp2 && *cp2 != ',' &&
|
||||
while (*cp2 && *cp2 != ',' &&
|
||||
*cp2 != ']') {
|
||||
if (*cp2 == '\\') {
|
||||
cp2++;
|
||||
@@ -2137,7 +2137,7 @@ klist(int argc, char **argv)
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ret = command("SITE KLIST");
|
||||
code = (ret == COMPLETE);
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ hookup (const char *host, int port)
|
||||
addrstr, sizeof(addrstr),
|
||||
NULL, 0, NI_NUMERICHOST) != 0)
|
||||
strlcpy (addrstr, "unknown address", sizeof(addrstr));
|
||||
|
||||
|
||||
warn ("connect %s", addrstr);
|
||||
close (s);
|
||||
s = -1;
|
||||
@@ -202,16 +202,16 @@ login (char *host)
|
||||
}
|
||||
strlcpy(username, userstr, sizeof(username));
|
||||
n = command("USER %s", userstr);
|
||||
if (n == COMPLETE)
|
||||
if (n == COMPLETE)
|
||||
n = command("PASS dummy"); /* DK: Compatibility with gssftp daemon */
|
||||
else if(n == CONTINUE) {
|
||||
if (pass == NULL) {
|
||||
char prompt[128];
|
||||
if(myname &&
|
||||
if(myname &&
|
||||
(!strcmp(userstr, "ftp") || !strcmp(userstr, "anonymous"))) {
|
||||
snprintf(defaultpass, sizeof(defaultpass),
|
||||
snprintf(defaultpass, sizeof(defaultpass),
|
||||
"%s@%s", myname, mydomain);
|
||||
snprintf(prompt, sizeof(prompt),
|
||||
snprintf(prompt, sizeof(prompt),
|
||||
"Password (%s): ", defaultpass);
|
||||
} else if (sec_complete) {
|
||||
pass = myname;
|
||||
@@ -417,7 +417,7 @@ getreply (int expecteof)
|
||||
continue;
|
||||
default:
|
||||
if(p < buf + sizeof(buf) - 1)
|
||||
*p++ = c;
|
||||
*p++ = c;
|
||||
else if(long_warn == 0) {
|
||||
fprintf(stderr, "WARNING: incredibly long line received\n");
|
||||
long_warn = 1;
|
||||
@@ -1338,7 +1338,7 @@ noport:
|
||||
verbose = -1;
|
||||
|
||||
result = command ("EPRT |%d|%s|%d|",
|
||||
inet_af, addr_str,
|
||||
inet_af, addr_str,
|
||||
ntohs(socket_get_port (data_addr)));
|
||||
verbose = overbose;
|
||||
|
||||
@@ -1353,7 +1353,7 @@ noport:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
result = command("PORT %d,%d,%d,%d,%d,%d",
|
||||
result = command("PORT %d,%d,%d,%d,%d,%d",
|
||||
(a >> 24) & 0xff,
|
||||
(a >> 16) & 0xff,
|
||||
(a >> 8) & 0xff,
|
||||
@@ -1392,7 +1392,7 @@ bad:
|
||||
int
|
||||
initconn (void)
|
||||
{
|
||||
if (passivemode)
|
||||
if (passivemode)
|
||||
return passive_mode ();
|
||||
else
|
||||
return active_mode ();
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#ifdef FTP_SERVER
|
||||
@@ -265,7 +265,7 @@ gss_adat(void *app_data, void *buf, size_t len)
|
||||
GSS_C_NO_OID,
|
||||
&msg_ctx,
|
||||
&status_string);
|
||||
syslog(LOG_ERR, "gss_accept_sec_context: %s",
|
||||
syslog(LOG_ERR, "gss_accept_sec_context: %s",
|
||||
(char*)status_string.value);
|
||||
gss_release_buffer(&new_stat, &status_string);
|
||||
reply(431, "Security resource unavailable");
|
||||
@@ -324,14 +324,14 @@ import_name(const char *kname, const char *host, gss_name_t *target_name)
|
||||
OM_uint32 new_stat;
|
||||
OM_uint32 msg_ctx = 0;
|
||||
gss_buffer_desc status_string;
|
||||
|
||||
|
||||
gss_display_status(&new_stat,
|
||||
min_stat,
|
||||
GSS_C_MECH_CODE,
|
||||
GSS_C_NO_OID,
|
||||
&msg_ctx,
|
||||
&status_string);
|
||||
printf("Error importing name %s: %s\n",
|
||||
printf("Error importing name %s: %s\n",
|
||||
(char *)name.value,
|
||||
(char *)status_string.value);
|
||||
free(name.value);
|
||||
@@ -345,7 +345,7 @@ import_name(const char *kname, const char *host, gss_name_t *target_name)
|
||||
static int
|
||||
gss_auth(void *app_data, char *host)
|
||||
{
|
||||
|
||||
|
||||
OM_uint32 maj_stat, min_stat;
|
||||
gss_name_t target_name;
|
||||
gss_buffer_desc input, output_token;
|
||||
@@ -357,8 +357,8 @@ gss_auth(void *app_data, char *host)
|
||||
OM_uint32 mech_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG;
|
||||
|
||||
const char *knames[] = { "ftp", "host", NULL }, **kname = knames;
|
||||
|
||||
|
||||
|
||||
|
||||
if(import_name(*kname++, host, &target_name))
|
||||
return AUTH_ERROR;
|
||||
|
||||
@@ -417,7 +417,7 @@ gss_auth(void *app_data, char *host)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
|
||||
free(bindings);
|
||||
|
||||
@@ -427,7 +427,7 @@ gss_auth(void *app_data, char *host)
|
||||
GSS_C_NO_OID,
|
||||
&msg_ctx,
|
||||
&status_string);
|
||||
printf("Error initializing security context: %s\n",
|
||||
printf("Error initializing security context: %s\n",
|
||||
(char*)status_string.value);
|
||||
gss_release_buffer(&new_stat, &status_string);
|
||||
return AUTH_CONTINUE;
|
||||
@@ -507,7 +507,7 @@ gss_auth(void *app_data, char *host)
|
||||
gss_release_name(&min_stat, &targ_name);
|
||||
} else
|
||||
printf("Failed to get gss name of peer.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AUTH_OK;
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -92,7 +92,7 @@ kauth(int argc, char **argv)
|
||||
}
|
||||
tkt.length = tmp;
|
||||
tktcopy.length = tkt.length;
|
||||
|
||||
|
||||
p = strstr(reply_string, "P=");
|
||||
if(!p){
|
||||
printf("Bad reply from server.\n");
|
||||
@@ -104,14 +104,14 @@ kauth(int argc, char **argv)
|
||||
name = p + 2;
|
||||
for(; *p && *p != ' ' && *p != '\r' && *p != '\n'; p++);
|
||||
*p = 0;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "Password for %s:", name);
|
||||
if (des_read_pw_string (passwd, sizeof(passwd)-1, buf, 0))
|
||||
*passwd = '\0';
|
||||
des_string_to_key (passwd, &key);
|
||||
|
||||
des_key_sched(&key, schedule);
|
||||
|
||||
|
||||
des_pcbc_encrypt((des_cblock*)tkt.dat, (des_cblock*)tktcopy.dat,
|
||||
tkt.length,
|
||||
schedule, &key, DES_DECRYPT);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -72,13 +72,13 @@ krb4_decode(void *app_data, void *buf, int len, int level)
|
||||
MSG_DAT m;
|
||||
int e;
|
||||
struct krb4_data *d = app_data;
|
||||
|
||||
|
||||
if(level == prot_safe)
|
||||
e = krb_rd_safe(buf, len, &d->key,
|
||||
(struct sockaddr_in *)REMOTE_ADDR,
|
||||
(struct sockaddr_in *)LOCAL_ADDR, &m);
|
||||
else
|
||||
e = krb_rd_priv(buf, len, d->schedule, &d->key,
|
||||
e = krb_rd_priv(buf, len, d->schedule, &d->key,
|
||||
(struct sockaddr_in *)REMOTE_ADDR,
|
||||
(struct sockaddr_in *)LOCAL_ADDR, &m);
|
||||
if(e){
|
||||
@@ -101,11 +101,11 @@ krb4_encode(void *app_data, void *from, int length, int level, void **to)
|
||||
struct krb4_data *d = app_data;
|
||||
*to = malloc(length + 31);
|
||||
if(level == prot_safe)
|
||||
return krb_mk_safe(from, *to, length, &d->key,
|
||||
return krb_mk_safe(from, *to, length, &d->key,
|
||||
(struct sockaddr_in *)LOCAL_ADDR,
|
||||
(struct sockaddr_in *)REMOTE_ADDR);
|
||||
else if(level == prot_private)
|
||||
return krb_mk_priv(from, *to, length, d->schedule, &d->key,
|
||||
return krb_mk_priv(from, *to, length, d->schedule, &d->key,
|
||||
(struct sockaddr_in *)LOCAL_ADDR,
|
||||
(struct sockaddr_in *)REMOTE_ADDR);
|
||||
else
|
||||
@@ -132,11 +132,11 @@ krb4_adat(void *app_data, void *buf, size_t len)
|
||||
tkt.length = len;
|
||||
|
||||
k_getsockinst(0, inst, sizeof(inst));
|
||||
kerror = krb_rd_req(&tkt, "ftp", inst,
|
||||
kerror = krb_rd_req(&tkt, "ftp", inst,
|
||||
his_addr_sin->sin_addr.s_addr, &auth_dat, "");
|
||||
if(kerror == RD_AP_UNDEC){
|
||||
k_getsockinst(0, inst, sizeof(inst));
|
||||
kerror = krb_rd_req(&tkt, "rcmd", inst,
|
||||
kerror = krb_rd_req(&tkt, "rcmd", inst,
|
||||
his_addr_sin->sin_addr.s_addr, &auth_dat, "");
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ krb4_adat(void *app_data, void *buf, size_t len)
|
||||
reply(535, "Error reading request: %s.", krb_get_err_text(kerror));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memcpy(d->key, auth_dat.session, sizeof(d->key));
|
||||
des_set_key(&d->key, d->schedule);
|
||||
|
||||
@@ -208,7 +208,7 @@ krb4_init(void *app_data)
|
||||
}
|
||||
|
||||
static int
|
||||
mk_auth(struct krb4_data *d, KTEXT adat,
|
||||
mk_auth(struct krb4_data *d, KTEXT adat,
|
||||
char *service, char *host, int checksum)
|
||||
{
|
||||
int ret;
|
||||
@@ -268,7 +268,7 @@ krb4_auth(void *app_data, char *host)
|
||||
printf("Using NAT IP address (%s) for kerberos 4\n",
|
||||
inet_ntoa(natAddr));
|
||||
localaddr->sin_addr = natAddr;
|
||||
|
||||
|
||||
/*
|
||||
* This not the best place to do this, but it
|
||||
* is here we know that (probably) NAT is in
|
||||
@@ -309,11 +309,11 @@ krb4_auth(void *app_data, char *host)
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
adat.length = len;
|
||||
ret = krb_rd_safe(adat.dat, adat.length, &d->key,
|
||||
(struct sockaddr_in *)hisctladdr,
|
||||
ret = krb_rd_safe(adat.dat, adat.length, &d->key,
|
||||
(struct sockaddr_in *)hisctladdr,
|
||||
(struct sockaddr_in *)myctladdr, &msg_data);
|
||||
if(ret){
|
||||
printf("Error reading reply from server: %s.\n",
|
||||
printf("Error reading reply from server: %s.\n",
|
||||
krb_get_err_text(ret));
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
|
@@ -142,7 +142,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
if (argc > 0) {
|
||||
char *xargv[5];
|
||||
|
||||
|
||||
if (setjmp(toplevel))
|
||||
exit(0);
|
||||
signal(SIGINT, intr);
|
||||
|
@@ -59,7 +59,7 @@ static struct toktab {
|
||||
{ "account", ACCOUNT },
|
||||
{ "machine", MACH },
|
||||
{ "macdef", MACDEF },
|
||||
{ "prot", PROT },
|
||||
{ "prot", PROT },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ next:
|
||||
continue;
|
||||
/*
|
||||
* Allow match either for user's input host name
|
||||
* or official hostname. Also allow match of
|
||||
* or official hostname. Also allow match of
|
||||
* incompletely-specified host in local domain.
|
||||
*/
|
||||
if (strcasecmp(host, tokval) == 0)
|
||||
@@ -163,7 +163,7 @@ next:
|
||||
|
||||
case LOGIN:
|
||||
if (token()) {
|
||||
if (*aname == 0) {
|
||||
if (*aname == 0) {
|
||||
*aname = strdup(tokval);
|
||||
} else {
|
||||
if (strcmp(*aname, tokval))
|
||||
@@ -199,7 +199,7 @@ next:
|
||||
fclose(cfile);
|
||||
return (0);
|
||||
}
|
||||
while ((c=getc(cfile)) != EOF &&
|
||||
while ((c=getc(cfile)) != EOF &&
|
||||
(c == ' ' || c == '\t'));
|
||||
if (c == EOF || c == '\n') {
|
||||
printf("Missing macdef name argument.\n");
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1998-2002, 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -74,7 +74,7 @@ level_to_name(enum protection_level level)
|
||||
}
|
||||
|
||||
#ifndef FTP_SERVER /* not used in server */
|
||||
static enum protection_level
|
||||
static enum protection_level
|
||||
name_to_level(const char *name)
|
||||
{
|
||||
int i;
|
||||
@@ -229,12 +229,12 @@ sec_read(int fd, void *dataptr, int length)
|
||||
in_buffer.eof_flag = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
len = buffer_read(&in_buffer, dataptr, length);
|
||||
length -= len;
|
||||
rx += len;
|
||||
dataptr = (char*)dataptr + len;
|
||||
|
||||
|
||||
while(length){
|
||||
int ret;
|
||||
|
||||
@@ -286,7 +286,7 @@ sec_write(int fd, char *dataptr, int length)
|
||||
{
|
||||
int len = buffer_size;
|
||||
int tx = 0;
|
||||
|
||||
|
||||
if(data_prot == prot_clear)
|
||||
return write(fd, dataptr, length);
|
||||
|
||||
@@ -337,7 +337,7 @@ sec_putc(int c, FILE *F)
|
||||
char ch = c;
|
||||
if(data_prot == prot_clear)
|
||||
return putc(c, F);
|
||||
|
||||
|
||||
buffer_write(&out_buffer, &ch, 1);
|
||||
if(c == '\n' || out_buffer.index >= 1024 /* XXX */) {
|
||||
sec_write(fileno(F), out_buffer.data, out_buffer.index);
|
||||
@@ -352,14 +352,14 @@ sec_read_msg(char *s, int level)
|
||||
int len;
|
||||
char *buf;
|
||||
int return_code;
|
||||
|
||||
|
||||
buf = malloc(strlen(s));
|
||||
len = base64_decode(s + 4, buf); /* XXX */
|
||||
|
||||
|
||||
len = (*mech->decode)(app_data, buf, len, level);
|
||||
if(len < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
buf[len] = '\0';
|
||||
|
||||
if(buf[3] == '-')
|
||||
@@ -381,7 +381,7 @@ sec_vfprintf(FILE *f, const char *fmt, va_list ap)
|
||||
int len;
|
||||
if(!sec_complete)
|
||||
return vfprintf(f, fmt, ap);
|
||||
|
||||
|
||||
if (vasprintf(&buf, fmt, ap) == -1) {
|
||||
printf("Failed to allocate command.\n");
|
||||
return -1;
|
||||
@@ -520,10 +520,10 @@ prot(char *pl)
|
||||
reply(504, "Unrecognized protection level.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(sec_complete){
|
||||
if((*mech->check_prot)(app_data, p)){
|
||||
reply(536, "%s does not support %s protection.",
|
||||
reply(536, "%s does not support %s protection.",
|
||||
mech->name, level_to_name(p));
|
||||
}else{
|
||||
data_prot = (enum protection_level)p;
|
||||
@@ -628,7 +628,7 @@ sec_status(void)
|
||||
printf("Using %s command channel.\n", level_to_name(command_prot));
|
||||
printf("Using %s data channel.\n", level_to_name(data_prot));
|
||||
if(buffer_size > 0)
|
||||
printf("Protection buffer size: %lu.\n",
|
||||
printf("Protection buffer size: %lu.\n",
|
||||
(unsigned long)buffer_size);
|
||||
}else{
|
||||
printf("Not using any security mechanism.\n");
|
||||
@@ -669,7 +669,7 @@ sec_prot_internal(int level)
|
||||
printf("Failed to set protection level.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
data_prot = (enum protection_level)level;
|
||||
return 0;
|
||||
}
|
||||
@@ -708,17 +708,17 @@ sec_prot(int argc, char **argv)
|
||||
return;
|
||||
}
|
||||
level = name_to_level(argv[argc - 1]);
|
||||
|
||||
|
||||
if(level == -1)
|
||||
goto usage;
|
||||
|
||||
|
||||
if((*mech->check_prot)(app_data, level)) {
|
||||
printf("%s does not implement %s protection.\n",
|
||||
printf("%s does not implement %s protection.\n",
|
||||
mech->name, level_to_name(level));
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
|
||||
if(sec_prot_internal(level) < 0){
|
||||
code = -1;
|
||||
@@ -759,9 +759,9 @@ sec_prot_command(int argc, char **argv)
|
||||
level = name_to_level(argv[1]);
|
||||
if(level == -1)
|
||||
goto usage;
|
||||
|
||||
|
||||
if((*mech->check_prot)(app_data, level)) {
|
||||
printf("%s does not implement %s protection.\n",
|
||||
printf("%s does not implement %s protection.\n",
|
||||
mech->name, level_to_name(level));
|
||||
code = -1;
|
||||
return;
|
||||
@@ -808,7 +808,7 @@ sec_login(char *host)
|
||||
|
||||
verbose = -1; /* shut up all messages this will produce (they
|
||||
are usually not very user friendly) */
|
||||
|
||||
|
||||
for(m = mechs; *m && (*m)->name; m++) {
|
||||
void *tmp;
|
||||
|
||||
@@ -818,7 +818,7 @@ sec_login(char *host)
|
||||
return -1;
|
||||
}
|
||||
app_data = tmp;
|
||||
|
||||
|
||||
if((*m)->init && (*(*m)->init)(app_data) != 0) {
|
||||
printf("Skipping %s...\n", (*m)->name);
|
||||
continue;
|
||||
@@ -852,13 +852,13 @@ sec_login(char *host)
|
||||
sec_complete = 1;
|
||||
if(doencrypt) {
|
||||
command_prot = prot_private;
|
||||
request_data_prot = prot_private;
|
||||
request_data_prot = prot_private;
|
||||
} else {
|
||||
command_prot = prot_safe;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
verbose = old_verbose;
|
||||
return *m == NULL;
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -36,11 +36,11 @@
|
||||
#ifndef __security_h__
|
||||
#define __security_h__
|
||||
|
||||
enum protection_level {
|
||||
prot_clear,
|
||||
prot_safe,
|
||||
prot_confidential,
|
||||
prot_private
|
||||
enum protection_level {
|
||||
prot_clear,
|
||||
prot_safe,
|
||||
prot_confidential,
|
||||
prot_private
|
||||
};
|
||||
|
||||
struct sec_client_mech {
|
||||
@@ -137,4 +137,4 @@ enum protection_level set_command_prot(enum protection_level);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __security_h__ */
|
||||
#endif /* __security_h__ */
|
||||
|
@@ -754,7 +754,7 @@ host_port
|
||||
|
||||
sin4->sin_family = AF_INET;
|
||||
sin4->sin_port = htons($9 * 256 + $11);
|
||||
sin4->sin_addr.s_addr =
|
||||
sin4->sin_addr.s_addr =
|
||||
htonl(($1 << 24) | ($3 << 16) | ($5 << 8) | $7);
|
||||
}
|
||||
;
|
||||
|
@@ -190,7 +190,7 @@ parse_auth_level(char *str)
|
||||
else
|
||||
warnx("bad value for -a: `%s'", p);
|
||||
}
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -225,7 +225,7 @@ struct getargs args[] = {
|
||||
{ "builtin-ls", 'B', arg_flag, &use_builtin_ls, "use built-in ls to list files" },
|
||||
{ "good-chars", 0, arg_string, &good_chars, "allowed anonymous upload filename chars" },
|
||||
{ "insecure-oob", 'I', arg_negative_flag, &allow_insecure_oob, "don't allow insecure OOB ABOR/STAT" },
|
||||
#ifdef KRB5
|
||||
#ifdef KRB5
|
||||
{ "gss-bindings", 0, arg_flag, &ftp_do_gss_bindings, "Require GSS-API bindings", NULL},
|
||||
#endif
|
||||
{ "version", 0, arg_flag, &version_flag },
|
||||
@@ -297,7 +297,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
long val = 0;
|
||||
|
||||
|
||||
if(guest_umask_string) {
|
||||
val = strtol(guest_umask_string, &p, 8);
|
||||
if (*p != '\0' || val < 0)
|
||||
@@ -328,7 +328,7 @@ main(int argc, char **argv)
|
||||
else
|
||||
warnx("bad value for -p");
|
||||
}
|
||||
|
||||
|
||||
if (maxtimeout < ftpd_timeout)
|
||||
maxtimeout = ftpd_timeout;
|
||||
|
||||
@@ -528,7 +528,7 @@ user(char *name)
|
||||
guest = 0;
|
||||
if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
|
||||
if ((auth_level & AUTH_FTP) == 0 ||
|
||||
checkaccess("ftp") ||
|
||||
checkaccess("ftp") ||
|
||||
checkaccess("anonymous"))
|
||||
reply(530, "User %s access denied.", name);
|
||||
else if ((pw = sgetpwnam("ftp")) != NULL) {
|
||||
@@ -661,7 +661,7 @@ checkuser(char *fname, char *name)
|
||||
|
||||
|
||||
/*
|
||||
* Determine whether a user has access, based on information in
|
||||
* Determine whether a user has access, based on information in
|
||||
* _PATH_FTPUSERS. The users are listed one per line, with `allow'
|
||||
* or `deny' after the username. If anything other than `allow', or
|
||||
* just nothing, is given after the username, `deny' is assumed.
|
||||
@@ -689,9 +689,9 @@ checkaccess(char *name)
|
||||
int allowed = ALLOWED;
|
||||
char *user, *perm, line[BUFSIZ];
|
||||
char *foo;
|
||||
|
||||
|
||||
fd = fopen(_PATH_FTPUSERS, "r");
|
||||
|
||||
|
||||
if(fd == NULL)
|
||||
return allowed;
|
||||
|
||||
@@ -799,7 +799,7 @@ int do_login(int code, char *passwd)
|
||||
sizeof(data_addr));
|
||||
|
||||
syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s(%s), %s",
|
||||
remotehost,
|
||||
remotehost,
|
||||
data_addr,
|
||||
passwd);
|
||||
}
|
||||
@@ -850,11 +850,11 @@ end_login(void)
|
||||
static int
|
||||
krb5_verify(struct passwd *pwd, char *passwd)
|
||||
{
|
||||
krb5_context context;
|
||||
krb5_context context;
|
||||
krb5_ccache id;
|
||||
krb5_principal princ;
|
||||
krb5_error_code ret;
|
||||
|
||||
|
||||
ret = krb5_init_context(&context);
|
||||
if(ret)
|
||||
return ret;
|
||||
@@ -882,7 +882,7 @@ krb5_verify(struct passwd *pwd, char *passwd)
|
||||
}
|
||||
krb5_cc_destroy(context, id);
|
||||
krb5_free_context (context);
|
||||
if(ret)
|
||||
if(ret)
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
@@ -922,8 +922,8 @@ pass(char *passwd)
|
||||
char realm[REALM_SZ];
|
||||
if((rval = krb_get_lrealm(realm, 1)) == KSUCCESS)
|
||||
rval = krb_verify_user(pw->pw_name,
|
||||
"", realm,
|
||||
passwd,
|
||||
"", realm,
|
||||
passwd,
|
||||
KRB_VERIFY_SECURE, NULL);
|
||||
if (rval == KSUCCESS ) {
|
||||
chown (tkt_string(), pw->pw_uid, pw->pw_gid);
|
||||
@@ -1106,7 +1106,7 @@ done:
|
||||
|
||||
/* filename sanity check */
|
||||
|
||||
int
|
||||
int
|
||||
filename_check(char *filename)
|
||||
{
|
||||
char *p;
|
||||
@@ -1127,7 +1127,7 @@ filename_check(char *filename)
|
||||
lreply(553, "\"%s\" is not an acceptable filename.", filename);
|
||||
lreply(553, "The filename must start with an alphanumeric "
|
||||
"character and must only");
|
||||
reply(553, "consist of alphanumeric characters or any of the following: %s",
|
||||
reply(553, "consist of alphanumeric characters or any of the following: %s",
|
||||
good_chars);
|
||||
return 1;
|
||||
}
|
||||
@@ -1252,7 +1252,7 @@ bad:
|
||||
}
|
||||
|
||||
static int
|
||||
accept_with_timeout(int socket,
|
||||
accept_with_timeout(int socket,
|
||||
struct sockaddr *address,
|
||||
socklen_t *address_len,
|
||||
struct timeval *timeout)
|
||||
@@ -1305,7 +1305,7 @@ dataconn(const char *name, off_t size, const char *mode)
|
||||
#if defined(IP_TOS) && defined(HAVE_SETSOCKOPT)
|
||||
{
|
||||
int tos = IPTOS_THROUGHPUT;
|
||||
|
||||
|
||||
setsockopt(s, IPPROTO_IP, IP_TOS, (void *)&tos,
|
||||
sizeof(tos));
|
||||
}
|
||||
@@ -1323,7 +1323,7 @@ dataconn(const char *name, off_t size, const char *mode)
|
||||
if (usedefault)
|
||||
data_dest = his_addr;
|
||||
usedefault = 1;
|
||||
/*
|
||||
/*
|
||||
* Default to using the same socket type as the ctrl address,
|
||||
* unless we know the type of the data address.
|
||||
*/
|
||||
@@ -1411,7 +1411,7 @@ send_data(FILE *instr, FILE *outstr)
|
||||
struct stat st;
|
||||
char *chunk;
|
||||
int in = fileno(instr);
|
||||
if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)
|
||||
if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)
|
||||
&& st.st_size > 0) {
|
||||
/*
|
||||
* mmap zero bytes has potential of loosing, don't do it.
|
||||
@@ -1505,7 +1505,7 @@ receive_data(FILE *instr, FILE *outstr)
|
||||
perror_reply(451, "Local resource failure: malloc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
switch (type) {
|
||||
|
||||
case TYPE_I:
|
||||
@@ -1534,7 +1534,7 @@ receive_data(FILE *instr, FILE *outstr)
|
||||
char *p, *q;
|
||||
int cr_flag = 0;
|
||||
while ((cnt = sec_read(fileno(instr),
|
||||
buf + cr_flag,
|
||||
buf + cr_flag,
|
||||
bufsize - cr_flag)) > 0){
|
||||
if (urgflag && handleoobcmd())
|
||||
return (-1);
|
||||
@@ -1831,7 +1831,7 @@ pwd(void)
|
||||
char *ret;
|
||||
|
||||
/* SunOS has a broken getcwd that does popen(pwd) (!!!), this
|
||||
* failes miserably when running chroot
|
||||
* failes miserably when running chroot
|
||||
*/
|
||||
ret = getcwd(path, sizeof(path));
|
||||
if (ret == NULL)
|
||||
@@ -2017,8 +2017,8 @@ pasv(void)
|
||||
socket_set_address_and_port (pasv_addr,
|
||||
socket_get_address (ctrl_addr),
|
||||
0);
|
||||
socket_set_portrange(pdata, restricted_data_ports,
|
||||
pasv_addr->sa_family);
|
||||
socket_set_portrange(pdata, restricted_data_ports,
|
||||
pasv_addr->sa_family);
|
||||
if (seteuid(0) < 0)
|
||||
fatal("Failed to seteuid");
|
||||
if (bind(pdata, pasv_addr, socket_sockaddr_size (pasv_addr)) < 0) {
|
||||
@@ -2064,8 +2064,8 @@ epsv(char *proto)
|
||||
socket_set_address_and_port (pasv_addr,
|
||||
socket_get_address (ctrl_addr),
|
||||
0);
|
||||
socket_set_portrange(pdata, restricted_data_ports,
|
||||
pasv_addr->sa_family);
|
||||
socket_set_portrange(pdata, restricted_data_ports,
|
||||
pasv_addr->sa_family);
|
||||
if (seteuid(0) < 0)
|
||||
fatal("Failed to seteuid");
|
||||
if (bind(pdata, pasv_addr, socket_sockaddr_size (pasv_addr)) < 0) {
|
||||
@@ -2353,7 +2353,7 @@ out:
|
||||
transflag = 0;
|
||||
if (dout != NULL){
|
||||
sec_write(fileno(dout), buf, 0); /* XXX flush */
|
||||
|
||||
|
||||
fclose(dout);
|
||||
}
|
||||
data = -1;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -152,7 +152,7 @@
|
||||
#if defined(KRB4) || defined(KRB5)
|
||||
#include <kafs.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OTP
|
||||
#include <otp.h>
|
||||
#endif
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "ftpd_locl.h"
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
/* XXX a bit too much of krb5 dependency here...
|
||||
What is the correct way to do this?
|
||||
/* XXX a bit too much of krb5 dependency here...
|
||||
What is the correct way to do this?
|
||||
*/
|
||||
|
||||
struct gss_krb5_data {
|
||||
@@ -88,7 +88,7 @@ gss_userok(void *app_data, char *username)
|
||||
free(kdata);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
ret = 0;
|
||||
krb5_free_principal(kdata->context, client);
|
||||
return ret;
|
||||
@@ -105,20 +105,20 @@ gss_session(void *app_data, char *username)
|
||||
ret = 0;
|
||||
|
||||
kdata = (struct gss_krb5_data *)(data->mech_data);
|
||||
|
||||
|
||||
/* more of krb-depend stuff :-( */
|
||||
/* gss_add_cred() ? */
|
||||
if (data->delegated_cred_handle != GSS_C_NO_CREDENTIAL) {
|
||||
krb5_ccache ccache = NULL;
|
||||
krb5_ccache ccache = NULL;
|
||||
const char* ticketfile;
|
||||
struct passwd *kpw;
|
||||
|
||||
|
||||
ret = krb5_cc_gen_new(kdata->context, &krb5_fcc_ops, &ccache);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
|
||||
ticketfile = krb5_cc_get_name(kdata->context, ccache);
|
||||
|
||||
|
||||
ret = gss_krb5_copy_ccache(&minor_status,
|
||||
data->delegated_cred_handle,
|
||||
ccache);
|
||||
@@ -126,11 +126,11 @@ gss_session(void *app_data, char *username)
|
||||
ret = 0;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
do_destroy_tickets = 1;
|
||||
|
||||
kpw = getpwnam(username);
|
||||
|
||||
|
||||
if (kpw == NULL) {
|
||||
unlink(ticketfile);
|
||||
ret = 1;
|
||||
@@ -138,16 +138,16 @@ gss_session(void *app_data, char *username)
|
||||
}
|
||||
|
||||
chown (ticketfile, kpw->pw_uid, kpw->pw_gid);
|
||||
|
||||
|
||||
if (asprintf(&k5ccname, "FILE:%s", ticketfile) != -1) {
|
||||
esetenv ("KRB5CCNAME", k5ccname, 1);
|
||||
}
|
||||
afslog(NULL, 1);
|
||||
fail:
|
||||
if (ccache)
|
||||
krb5_cc_close(kdata->context, ccache);
|
||||
krb5_cc_close(kdata->context, ccache);
|
||||
}
|
||||
|
||||
|
||||
gss_release_cred(&minor_status, &data->delegated_cred_handle);
|
||||
krb5_free_context(kdata->context);
|
||||
free(kdata);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 1999, 2003 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -54,7 +54,7 @@ static int
|
||||
save_tkt(const char *user,
|
||||
const char *instance,
|
||||
const char *realm,
|
||||
const void *arg,
|
||||
const void *arg,
|
||||
key_proc_t key_proc,
|
||||
KTEXT *cipp)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ store_ticket(KTEXT cip)
|
||||
int left = cip->length;
|
||||
int len;
|
||||
int kerror;
|
||||
|
||||
|
||||
ptr = (char *) cip->dat;
|
||||
|
||||
/* extract session key */
|
||||
@@ -85,7 +85,7 @@ store_ticket(KTEXT cip)
|
||||
len = strnlen(ptr, left);
|
||||
if (len == left)
|
||||
return(INTK_BADPW);
|
||||
|
||||
|
||||
/* extract server's name */
|
||||
strlcpy(sp.name, ptr, sizeof(sp.name));
|
||||
ptr += len + 1;
|
||||
@@ -94,7 +94,7 @@ store_ticket(KTEXT cip)
|
||||
len = strnlen(ptr, left);
|
||||
if (len == left)
|
||||
return(INTK_BADPW);
|
||||
|
||||
|
||||
/* extract server's instance */
|
||||
strlcpy(sp.instance, ptr, sizeof(sp.instance));
|
||||
ptr += len + 1;
|
||||
@@ -103,7 +103,7 @@ store_ticket(KTEXT cip)
|
||||
len = strnlen(ptr, left);
|
||||
if (len == left)
|
||||
return(INTK_BADPW);
|
||||
|
||||
|
||||
/* extract server's realm */
|
||||
strlcpy(sp.realm, ptr, sizeof(sp.realm));
|
||||
ptr += len + 1;
|
||||
@@ -118,7 +118,7 @@ store_ticket(KTEXT cip)
|
||||
tkt.length = (unsigned char) ptr[2];
|
||||
ptr += 3;
|
||||
left -= 3;
|
||||
|
||||
|
||||
if (tkt.length > left)
|
||||
return(INTK_BADPW);
|
||||
|
||||
@@ -135,7 +135,7 @@ store_ticket(KTEXT cip)
|
||||
* happen is that we might receive a replayed ticket, which could
|
||||
* at most be useless.
|
||||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
/* check KDC time stamp */
|
||||
{
|
||||
@@ -145,7 +145,7 @@ store_ticket(KTEXT cip)
|
||||
if (swap_bytes) swap_u_long(kdc_time);
|
||||
|
||||
ptr += 4;
|
||||
|
||||
|
||||
if (abs((int)(local_time - kdc_time)) > CLOCK_SKEW) {
|
||||
return(RD_AP_TIME); /* XXX should probably be better
|
||||
code */
|
||||
@@ -164,8 +164,8 @@ store_ticket(KTEXT cip)
|
||||
return(INTK_ERR);
|
||||
}
|
||||
|
||||
|
||||
kerror = tf_save_cred(sp.name, sp.instance, sp.realm, session,
|
||||
|
||||
kerror = tf_save_cred(sp.name, sp.instance, sp.realm, session,
|
||||
lifetime, kvno, &tkt, local_time);
|
||||
tf_close();
|
||||
|
||||
@@ -177,7 +177,7 @@ kauth(char *principal, char *ticket)
|
||||
{
|
||||
char *p;
|
||||
int ret;
|
||||
|
||||
|
||||
if(get_command_prot() != prot_private) {
|
||||
reply(500, "Request denied (bad protection level)");
|
||||
return;
|
||||
@@ -209,7 +209,7 @@ kauth(char *principal, char *ticket)
|
||||
reply(200, "Tickets will be destroyed on exit.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ret = krb_get_in_tkt (pr.name,
|
||||
pr.instance,
|
||||
pr.realm,
|
||||
@@ -261,7 +261,7 @@ dest_cc(void)
|
||||
krb5_context context;
|
||||
krb5_error_code ret;
|
||||
krb5_ccache id;
|
||||
|
||||
|
||||
ret = krb5_init_context(&context);
|
||||
if (ret == 0) {
|
||||
if (k5ccname)
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -48,7 +48,7 @@ print_cred(krb5_context context, krb5_creds *cred)
|
||||
krb5_format_time(context, cred->times.starttime, t1, sizeof(t1), 1);
|
||||
else
|
||||
krb5_format_time(context, cred->times.authtime, t1, sizeof(t1), 1);
|
||||
|
||||
|
||||
if(cred->times.endtime > sec)
|
||||
krb5_format_time(context, cred->times.endtime, t2, sizeof(t2), 1);
|
||||
else
|
||||
@@ -81,7 +81,7 @@ print_tickets (krb5_context context,
|
||||
return 500;
|
||||
}
|
||||
|
||||
lreply(200, "%17s: %s:%s",
|
||||
lreply(200, "%17s: %s:%s",
|
||||
"Credentials cache",
|
||||
krb5_cc_get_type(context, ccache),
|
||||
krb5_cc_get_name(context, ccache));
|
||||
@@ -137,7 +137,7 @@ klist5(void)
|
||||
else
|
||||
ret = krb5_cc_default (context, &ccache);
|
||||
if (ret) {
|
||||
lreply(500, "krb5_cc_default: %d", ret);
|
||||
lreply(500, "krb5_cc_default: %d", ret);
|
||||
return 500;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ klist5(void)
|
||||
|
||||
ret = krb5_cc_close (context, ccache);
|
||||
if (ret) {
|
||||
lreply(500, "krb5_cc_close: %d", ret);
|
||||
lreply(500, "krb5_cc_close: %d", ret);
|
||||
exit_status = 500;
|
||||
}
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -178,5 +178,5 @@ ftpd_logwtmp(char *line, char *name, char *host)
|
||||
ftpd_logwtmp_asl(line, name, host);
|
||||
#else
|
||||
ftpd_logwtmp_wtmp(line, name, host);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -152,10 +152,10 @@ make_fileinfo(FILE *out, const char *filename, struct fileinfo *file, int flags)
|
||||
char buf[128];
|
||||
int file_type = 0;
|
||||
struct stat *st = &file->st;
|
||||
|
||||
|
||||
file->inode = st->st_ino;
|
||||
file->bsize = block_convert(st->st_blocks);
|
||||
|
||||
|
||||
if(S_ISDIR(st->st_mode)) {
|
||||
file->mode[0] = 'd';
|
||||
file_type = '/';
|
||||
@@ -187,10 +187,10 @@ make_fileinfo(FILE *out, const char *filename, struct fileinfo *file, int flags)
|
||||
file_type = '%';
|
||||
}
|
||||
#endif
|
||||
else
|
||||
else
|
||||
file->mode[0] = '?';
|
||||
{
|
||||
char *x[] = { "---", "--x", "-w-", "-wx",
|
||||
char *x[] = { "---", "--x", "-w-", "-wx",
|
||||
"r--", "r-x", "rw-", "rwx" };
|
||||
strcpy(file->mode + 1, x[(st->st_mode & S_IRWXU) >> 6]);
|
||||
strcpy(file->mode + 4, x[(st->st_mode & S_IRWXG) >> 3]);
|
||||
@@ -241,7 +241,7 @@ make_fileinfo(FILE *out, const char *filename, struct fileinfo *file, int flags)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
|
||||
#if defined(major) && defined(minor)
|
||||
if (asprintf(&file->major, "%u", (unsigned)major(st->st_rdev)) == -1)
|
||||
@@ -414,7 +414,7 @@ lstat_file (const char *file, struct stat *sb)
|
||||
{
|
||||
#ifdef KRB4
|
||||
if (do_the_afs_dance &&
|
||||
k_hasafs()
|
||||
k_hasafs()
|
||||
&& strcmp(file, ".")
|
||||
&& strcmp(file, "..")
|
||||
&& strcmp(file, "/"))
|
||||
@@ -431,7 +431,7 @@ lstat_file (const char *file, struct stat *sb)
|
||||
return -1;
|
||||
|
||||
a_params.out = malloc (maxsize);
|
||||
if (a_params.out == NULL) {
|
||||
if (a_params.out == NULL) {
|
||||
free (path_bkp);
|
||||
return -1;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ lstat_file (const char *file, struct stat *sb)
|
||||
return lstat (file, sb);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* wow this was a mountpoint, lets cook the struct stat
|
||||
* use . as a prototype
|
||||
*/
|
||||
@@ -551,15 +551,15 @@ list_files(FILE *out, const char **files, int n_files, int flags)
|
||||
}
|
||||
switch(SORT_MODE(flags)) {
|
||||
case LS_SORT_NAME:
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
(int (*)(const void*, const void*))compare_filename);
|
||||
break;
|
||||
case LS_SORT_MTIME:
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
(int (*)(const void*, const void*))compare_mtime);
|
||||
break;
|
||||
case LS_SORT_SIZE:
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
qsort(fi, n_files, sizeof(*fi),
|
||||
(int (*)(const void*, const void*))compare_size);
|
||||
break;
|
||||
}
|
||||
@@ -633,7 +633,7 @@ list_files(FILE *out, const char **files, int n_files, int flags)
|
||||
max_major,
|
||||
max_minor,
|
||||
max_date);
|
||||
} else if(DISP_MODE(flags) == LS_DISP_COLUMN ||
|
||||
} else if(DISP_MODE(flags) == LS_DISP_COLUMN ||
|
||||
DISP_MODE(flags) == LS_DISP_CROSS) {
|
||||
int max_len = 0;
|
||||
int size_len = 0;
|
||||
@@ -660,14 +660,14 @@ list_files(FILE *out, const char **files, int n_files, int flags)
|
||||
max_len = 80 / columns;
|
||||
}
|
||||
if(flags & LS_SIZE)
|
||||
sec_fprintf2(out, "total %lu\r\n",
|
||||
sec_fprintf2(out, "total %lu\r\n",
|
||||
(unsigned long)total_blocks);
|
||||
if(DISP_MODE(flags) == LS_DISP_CROSS) {
|
||||
for(i = 0, j = 0; i < n_files; i++) {
|
||||
if(fi[i].filename == NULL)
|
||||
continue;
|
||||
if(flags & LS_SIZE)
|
||||
sec_fprintf2(out, "%*u %-*s", size_len, fi[i].bsize,
|
||||
sec_fprintf2(out, "%*u %-*s", size_len, fi[i].bsize,
|
||||
max_len, fi[i].filename);
|
||||
else
|
||||
sec_fprintf2(out, "%-*s", max_len, fi[i].filename);
|
||||
@@ -687,7 +687,7 @@ list_files(FILE *out, const char **files, int n_files, int flags)
|
||||
while(j < n_files && fi[j].filename == NULL)
|
||||
j++;
|
||||
if(flags & LS_SIZE)
|
||||
sec_fprintf2(out, "%*u %-*s", size_len, fi[j].bsize,
|
||||
sec_fprintf2(out, "%*u %-*s", size_len, fi[j].bsize,
|
||||
max_len, fi[j].filename);
|
||||
else
|
||||
sec_fprintf2(out, "%-*s", max_len, fi[j].filename);
|
||||
@@ -710,7 +710,7 @@ list_files(FILE *out, const char **files, int n_files, int flags)
|
||||
const char *p = strrchr(files[i], '/');
|
||||
if(p == NULL)
|
||||
p = files[i];
|
||||
else
|
||||
else
|
||||
p++;
|
||||
if(!(flags & LS_DIR_FLAG) || !IS_DOT_DOTDOT(p)) {
|
||||
if((flags & LS_SHOW_DIRNAME)) {
|
||||
|
@@ -65,7 +65,7 @@ RCSID("$Id$");
|
||||
#include "extern.h"
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Special version of popen which avoids call to shell. This ensures
|
||||
* no one may create a pipe to a hidden program as a side effect of a
|
||||
* list or dir command.
|
||||
@@ -148,8 +148,8 @@ ftpd_popen(char *program, char *type, int do_stderr, int no_glob)
|
||||
;
|
||||
|
||||
memset(&gl, 0, sizeof(gl));
|
||||
if (no_glob ||
|
||||
glob(argv[argc], flags, NULL, &gl) ||
|
||||
if (no_glob ||
|
||||
glob(argv[argc], flags, NULL, &gl) ||
|
||||
gl.gl_pathc == 0)
|
||||
gargv[gargc++] = strdup(argv[argc]);
|
||||
else
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -62,8 +62,8 @@ add_list(char ****list, size_t *listlen, char **str, size_t len)
|
||||
}
|
||||
|
||||
static void
|
||||
permute(char ****list, size_t *listlen,
|
||||
char **str, const int start, const int len)
|
||||
permute(char ****list, size_t *listlen,
|
||||
char **str, const int start, const int len)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* pthread support is disable because the pthread
|
||||
* test have no "application pthread libflags" variable,
|
||||
* when this is fixed pthread support can be enabled again.
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -61,9 +61,9 @@ static struct client **clients;
|
||||
static int num_clients;
|
||||
|
||||
static int
|
||||
init_sec_context(struct client *client,
|
||||
init_sec_context(struct client *client,
|
||||
int32_t *hContext, int32_t *hCred,
|
||||
int32_t flags,
|
||||
int32_t flags,
|
||||
const char *targetname,
|
||||
const krb5_data *itoken, krb5_data *otoken)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ init_sec_context(struct client *client,
|
||||
}
|
||||
|
||||
static int
|
||||
accept_sec_context(struct client *client,
|
||||
accept_sec_context(struct client *client,
|
||||
int32_t *hContext,
|
||||
int32_t flags,
|
||||
const krb5_data *itoken,
|
||||
@@ -103,7 +103,7 @@ accept_sec_context(struct client *client,
|
||||
}
|
||||
|
||||
static int
|
||||
acquire_cred(struct client *client,
|
||||
acquire_cred(struct client *client,
|
||||
const char *username,
|
||||
const char *password,
|
||||
int32_t flags,
|
||||
@@ -120,7 +120,7 @@ acquire_cred(struct client *client,
|
||||
}
|
||||
|
||||
static int
|
||||
toast_resource(struct client *client,
|
||||
toast_resource(struct client *client,
|
||||
int32_t hCred)
|
||||
{
|
||||
int32_t val;
|
||||
@@ -138,7 +138,7 @@ goodbye(struct client *client)
|
||||
}
|
||||
|
||||
static int
|
||||
get_targetname(struct client *client,
|
||||
get_targetname(struct client *client,
|
||||
char **target)
|
||||
{
|
||||
put32(client, eGetTargetName);
|
||||
@@ -162,7 +162,7 @@ encrypt_token(struct client *client, int32_t hContext, int32_t flags,
|
||||
}
|
||||
|
||||
static int32_t
|
||||
decrypt_token(struct client *client, int32_t hContext, int flags,
|
||||
decrypt_token(struct client *client, int32_t hContext, int flags,
|
||||
krb5_data *in, krb5_data *out)
|
||||
{
|
||||
int32_t val;
|
||||
@@ -192,7 +192,7 @@ get_mic(struct client *client, int32_t hContext,
|
||||
}
|
||||
|
||||
static int32_t
|
||||
verify_mic(struct client *client, int32_t hContext,
|
||||
verify_mic(struct client *client, int32_t hContext,
|
||||
krb5_data *in, krb5_data *mic)
|
||||
{
|
||||
int32_t val;
|
||||
@@ -208,7 +208,7 @@ verify_mic(struct client *client, int32_t hContext,
|
||||
|
||||
|
||||
static int32_t
|
||||
get_version_capa(struct client *client,
|
||||
get_version_capa(struct client *client,
|
||||
int32_t *version, int32_t *capa,
|
||||
char **version_str)
|
||||
{
|
||||
@@ -220,7 +220,7 @@ get_version_capa(struct client *client,
|
||||
}
|
||||
|
||||
static int32_t
|
||||
get_moniker(struct client *client,
|
||||
get_moniker(struct client *client,
|
||||
char **moniker)
|
||||
{
|
||||
put32(client, eGetMoniker);
|
||||
@@ -310,7 +310,7 @@ build_context(struct client *ipeer, struct client *apeer,
|
||||
case GSMERR_CONTINUE_NEEDED:
|
||||
break;
|
||||
default:
|
||||
warnx("iPeer %s failed with %d (step %d)",
|
||||
warnx("iPeer %s failed with %d (step %d)",
|
||||
ipeer->name, (int)val, step);
|
||||
goto out;
|
||||
}
|
||||
@@ -369,13 +369,13 @@ build_context(struct client *ipeer, struct client *apeer,
|
||||
out:
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_mic(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2)
|
||||
{
|
||||
krb5_data msg, mic;
|
||||
int32_t val;
|
||||
|
||||
|
||||
msg.data = "foo";
|
||||
msg.length = 3;
|
||||
|
||||
@@ -392,12 +392,12 @@ test_mic(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2)
|
||||
}
|
||||
|
||||
static int32_t
|
||||
test_wrap(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2,
|
||||
test_wrap(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2,
|
||||
int conf)
|
||||
{
|
||||
krb5_data msg, wrapped, out;
|
||||
int32_t val;
|
||||
|
||||
|
||||
msg.data = "foo";
|
||||
msg.length = 3;
|
||||
|
||||
@@ -476,9 +476,9 @@ log_function(void *ptr)
|
||||
goto out;
|
||||
if (krb5_ret_string(c->logsock, &string))
|
||||
goto out;
|
||||
printf("%s:%lu: %s\n",
|
||||
printf("%s:%lu: %s\n",
|
||||
file, (unsigned long)line, string);
|
||||
fprintf(logfile, "%s:%lu: %s\n",
|
||||
fprintf(logfile, "%s:%lu: %s\n",
|
||||
file, (unsigned long)line, string);
|
||||
fflush(logfile);
|
||||
free(file);
|
||||
@@ -510,7 +510,7 @@ connect_client(const char *slave)
|
||||
*port++ = 0;
|
||||
|
||||
c->name = estrdup(slave);
|
||||
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
@@ -584,7 +584,7 @@ connect_client(const char *slave)
|
||||
|
||||
|
||||
clients = erealloc(clients, (num_clients + 1) * sizeof(*clients));
|
||||
|
||||
|
||||
clients[num_clients] = c;
|
||||
num_clients++;
|
||||
|
||||
@@ -703,7 +703,7 @@ main(int argc, char **argv)
|
||||
|
||||
val = acquire_cred(clients[i], user, password, 1, &hCred);
|
||||
if (val != GSMERR_OK) {
|
||||
warnx("Failed to acquire_cred on host %s: %d",
|
||||
warnx("Failed to acquire_cred on host %s: %d",
|
||||
clients[i]->moniker, (int)val);
|
||||
failed = 1;
|
||||
} else
|
||||
@@ -713,7 +713,7 @@ main(int argc, char **argv)
|
||||
if (failed)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
/*
|
||||
* First test if all slaves can build context to them-self.
|
||||
*/
|
||||
|
||||
@@ -732,8 +732,8 @@ main(int argc, char **argv)
|
||||
val = acquire_cred(c, user, password, 1, &hCred);
|
||||
if (val != GSMERR_OK)
|
||||
errx(1, "failed to acquire_cred: %d", (int)val);
|
||||
|
||||
val = build_context(c, c,
|
||||
|
||||
val = build_context(c, c,
|
||||
GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG|
|
||||
GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG|
|
||||
GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG,
|
||||
@@ -792,7 +792,7 @@ main(int argc, char **argv)
|
||||
|
||||
for (j = 1; j < num_clients + 1; j++) {
|
||||
server = get_client(p[j % num_clients]);
|
||||
|
||||
|
||||
if (server->target_name == NULL)
|
||||
break;
|
||||
|
||||
@@ -809,11 +809,11 @@ main(int argc, char **argv)
|
||||
warnx("build_context failed: %d", (int)val);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
val = test_token(client, clientC, server, serverC);
|
||||
if (val)
|
||||
break;
|
||||
|
||||
|
||||
toast_resource(client, clientC);
|
||||
toast_resource(server, serverC);
|
||||
if (!delegCred) {
|
||||
@@ -827,11 +827,11 @@ main(int argc, char **argv)
|
||||
if (hCred)
|
||||
toast_resource(client, hCred);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close all connections to clients
|
||||
*/
|
||||
|
||||
|
||||
out:
|
||||
printf("sending goodbye and waiting for log sockets\n");
|
||||
for (i = 0; i < num_clients; i++) {
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -151,7 +151,7 @@ find_handle(struct handle *h, int32_t idx, enum handle_type type)
|
||||
{
|
||||
if (idx == 0)
|
||||
return NULL;
|
||||
|
||||
|
||||
while (h) {
|
||||
if (h->idx == idx) {
|
||||
if (type == h->type)
|
||||
@@ -160,7 +160,7 @@ find_handle(struct handle *h, int32_t idx, enum handle_type type)
|
||||
}
|
||||
h = h->next;
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ acquire_cred(struct client *c,
|
||||
ret = krb5_cc_initialize (context, id, cred.client);
|
||||
if (ret)
|
||||
krb5_err (context, 1, ret, "krb5_cc_initialize");
|
||||
|
||||
|
||||
ret = krb5_cc_store_cred (context, id, &cred);
|
||||
if (ret)
|
||||
krb5_err (context, 1, ret, "krb5_cc_store_cred");
|
||||
@@ -370,7 +370,7 @@ HandleOP(InitContext)
|
||||
gss_target_name,
|
||||
oid,
|
||||
flags & 0x7f,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
input_token_ptr,
|
||||
NULL,
|
||||
@@ -382,7 +382,7 @@ HandleOP(InitContext)
|
||||
del_handle(&c->handles, hContext);
|
||||
new_context_id = 0;
|
||||
logmessage(c, __FILE__, __LINE__, 0,
|
||||
"gss_init_sec_context returns code: %d/%d",
|
||||
"gss_init_sec_context returns code: %d/%d",
|
||||
maj_stat, min_stat);
|
||||
} else {
|
||||
if (input_token.length == 0)
|
||||
@@ -461,7 +461,7 @@ HandleOP(AcceptContext)
|
||||
if (hContext != 0)
|
||||
del_handle(&c->handles, hContext);
|
||||
logmessage(c, __FILE__, __LINE__, 0,
|
||||
"gss_accept_sec_context returns code: %d/%d",
|
||||
"gss_accept_sec_context returns code: %d/%d",
|
||||
maj_stat, min_stat);
|
||||
new_context_id = 0;
|
||||
} else {
|
||||
@@ -484,8 +484,8 @@ HandleOP(AcceptContext)
|
||||
gss_release_cred(&min_stat, &deleg_cred);
|
||||
deleg_hcred = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
gsm_error = convert_gss_to_gsm(maj_stat);
|
||||
|
||||
put32(c, new_context_id);
|
||||
@@ -534,11 +534,11 @@ HandleOP(AcquireCreds)
|
||||
gsm_error = convert_krb5_to_gsm(ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
ret = krb5_get_init_creds_opt_alloc (context, &opt);
|
||||
if (ret)
|
||||
krb5_err(context, 1, ret, "krb5_get_init_creds_opt_alloc");
|
||||
|
||||
|
||||
krb5_get_init_creds_opt_set_pa_password(context, opt, password, NULL);
|
||||
|
||||
gsm_error = acquire_cred(c, principal, opt, &handle);
|
||||
@@ -580,22 +580,22 @@ HandleOP(Sign)
|
||||
|
||||
input_token.length = token.length;
|
||||
input_token.value = token.data;
|
||||
|
||||
|
||||
maj_stat = gss_get_mic(&min_stat, ctx, 0, &input_token,
|
||||
&output_token);
|
||||
if (maj_stat != GSS_S_COMPLETE)
|
||||
errx(1, "gss_get_mic failed");
|
||||
|
||||
|
||||
krb5_data_free(&token);
|
||||
|
||||
|
||||
token.data = output_token.value;
|
||||
token.length = output_token.length;
|
||||
|
||||
|
||||
put32(c, 0); /* XXX fix gsm_error */
|
||||
putdata(c, token);
|
||||
|
||||
|
||||
gss_release_buffer(&min_stat, &output_token);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ HandleOP(Verify)
|
||||
|
||||
msg_token.length = msg.length;
|
||||
msg_token.value = msg.data;
|
||||
|
||||
|
||||
retdata(c, mic);
|
||||
|
||||
mic_token.length = mic.length;
|
||||
@@ -631,12 +631,12 @@ HandleOP(Verify)
|
||||
&mic_token, &qop);
|
||||
if (maj_stat != GSS_S_COMPLETE)
|
||||
errx(1, "gss_verify_mic failed");
|
||||
|
||||
|
||||
krb5_data_free(&mic);
|
||||
krb5_data_free(&msg);
|
||||
|
||||
|
||||
put32(c, 0); /* XXX fix gsm_error */
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ HandleOP(GetVersionAndCapabilities)
|
||||
{
|
||||
struct utsname ut;
|
||||
if (uname(&ut) == 0) {
|
||||
snprintf(name, sizeof(name), "%s-%s-%s",
|
||||
snprintf(name, sizeof(name), "%s-%s-%s",
|
||||
ut.sysname, ut.version, ut.machine);
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ HandleOP(GetVersionAndCapabilities)
|
||||
|
||||
put32(c, GSSMAGGOTPROTOCOL);
|
||||
put32(c, cap);
|
||||
putstring(c, str);
|
||||
putstring(c, str);
|
||||
free(str);
|
||||
|
||||
return 0;
|
||||
@@ -711,12 +711,12 @@ HandleOP(SetLoggingSocket)
|
||||
|
||||
krb5_store_int32(c->logging, eLogSetMoniker);
|
||||
store_string(c->logging, c->moniker);
|
||||
|
||||
|
||||
logmessage(c, __FILE__, __LINE__, 0, "logging turned on");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
HandleOP(ChangePassword)
|
||||
@@ -751,22 +751,22 @@ HandleOP(Wrap)
|
||||
|
||||
input_token.length = token.length;
|
||||
input_token.value = token.data;
|
||||
|
||||
|
||||
maj_stat = gss_wrap(&min_stat, ctx, flags, 0, &input_token,
|
||||
&conf_state, &output_token);
|
||||
if (maj_stat != GSS_S_COMPLETE)
|
||||
errx(1, "gss_wrap failed");
|
||||
|
||||
|
||||
krb5_data_free(&token);
|
||||
|
||||
|
||||
token.data = output_token.value;
|
||||
token.length = output_token.length;
|
||||
|
||||
|
||||
put32(c, 0); /* XXX fix gsm_error */
|
||||
putdata(c, token);
|
||||
|
||||
|
||||
gss_release_buffer(&min_stat, &output_token);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -793,10 +793,10 @@ HandleOP(Unwrap)
|
||||
|
||||
input_token.length = token.length;
|
||||
input_token.value = token.data;
|
||||
|
||||
|
||||
maj_stat = gss_unwrap(&min_stat, ctx, &input_token,
|
||||
&output_token, &conf_state, &qop_state);
|
||||
|
||||
|
||||
if (maj_stat != GSS_S_COMPLETE)
|
||||
errx(1, "gss_unwrap failed: %d/%d", maj_stat, min_stat);
|
||||
|
||||
@@ -938,15 +938,15 @@ create_client(int fd, int port, const char *moniker)
|
||||
c->salen = sizeof(c->sa);
|
||||
getpeername(fd, (struct sockaddr *)&c->sa, &c->salen);
|
||||
|
||||
getnameinfo((struct sockaddr *)&c->sa, c->salen,
|
||||
c->servername, sizeof(c->servername),
|
||||
getnameinfo((struct sockaddr *)&c->sa, c->salen,
|
||||
c->servername, sizeof(c->servername),
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
}
|
||||
|
||||
c->sock = krb5_storage_from_fd(fd);
|
||||
if (c->sock == NULL)
|
||||
errx(1, "krb5_storage_from_fd");
|
||||
|
||||
|
||||
close(fd);
|
||||
|
||||
return c;
|
||||
@@ -987,7 +987,7 @@ handleServer(void *ptr)
|
||||
}
|
||||
|
||||
logmessage(c, __FILE__, __LINE__, 0,
|
||||
"---> Got op %s from server %s",
|
||||
"---> Got op %s from server %s",
|
||||
handler->name, c->servername);
|
||||
|
||||
if ((handler->func)(handler->op, c))
|
||||
@@ -1076,7 +1076,7 @@ main(int argc, char **argv)
|
||||
fprintf(logfile, "connected\n");
|
||||
|
||||
{
|
||||
struct client *c;
|
||||
struct client *c;
|
||||
|
||||
c = create_client(0, port, moniker_str);
|
||||
/* close(0); */
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
@@ -63,9 +63,9 @@ enum gssMaggotErrorCodes {
|
||||
* int32: message OP (enum gssMaggotProtocol)
|
||||
* ...
|
||||
*
|
||||
* return: -- on error
|
||||
* return: -- on error
|
||||
* int32: not support (GSMERR_NOT_SUPPORTED)
|
||||
*
|
||||
*
|
||||
* return: -- on existing message OP
|
||||
* int32: support (GSMERR_OK) -- only sent for extensions
|
||||
* ...
|
||||
@@ -75,28 +75,28 @@ enum gssMaggotErrorCodes {
|
||||
|
||||
enum gssMaggotOp {
|
||||
eGetVersionInfo = 0,
|
||||
/*
|
||||
/*
|
||||
* input:
|
||||
* none
|
||||
* return:
|
||||
* int32: last version handled
|
||||
* int32: last version handled
|
||||
*/
|
||||
eGoodBye,
|
||||
/*
|
||||
/*
|
||||
* input:
|
||||
* none
|
||||
* return:
|
||||
* close socket
|
||||
*/
|
||||
eInitContext,
|
||||
/*
|
||||
/*
|
||||
* input:
|
||||
* int32: hContext
|
||||
* int32: hCred
|
||||
* int32: Flags
|
||||
* the lowest 0x7f flags maps directly to GSS-API flags
|
||||
* DELEGATE 0x001
|
||||
* MUTUAL_AUTH 0x002
|
||||
* DELEGATE 0x001
|
||||
* MUTUAL_AUTH 0x002
|
||||
* REPLAY_DETECT 0x004
|
||||
* SEQUENCE_DETECT 0x008
|
||||
* CONFIDENTIALITY 0x010
|
||||
@@ -115,7 +115,7 @@ enum gssMaggotOp {
|
||||
* length-encoded: output token
|
||||
*/
|
||||
eAcceptContext,
|
||||
/*
|
||||
/*
|
||||
* input:
|
||||
* int32: hContext
|
||||
* int32: Flags -- unused ?
|
||||
@@ -229,7 +229,7 @@ enum gssMaggotOp {
|
||||
* return1:
|
||||
* int16: log port number
|
||||
* int32: master log prototocol version (0)
|
||||
*
|
||||
*
|
||||
* wait for master to connect on the master log socket
|
||||
*
|
||||
* return2:
|
||||
|
68
appl/kf/kf.c
68
appl/kf/kf.c
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2000, 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "kf_locl.h"
|
||||
@@ -72,16 +72,16 @@ client_setup(krb5_context *context, int *argc, char **argv)
|
||||
int status;
|
||||
|
||||
setprogname (argv[0]);
|
||||
|
||||
|
||||
status = krb5_init_context (context);
|
||||
if (status)
|
||||
errx(1, "krb5_init_context failed: %d", status);
|
||||
|
||||
|
||||
forwardable = krb5_config_get_bool (*context, NULL,
|
||||
"libdefaults",
|
||||
"forwardable",
|
||||
NULL);
|
||||
|
||||
NULL);
|
||||
|
||||
if (getarg (args, num_args, *argc, argv, &optind))
|
||||
usage(1, args, num_args);
|
||||
|
||||
@@ -91,7 +91,7 @@ client_setup(krb5_context *context, int *argc, char **argv)
|
||||
print_version(NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
if(port_str) {
|
||||
struct servent *s = roken_getservbyname(port_str, "tcp");
|
||||
if(s)
|
||||
@@ -108,7 +108,7 @@ client_setup(krb5_context *context, int *argc, char **argv)
|
||||
|
||||
if (port == 0)
|
||||
port = krb5_getportbyname (*context, KF_PORT_NAME, "tcp", KF_PORT_NUM);
|
||||
|
||||
|
||||
if(*argc - optind < 1)
|
||||
usage(1, args, num_args);
|
||||
*argc = optind;
|
||||
@@ -211,7 +211,7 @@ proto (int sock, const char *hostname, const char *service,
|
||||
}
|
||||
|
||||
creds.client = principal;
|
||||
|
||||
|
||||
status = krb5_make_principal (context,
|
||||
&creds.server,
|
||||
principal->realm,
|
||||
@@ -248,7 +248,7 @@ proto (int sock, const char *hostname, const char *service,
|
||||
krb5_warn (context, status, "krb5_mk_priv");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
krb5_data_free (&data);
|
||||
|
||||
status = krb5_read_priv_message(context, auth_context, &sock, &data);
|
||||
@@ -270,7 +270,7 @@ proto (int sock, const char *hostname, const char *service,
|
||||
}
|
||||
|
||||
static int
|
||||
doit (const char *hostname, int port, const char *service,
|
||||
doit (const char *hostname, int port, const char *service,
|
||||
char *message, size_t len)
|
||||
{
|
||||
struct addrinfo *ai, *a;
|
||||
@@ -313,7 +313,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int argcc,port,i;
|
||||
int ret=0;
|
||||
|
||||
|
||||
argcc = argc;
|
||||
port = client_setup(&context, &argcc, argv);
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 1999, 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "kf_locl.h"
|
||||
@@ -76,7 +76,7 @@ server_setup(krb5_context *context, int argc, char **argv)
|
||||
print_version(NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
if(port_str){
|
||||
struct servent *s = roken_getservbyname(port_str, "tcp");
|
||||
if(s)
|
||||
@@ -96,7 +96,7 @@ server_setup(krb5_context *context, int argc, char **argv)
|
||||
|
||||
if(argv[local_argc] != NULL)
|
||||
usage(1, args, num_args);
|
||||
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ proto (int sock, const char *service)
|
||||
&sock, &remotename);
|
||||
if (status)
|
||||
krb5_err(context, 1, status, "krb5_read_message");
|
||||
status=krb5_read_priv_message (context, auth_context,
|
||||
status=krb5_read_priv_message (context, auth_context,
|
||||
&sock, &tk_file);
|
||||
if (status)
|
||||
krb5_err(context, 1, status, "krb5_read_message");
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -111,7 +111,7 @@ try_pipe (struct x_socket *s, int dpy, const char *pattern)
|
||||
int ret;
|
||||
int fd;
|
||||
int pipefd[2];
|
||||
|
||||
|
||||
snprintf (path, sizeof(path), pattern, dpy);
|
||||
fd = open (path, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
if (fd < 0) {
|
||||
@@ -408,7 +408,7 @@ create_and_write_cookie (char *file,
|
||||
int saved_errno;
|
||||
|
||||
gethostname (hostname, sizeof(hostname));
|
||||
|
||||
|
||||
auth.family = FamilyLocal;
|
||||
auth.address = hostname;
|
||||
auth.address_length = strlen(auth.address);
|
||||
@@ -504,7 +504,7 @@ verify_and_remove_cookies (int fd, int sock, int cookiesp)
|
||||
unsigned n, d, npad, dpad;
|
||||
char *protocol_name, *protocol_data;
|
||||
u_char zeros[6] = {0, 0, 0, 0, 0, 0};
|
||||
u_char refused[20] = {0, 10,
|
||||
u_char refused[20] = {0, 10,
|
||||
0, 0, /* protocol major version */
|
||||
0, 0, /* protocol minor version */
|
||||
0, 0, /* length of additional data / 4 */
|
||||
@@ -566,7 +566,7 @@ fail:
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Return 0 iff `cookie' is compatible with the cookie for the
|
||||
* localhost with name given in `ai' (or `hostname') and display
|
||||
* number in `disp_nr'.
|
||||
@@ -579,7 +579,7 @@ match_local_auth (Xauth* auth,
|
||||
int auth_disp;
|
||||
char *tmp_disp;
|
||||
struct addrinfo *a;
|
||||
|
||||
|
||||
tmp_disp = malloc(auth->number_length + 1);
|
||||
if (tmp_disp == NULL)
|
||||
return -1;
|
||||
@@ -693,7 +693,7 @@ replace_cookie(int xserver, int fd, char *filename, int cookiesp) /* XXX */
|
||||
if (f != NULL) {
|
||||
Xauth *auth = find_auth_cookie (f);
|
||||
u_char len[6] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
fclose (f);
|
||||
|
||||
if (auth != NULL) {
|
||||
@@ -754,7 +754,7 @@ suspicious_address (int sock, struct sockaddr *addr)
|
||||
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
return ((struct sockaddr_in *)addr)->sin_addr.s_addr !=
|
||||
return ((struct sockaddr_in *)addr)->sin_addr.s_addr !=
|
||||
htonl(INADDR_LOOPBACK)
|
||||
#if defined(IP_OPTIONS) && defined(HAVE_GETSOCKOPT)
|
||||
|| getsockopt (sock, IPPROTO_IP, IP_OPTIONS, data, &len) < 0
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -99,7 +99,7 @@ krb4_authenticate (kx_context *kc, int s)
|
||||
memcpy (c->key, cred.session, sizeof(des_cblock));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read a krb4 priv packet from `fd' into `buf' (of size `len').
|
||||
* Return the number of bytes read or 0 on EOF or -1 on error.
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -43,7 +43,7 @@ struct krb5_kx_context {
|
||||
krb5_crypto crypto;
|
||||
krb5_principal client;
|
||||
krb5_log_facility *log;
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef struct krb5_kx_context krb5_kx_context;
|
||||
@@ -109,15 +109,15 @@ krb5_authenticate (kx_context *kc, int s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = krb5_auth_con_getkey (CONTEXT(kc), auth_context,
|
||||
ret = krb5_auth_con_getkey (CONTEXT(kc), auth_context,
|
||||
&K5DATA(kc)->keyblock);
|
||||
if (ret) {
|
||||
krb5_warn (CONTEXT(kc), ret, "krb5_auth_con_getkey: %s", host);
|
||||
krb5_auth_con_free (CONTEXT(kc), auth_context);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = krb5_crypto_init (CONTEXT(kc), K5DATA(kc)->keyblock,
|
||||
|
||||
ret = krb5_crypto_init (CONTEXT(kc), K5DATA(kc)->keyblock,
|
||||
0, &K5DATA(kc)->crypto);
|
||||
if (ret) {
|
||||
krb5_warn (CONTEXT(kc), ret, "krb5_crypto_init");
|
||||
@@ -149,14 +149,14 @@ krb5_read (kx_context *kc,
|
||||
if (l != 4)
|
||||
return -1;
|
||||
data_len = (tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | tmp[3];
|
||||
outer_len = krb5_get_wrapped_length (CONTEXT(kc),
|
||||
outer_len = krb5_get_wrapped_length (CONTEXT(kc),
|
||||
K5DATA(kc)->crypto, data_len);
|
||||
if (outer_len > len)
|
||||
return -1;
|
||||
if (krb5_net_read (CONTEXT(kc), &fd, buf, outer_len) != outer_len)
|
||||
return -1;
|
||||
|
||||
ret = krb5_decrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
||||
ret = krb5_decrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
||||
KRB5_KU_OTHER_ENCRYPTED,
|
||||
buf, outer_len, &data);
|
||||
if (ret) {
|
||||
@@ -186,7 +186,7 @@ krb5_write(kx_context *kc,
|
||||
unsigned char tmp[4];
|
||||
size_t outlen;
|
||||
|
||||
ret = krb5_encrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
||||
ret = krb5_encrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
||||
KRB5_KU_OTHER_ENCRYPTED,
|
||||
buf, len, &data);
|
||||
if (ret){
|
||||
@@ -331,7 +331,7 @@ krb5_make_context (kx_context *kc)
|
||||
kc->data = malloc(sizeof(krb5_kx_context));
|
||||
|
||||
if (kc->data == NULL) {
|
||||
syslog (LOG_ERR, "failed to malloc %lu bytes",
|
||||
syslog (LOG_ERR, "failed to malloc %lu bytes",
|
||||
(unsigned long)sizeof(krb5_kx_context));
|
||||
exit(1);
|
||||
}
|
||||
|
30
appl/kx/kx.c
30
appl/kx/kx.c
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-2003 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -48,7 +48,7 @@ childhandler (int sig)
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
do {
|
||||
do {
|
||||
pid = waitpid (-1, &status, WNOHANG|WUNTRACED);
|
||||
if (pid > 0 && (WIFEXITED(status) || WIFSIGNALED(status)))
|
||||
if (--nchild == 0 && donep)
|
||||
@@ -114,7 +114,7 @@ connect_host (kx_context *kc)
|
||||
warnx ("%s: %s", kc->host, gai_strerror(error));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for (a = ai; a != NULL; a = a->ai_next) {
|
||||
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
|
||||
if (s < 0)
|
||||
@@ -279,7 +279,7 @@ doit_passive (kx_context *kc)
|
||||
p++;
|
||||
p += kx_get_int (p, &tmp, 4, 0);
|
||||
}
|
||||
|
||||
|
||||
++nchild;
|
||||
child = fork ();
|
||||
if (child < 0) {
|
||||
@@ -292,7 +292,7 @@ doit_passive (kx_context *kc)
|
||||
close (otherside);
|
||||
|
||||
socket_set_port(kc->thataddr, htons(tmp));
|
||||
|
||||
|
||||
fd = socket (kc->thataddr->sa_family, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
err(1, "socket");
|
||||
@@ -337,7 +337,7 @@ doit_passive (kx_context *kc)
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a local pseudo-xserver and wait for connections
|
||||
* Allocate a local pseudo-xserver and wait for connections
|
||||
*/
|
||||
|
||||
static int
|
||||
@@ -384,7 +384,7 @@ doit_active (kx_context *kc)
|
||||
--rem;
|
||||
|
||||
str = getenv("DISPLAY");
|
||||
if (str == NULL || (str = strchr(str, ':')) == NULL)
|
||||
if (str == NULL || (str = strchr(str, ':')) == NULL)
|
||||
str = ":0";
|
||||
len = strlen (str);
|
||||
tmp = kx_put_int (len, p, rem, 4);
|
||||
@@ -449,7 +449,7 @@ doit_active (kx_context *kc)
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
for (i = 0; i < nsockets; ++i) {
|
||||
if (sockets[i].fd >= FD_SETSIZE)
|
||||
if (sockets[i].fd >= FD_SETSIZE)
|
||||
errx (1, "fd too large");
|
||||
FD_SET(sockets[i].fd, &fdset);
|
||||
}
|
||||
@@ -575,7 +575,7 @@ doit (kx_context *kc, int passive_flag)
|
||||
*/
|
||||
|
||||
static int
|
||||
doit_v4 (const char *host, int port, const char *user,
|
||||
doit_v4 (const char *host, int port, const char *user,
|
||||
int passive_flag, int debug_flag, int keepalive_flag, int tcp_flag)
|
||||
{
|
||||
int ret;
|
||||
@@ -742,7 +742,7 @@ main(int argc, char **argv)
|
||||
use_v4 = 0;
|
||||
if(use_v5 == -1 && use_v4 == 1)
|
||||
use_v5 = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef KRB5
|
||||
if (ret && use_v5) {
|
||||
@@ -756,7 +756,7 @@ main(int argc, char **argv)
|
||||
if (ret && use_v4) {
|
||||
if (port == 0)
|
||||
port = k_getportbyname("kx", "tcp", htons(KX_PORT));
|
||||
ret = doit_v4 (host, port, user,
|
||||
ret = doit_v4 (host, port, user,
|
||||
passive_flag, debug_flag, keepalive_flag, tcp_flag);
|
||||
}
|
||||
#endif
|
||||
|
10
appl/kx/kx.h
10
appl/kx/kx.h
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2003 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -48,7 +48,7 @@ childhandler (int sig)
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
do {
|
||||
do {
|
||||
pid = waitpid (-1, &status, WNOHANG|WUNTRACED);
|
||||
if (pid > 0 && pid == wait_on_pid)
|
||||
done = 1;
|
||||
@@ -141,7 +141,7 @@ recv_conn (int sock, kx_context *kc,
|
||||
}
|
||||
kc->thataddr_len = addrlen;
|
||||
|
||||
getnameinfo_verified (kc->thataddr,
|
||||
getnameinfo_verified (kc->thataddr,
|
||||
kc->thataddr_len,
|
||||
remotehost, sizeof(remotehost),
|
||||
NULL, 0, 0);
|
||||
@@ -232,7 +232,7 @@ recv_conn (int sock, kx_context *kc,
|
||||
}
|
||||
|
||||
ret = getnameinfo(kc->thataddr, kc->thataddr_len,
|
||||
remoteaddr, sizeof(remoteaddr),
|
||||
remoteaddr, sizeof(remoteaddr),
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
if (ret != 0)
|
||||
fatal (kc, sock, "getnameinfo failed: %s", gai_strerror(ret));
|
||||
@@ -399,7 +399,7 @@ close_connection(int fd, const char *message)
|
||||
mlen = strlen(message);
|
||||
if(mlen > 255)
|
||||
mlen = 255;
|
||||
|
||||
|
||||
/* read first part of connection packet, to get byte order */
|
||||
if(read(fd, buf, 6) != 6) {
|
||||
close(fd);
|
||||
@@ -418,7 +418,7 @@ close_connection(int fd, const char *message)
|
||||
*p++ = 0;
|
||||
|
||||
/* now fill in length of additional data */
|
||||
if(lsb) {
|
||||
if(lsb) {
|
||||
buf[6] = (p - buf - 8) / 4;
|
||||
buf[7] = 0;
|
||||
}else{
|
||||
@@ -454,7 +454,7 @@ doit_passive (kx_context *kc,
|
||||
snprintf (display, display_size, "localhost:%u", display_num);
|
||||
else
|
||||
snprintf (display, display_size, ":%u", display_num);
|
||||
error = create_and_write_cookie (xauthfile, xauthfile_size,
|
||||
error = create_and_write_cookie (xauthfile, xauthfile_size,
|
||||
cookie, cookie_len);
|
||||
if (error) {
|
||||
cleanup(nsockets, sockets);
|
||||
@@ -494,7 +494,7 @@ doit_passive (kx_context *kc,
|
||||
memcpy (p, xauthfile, len);
|
||||
p += len;
|
||||
rem -= len;
|
||||
|
||||
|
||||
if(kx_write (kc, sock, msg, p - msg) < 0) {
|
||||
syslog (LOG_ERR, "write: %m");
|
||||
cleanup(nsockets, sockets);
|
||||
@@ -507,7 +507,7 @@ doit_passive (kx_context *kc,
|
||||
int i;
|
||||
int ret;
|
||||
int cookiesp = TRUE;
|
||||
|
||||
|
||||
FD_ZERO(&fds);
|
||||
if (sock >= FD_SETSIZE) {
|
||||
syslog (LOG_ERR, "fd too large");
|
||||
@@ -632,7 +632,7 @@ doit_active (kx_context *kc,
|
||||
|
||||
p = msg;
|
||||
*p++ = ACK;
|
||||
|
||||
|
||||
if(kx_write (kc, sock, msg, p - msg) < 0) {
|
||||
syslog (LOG_ERR, "write: %m");
|
||||
return 1;
|
||||
@@ -640,7 +640,7 @@ doit_active (kx_context *kc,
|
||||
for (;;) {
|
||||
pid_t child;
|
||||
int len;
|
||||
|
||||
|
||||
len = kx_read (kc, sock, msg, sizeof(msg));
|
||||
if (len < 0) {
|
||||
syslog (LOG_ERR, "read: %m");
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -59,13 +59,13 @@ add_env(const char *var, const char *value)
|
||||
if(str == NULL)
|
||||
errx(1, "Out of memory!");
|
||||
for(i = 0; i < num_env; i++)
|
||||
if(strncmp(env[i], var, strlen(var)) == 0 &&
|
||||
if(strncmp(env[i], var, strlen(var)) == 0 &&
|
||||
env[i][strlen(var)] == '='){
|
||||
free(env[i]);
|
||||
env[i] = str;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extend_env(str);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ login_read_env(const char *file)
|
||||
char **newenv;
|
||||
char *p;
|
||||
int i, j;
|
||||
|
||||
|
||||
newenv = NULL;
|
||||
i = read_environment(file, &newenv);
|
||||
for (j = 0; j < i; j++) {
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -91,7 +91,7 @@ find_limit(const char *name)
|
||||
/* this function reads limits.conf files similar to pam_limits
|
||||
unimplemented features include:
|
||||
% maxlogins
|
||||
"-" no limits,
|
||||
"-" no limits,
|
||||
priorities etc that are not set via setrlimit
|
||||
XXX uses static storage, and clobbers getgr*
|
||||
*/
|
||||
@@ -131,7 +131,7 @@ read_limits_conf(const char *file, const struct passwd *pwd)
|
||||
int c;
|
||||
while((c = fgetc(f)) != EOF) {
|
||||
eof = 0;
|
||||
if(c == '\n')
|
||||
if(c == '\n')
|
||||
break;
|
||||
}
|
||||
if(!eof) {
|
||||
@@ -197,7 +197,7 @@ read_limits_conf(const char *file, const struct passwd *pwd)
|
||||
we set hard to soft? this code doesn't. */
|
||||
if(strcasecmp(args[1], "soft") == 0 || strcmp(args[1], "-") == 0)
|
||||
l->limit.rlim_cur = value;
|
||||
if(strcasecmp(args[1], "hard") == 0 || strcmp(args[1], "-") == 0)
|
||||
if(strcasecmp(args[1], "hard") == 0 || strcmp(args[1], "-") == 0)
|
||||
l->limit.rlim_max = value;
|
||||
}
|
||||
fclose(f);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -100,7 +100,7 @@ start_logout_process(void)
|
||||
execle(prog, argv0, NULL, env);
|
||||
err(1, "exec %s", prog);
|
||||
}
|
||||
} else if(ret < 0)
|
||||
} else if(ret < 0)
|
||||
err(1, "waitpid");
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ exec_shell(const char *shell, int fallback)
|
||||
{
|
||||
char *sh;
|
||||
const char *p;
|
||||
|
||||
|
||||
extend_env(NULL);
|
||||
if(start_login_process() < 0)
|
||||
warn("login process");
|
||||
@@ -125,7 +125,7 @@ exec_shell(const char *shell, int fallback)
|
||||
errx(1, "Out of memory");
|
||||
execle(shell, sh, NULL, env);
|
||||
if(fallback){
|
||||
warnx("Can't exec %s, trying %s",
|
||||
warnx("Can't exec %s, trying %s",
|
||||
shell, _PATH_BSHELL);
|
||||
execle(_PATH_BSHELL, "-sh", NULL, env);
|
||||
err(1, "%s", _PATH_BSHELL);
|
||||
@@ -171,9 +171,9 @@ krb5_verify(struct passwd *pwd, const char *password)
|
||||
return 1;
|
||||
}
|
||||
ret = krb5_verify_user_lrealm(context,
|
||||
princ,
|
||||
princ,
|
||||
id,
|
||||
password,
|
||||
password,
|
||||
1,
|
||||
NULL);
|
||||
krb5_free_principal(context, princ);
|
||||
@@ -189,15 +189,15 @@ krb5_to4 (krb5_ccache id)
|
||||
|
||||
ret = krb5_cc_get_principal(context, id, &princ);
|
||||
if(ret == 0) {
|
||||
krb5_appdefault_boolean(context, "login",
|
||||
krb5_principal_get_realm(context, princ),
|
||||
krb5_appdefault_boolean(context, "login",
|
||||
krb5_principal_get_realm(context, princ),
|
||||
"krb4_get_tickets", FALSE, &get_v4_tgt);
|
||||
krb5_free_principal(context, princ);
|
||||
} else {
|
||||
krb5_realm realm = NULL;
|
||||
krb5_get_default_realm(context, &realm);
|
||||
krb5_appdefault_boolean(context, "login",
|
||||
realm,
|
||||
krb5_appdefault_boolean(context, "login",
|
||||
realm,
|
||||
"krb4_get_tickets", FALSE, &get_v4_tgt);
|
||||
free(realm);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ krb5_start_session (const struct passwd *pwd)
|
||||
char residual[64];
|
||||
|
||||
/* copy credentials to file cache */
|
||||
snprintf(residual, sizeof(residual), "FILE:/tmp/krb5cc_%u",
|
||||
snprintf(residual, sizeof(residual), "FILE:/tmp/krb5cc_%u",
|
||||
(unsigned)pwd->pw_uid);
|
||||
krb5_cc_resolve(context, residual, &id2);
|
||||
ret = krb5_cc_copy_cache(context, id, id2);
|
||||
@@ -289,7 +289,7 @@ krb5_get_afs_tokens (const struct passwd *pwd)
|
||||
return;
|
||||
|
||||
ret = krb5_cc_default(context, &id2);
|
||||
|
||||
|
||||
if (ret == 0) {
|
||||
pw_dir = pwd->pw_dir;
|
||||
|
||||
@@ -436,7 +436,7 @@ show_file(const char *file)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Actually log in the user. `pwd' contains all the relevant
|
||||
* information about the user. `ttyn' is the complete name of the tty
|
||||
* and `tty' the short name.
|
||||
@@ -456,7 +456,7 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
|
||||
|
||||
if(!rootlogin)
|
||||
checknologin();
|
||||
|
||||
|
||||
#ifdef HAVE_GETSPNAM
|
||||
sp = getspnam(pwd->pw_name);
|
||||
#endif
|
||||
@@ -496,7 +496,7 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
|
||||
|
||||
read_limits_conf(file, pwd);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SETPCRED
|
||||
if (setpcred (pwd->pw_name, NULL) == -1)
|
||||
warn("setpcred(%s)", pwd->pw_name);
|
||||
@@ -523,7 +523,7 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
|
||||
|
||||
/* make sure signals are set to default actions, apparently some
|
||||
OS:es like to ignore SIGINT, which is not very convenient */
|
||||
|
||||
|
||||
for (i = 1; i < NSIG; ++i)
|
||||
signal(i, SIG_DFL);
|
||||
|
||||
@@ -726,7 +726,7 @@ main(int argc, char **argv)
|
||||
|
||||
int ask = 1;
|
||||
struct sigaction sa;
|
||||
|
||||
|
||||
setprogname(argv[0]);
|
||||
|
||||
#ifdef KRB5
|
||||
@@ -862,7 +862,7 @@ main(int argc, char **argv)
|
||||
tty = ttyn + strlen(_PATH_DEV);
|
||||
else
|
||||
tty = ttyn;
|
||||
|
||||
|
||||
if (login_access (pwd, remote_host ? remote_host : tty) == 0) {
|
||||
fprintf(stderr, "Permission denied\n");
|
||||
if (remote_host)
|
||||
|
@@ -101,13 +101,13 @@ int login_access(struct passwd *user, char *from)
|
||||
|| !(users = strtok_r(NULL, fs, &foo))
|
||||
|| !(froms = strtok_r(NULL, fs, &foo))
|
||||
|| strtok_r(NULL, fs, &foo)) {
|
||||
syslog(LOG_ERR, "%s: line %d: bad field count",
|
||||
syslog(LOG_ERR, "%s: line %d: bad field count",
|
||||
_PATH_LOGACCESS,
|
||||
lineno);
|
||||
continue;
|
||||
}
|
||||
if (perm[0] != '+' && perm[0] != '-') {
|
||||
syslog(LOG_ERR, "%s: line %d: bad first field",
|
||||
syslog(LOG_ERR, "%s: line %d: bad first field",
|
||||
_PATH_LOGACCESS,
|
||||
lineno);
|
||||
continue;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -40,15 +40,15 @@ do_osfc2_magic(uid_t uid)
|
||||
#ifdef HAVE_OSFC2
|
||||
struct es_passwd *epw;
|
||||
char *argv[2];
|
||||
|
||||
|
||||
/* fake */
|
||||
argv[0] = (char*)getprogname();
|
||||
argv[1] = NULL;
|
||||
set_auth_parameters(1, argv);
|
||||
|
||||
|
||||
epw = getespwuid(uid);
|
||||
if(epw == NULL) {
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
"getespwuid failed for %d", uid);
|
||||
printf("Sorry.\n");
|
||||
return 1;
|
||||
@@ -59,17 +59,17 @@ do_osfc2_magic(uid_t uid)
|
||||
any other kind of serious C2 mumbo-jumbo. We do,
|
||||
however, call setluid, since failing to do so is not
|
||||
very good (take my word for it). */
|
||||
|
||||
|
||||
if(!epw->uflg->fg_uid) {
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
"attempted login by %s (has no uid)", epw->ufld->fd_name);
|
||||
printf("Sorry.\n");
|
||||
return 1;
|
||||
}
|
||||
setluid(epw->ufld->fd_uid);
|
||||
if(getluid() != epw->ufld->fd_uid) {
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
"failed to set LUID for %s (%d)",
|
||||
syslog(LOG_AUTHPRIV|LOG_NOTICE,
|
||||
"failed to set LUID for %s (%d)",
|
||||
epw->ufld->fd_name, epw->ufld->fd_uid);
|
||||
printf("Sorry.\n");
|
||||
return 1;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -69,13 +69,13 @@ read_string(const char *prompt, char *buf, size_t len, int echo)
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
for(i = 1; i < sizeof(sigs) / sizeof(sigs[0]); i++)
|
||||
if (i != SIGALRM)
|
||||
if (i != SIGALRM)
|
||||
if (sigaction(i, &sa, &sigs[i]) == 0)
|
||||
oksigs[i] = 1;
|
||||
|
||||
if((tty = fopen("/dev/tty", "r")) == NULL)
|
||||
tty = stdin;
|
||||
|
||||
|
||||
fprintf(stderr, "%s", prompt);
|
||||
fflush(stderr);
|
||||
|
||||
@@ -103,19 +103,19 @@ read_string(const char *prompt, char *buf, size_t len, int echo)
|
||||
if(of)
|
||||
p--;
|
||||
*p = 0;
|
||||
|
||||
|
||||
if(echo == 0){
|
||||
printf("\n");
|
||||
tcsetattr(fileno(tty), TCSANOW, &t_old);
|
||||
}
|
||||
|
||||
|
||||
if(tty != stdin)
|
||||
fclose(tty);
|
||||
|
||||
for(i = 1; i < sizeof(sigs) / sizeof(sigs[0]); i++)
|
||||
if (oksigs[i])
|
||||
sigaction(i, &sigs[i], NULL);
|
||||
|
||||
|
||||
if(ret)
|
||||
return -3;
|
||||
if(intr_flag)
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "login_locl.h"
|
||||
@@ -60,13 +60,13 @@ change_passwd(const struct passwd *who)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
check_shadow(const struct passwd *pw, const struct spwd *sp)
|
||||
{
|
||||
long today;
|
||||
|
||||
today = time(0)/(24L * 60 * 60);
|
||||
|
||||
|
||||
if (sp == NULL)
|
||||
return;
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -95,6 +95,6 @@ stty_default(void)
|
||||
termios.c_cc[VEOF] = Ctl('D');
|
||||
|
||||
termios.c_cc[VSUSP] = Ctl('Z');
|
||||
|
||||
|
||||
tcsetattr(0, TCSANOW, &termios);
|
||||
}
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -61,7 +61,7 @@ char *
|
||||
make_id (char *tty)
|
||||
{
|
||||
char *res = tty;
|
||||
|
||||
|
||||
if (strncmp (res, "pts/", 4) == 0)
|
||||
res += 4;
|
||||
if (strncmp (res, "tty", 3) == 0)
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -79,7 +79,7 @@ shrink_hostname (const char *hostname,
|
||||
|
||||
#ifdef HAVE_UTMPX_H
|
||||
void utmp_login(char *tty, const char *username, const char *hostname)
|
||||
{
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else
|
||||
@@ -87,7 +87,7 @@ void utmp_login(char *tty, const char *username, const char *hostname)
|
||||
/* update utmp and wtmp - the BSD way */
|
||||
|
||||
static void
|
||||
prepare_utmp (struct utmp *utmp, char *tty,
|
||||
prepare_utmp (struct utmp *utmp, char *tty,
|
||||
const char *username, const char *hostname)
|
||||
{
|
||||
char *ttyx = clean_ttyname (tty);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-1997, 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -50,9 +50,9 @@ struct getargs args[] = {
|
||||
{ "delete", 'd', arg_flag, &deletep, "delete OTP" },
|
||||
{ "open", 'o', arg_flag, &openp, "open a locked OTP" },
|
||||
{ "renew", 'r', arg_flag, &renewp, "securely renew OTP" },
|
||||
{ "hash", 'f', arg_string, &alg_string,
|
||||
{ "hash", 'f', arg_string, &alg_string,
|
||||
"hash algorithm (md4, md5, or sha)", "algorithm"},
|
||||
{ "user", 'u', arg_string, &user,
|
||||
{ "user", 'u', arg_string, &user,
|
||||
"user other than current user (root only)", "user" },
|
||||
{ "version", 0, arg_flag, &version_flag },
|
||||
{ "help", 'h', arg_flag, &help_flag }
|
||||
@@ -67,8 +67,8 @@ usage(int code)
|
||||
exit(code);
|
||||
}
|
||||
|
||||
/*
|
||||
* Renew the OTP for a user.
|
||||
/*
|
||||
* Renew the OTP for a user.
|
||||
* The pass-phrase is not required (RFC 1938/8.0)
|
||||
*/
|
||||
|
||||
@@ -89,7 +89,7 @@ renew (int argc, char **argv, OtpAlgorithm *alg, char *user)
|
||||
snprintf (prompt, sizeof(prompt),
|
||||
"[ otp-%s %u %s ]",
|
||||
newctx.alg->name,
|
||||
newctx.n,
|
||||
newctx.n,
|
||||
newctx.seed);
|
||||
if (UI_UTIL_read_pw_string (pw, sizeof(pw), prompt, 0) == 0 &&
|
||||
otp_parse (newctx.key, pw, alg) == 0) {
|
||||
@@ -113,7 +113,7 @@ renew (int argc, char **argv, OtpAlgorithm *alg, char *user)
|
||||
* I would rather have returned !=0 but it's shell-like here around.
|
||||
*/
|
||||
|
||||
static int
|
||||
static int
|
||||
verify_user_otp(char *username)
|
||||
{
|
||||
OtpContext ctx;
|
||||
@@ -122,7 +122,7 @@ verify_user_otp(char *username)
|
||||
|
||||
if (otp_challenge (&ctx, username, ss, sizeof(ss)) != 0) {
|
||||
warnx("no otp challenge found for %s", username);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf (prompt, sizeof(prompt), "%s's %s Password: ", username, ss);
|
||||
@@ -131,7 +131,7 @@ verify_user_otp(char *username)
|
||||
return otp_verify_user (&ctx, passwd);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Set the OTP for a user
|
||||
*/
|
||||
|
||||
@@ -194,7 +194,7 @@ delete_otp (int argc, char **argv, char *user)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Tell whether the user has an otp
|
||||
*/
|
||||
|
||||
@@ -210,9 +210,9 @@ has_an_otp(char *user)
|
||||
warnx ("otp_db_open failed");
|
||||
return 0; /* if no db no otp! */
|
||||
}
|
||||
|
||||
|
||||
ctx.user = user;
|
||||
ret = otp_simple_get(db, &ctx);
|
||||
ret = otp_simple_get(db, &ctx);
|
||||
|
||||
otp_db_close (db);
|
||||
return !ret;
|
||||
@@ -251,7 +251,7 @@ open_otp (int argc, char **argv, char *user)
|
||||
db = otp_db_open ();
|
||||
if (db == NULL)
|
||||
errx (1, "otp_db_open failed");
|
||||
|
||||
|
||||
ctx.user = user;
|
||||
ret = otp_simple_get (db, &ctx);
|
||||
if (ret == 0)
|
||||
@@ -292,7 +292,7 @@ main (int argc, char **argv)
|
||||
int uid = getuid();
|
||||
OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT);
|
||||
int optind = 0;
|
||||
|
||||
|
||||
setprogname (argv[0]);
|
||||
if(getarg(args, num_args, argc, argv, &optind))
|
||||
usage(1);
|
||||
@@ -318,7 +318,7 @@ main (int argc, char **argv)
|
||||
if (!(listp || deletep || renewp || openp))
|
||||
defaultp = 1;
|
||||
|
||||
if ( listp + deletep + renewp + defaultp + openp != 1)
|
||||
if ( listp + deletep + renewp + defaultp + openp != 1)
|
||||
usage(1); /* one of -d or -l or -r or none */
|
||||
|
||||
if(deletep || openp || listp) {
|
||||
@@ -339,7 +339,7 @@ main (int argc, char **argv)
|
||||
err (1, "You don't exist");
|
||||
user = pwd->pw_name;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* users other that root must provide the next OTP to update the sequence.
|
||||
* it avoids someone to use a pending session to change an OTP sequence.
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -47,7 +47,7 @@ struct getargs args[] = {
|
||||
{ "extended", 'e', arg_flag, &extendedp, "print keys in extended format" },
|
||||
{ "count", 'n', arg_integer, &count, "number of keys to print" },
|
||||
{ "hexadecimal", 'h', arg_flag, &hexp, "output in hexadecimal" },
|
||||
{ "hash", 'f', arg_string, &alg_string,
|
||||
{ "hash", 'f', arg_string, &alg_string,
|
||||
"hash algorithm (md4, md5, or sha)", "algorithm"},
|
||||
{ "version", 0, arg_flag, &version_flag },
|
||||
{ "help", 0, arg_flag, &help_flag }
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include <popper.h>
|
||||
@@ -70,7 +70,7 @@ gss_set_error (struct gss_state *gs, int min_stat)
|
||||
}
|
||||
|
||||
static int
|
||||
gss_loop(POP *p, void *state,
|
||||
gss_loop(POP *p, void *state,
|
||||
/* const */ void *input, size_t input_length,
|
||||
void **output, size_t *output_length)
|
||||
{
|
||||
@@ -128,12 +128,12 @@ gss_loop(POP *p, void *state,
|
||||
input_token->value = x;
|
||||
input_token->length = 4;
|
||||
|
||||
maj_stat = gss_wrap(&min_stat,
|
||||
gs->context_hdl,
|
||||
maj_stat = gss_wrap(&min_stat,
|
||||
gs->context_hdl,
|
||||
FALSE,
|
||||
GSS_C_QOP_DEFAULT,
|
||||
input_token,
|
||||
NULL,
|
||||
input_token,
|
||||
NULL,
|
||||
output_token);
|
||||
if (GSS_ERROR(maj_stat)) {
|
||||
gss_set_error(gs, min_stat);
|
||||
@@ -157,9 +157,9 @@ gss_loop(POP *p, void *state,
|
||||
|
||||
maj_stat = gss_unwrap (&min_stat,
|
||||
gs->context_hdl,
|
||||
input_token,
|
||||
input_token,
|
||||
output_token,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
if (GSS_ERROR(maj_stat)) {
|
||||
gss_set_error(gs, min_stat);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include <popper.h>
|
||||
@@ -47,7 +47,7 @@ struct krb4_state {
|
||||
};
|
||||
|
||||
static int
|
||||
krb4_loop(POP *p, void *state,
|
||||
krb4_loop(POP *p, void *state,
|
||||
/* const */ void *input, size_t input_length,
|
||||
void **output, size_t *output_length)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ krb4_loop(POP *p, void *state,
|
||||
int ret;
|
||||
des_cblock key;
|
||||
unsigned char *data;
|
||||
char instance[INST_SZ];
|
||||
char instance[INST_SZ];
|
||||
des_key_schedule schedule;
|
||||
|
||||
if(ks->stage == 0) {
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1998 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include <popper.h>
|
||||
@@ -38,7 +38,7 @@ RCSID("$Id$");
|
||||
static void
|
||||
make_path(POP *p, MsgInfoList *mp, int new, char *buf, size_t len)
|
||||
{
|
||||
snprintf(buf, len, "%s/%s%s%s", p->drop_name,
|
||||
snprintf(buf, len, "%s/%s%s%s", p->drop_name,
|
||||
new ? "new" : "cur", mp ? "/" : "", mp ? mp->name : "");
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ scan_file(POP *p, MsgInfoList *mp)
|
||||
if(f == NULL) {
|
||||
#ifdef DEBUG
|
||||
if(p->debug)
|
||||
pop_log(p, POP_DEBUG,
|
||||
"Failed to open message file `%s': %s",
|
||||
pop_log(p, POP_DEBUG,
|
||||
"Failed to open message file `%s': %s",
|
||||
path, strerror(errno));
|
||||
#endif
|
||||
return pop_msg (p, POP_FAILURE,
|
||||
@@ -128,7 +128,7 @@ int
|
||||
pop_maildir_info(POP *p)
|
||||
{
|
||||
int e;
|
||||
|
||||
|
||||
p->temp_drop[0] = '\0';
|
||||
p->mlp = NULL;
|
||||
p->msg_count = 0;
|
||||
@@ -147,7 +147,7 @@ pop_maildir_update(POP *p)
|
||||
int i;
|
||||
char tmp1[MAXPATHLEN], tmp2[MAXPATHLEN];
|
||||
for(i = 0; i < p->msg_count; i++) {
|
||||
make_path(p, &p->mlp[i], p->mlp[i].flags & NEW_FLAG,
|
||||
make_path(p, &p->mlp[i], p->mlp[i].flags & NEW_FLAG,
|
||||
tmp1, sizeof(tmp1));
|
||||
if(p->mlp[i].flags & DEL_FLAG) {
|
||||
#ifdef DEBUG
|
||||
@@ -157,12 +157,12 @@ pop_maildir_update(POP *p)
|
||||
if(unlink(tmp1) < 0) {
|
||||
#ifdef DEBUG
|
||||
if(p->debug)
|
||||
pop_log(p, POP_DEBUG, "Failed to remove `%s': %s",
|
||||
pop_log(p, POP_DEBUG, "Failed to remove `%s': %s",
|
||||
tmp1, strerror(errno));
|
||||
#endif
|
||||
/* return failure? */
|
||||
}
|
||||
} else if((p->mlp[i].flags & NEW_FLAG) &&
|
||||
} else if((p->mlp[i].flags & NEW_FLAG) &&
|
||||
(p->mlp[i].flags & RETR_FLAG)) {
|
||||
make_path(p, &p->mlp[i], 0, tmp2, sizeof(tmp2));
|
||||
#ifdef DEBUG
|
||||
@@ -185,13 +185,13 @@ pop_maildir_update(POP *p)
|
||||
if(errno == EXDEV) {
|
||||
#ifdef DEBUG
|
||||
if(p->debug)
|
||||
pop_log(p, POP_DEBUG, "Trying to rename `%s' to `%s'",
|
||||
pop_log(p, POP_DEBUG, "Trying to rename `%s' to `%s'",
|
||||
tmp1, tmp2);
|
||||
#endif
|
||||
if(rename(tmp1, tmp2) < 0) {
|
||||
#ifdef DEBUG
|
||||
if(p->debug)
|
||||
pop_log(p, POP_DEBUG, "Failed to rename `%s' to `%s'",
|
||||
pop_log(p, POP_DEBUG, "Failed to rename `%s' to `%s'",
|
||||
tmp1, tmp2);
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include <popper.h>
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <pop_auth.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* auth: RFC1734
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ getline(POP *p)
|
||||
p--;
|
||||
*p = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
/* just assume we ran out of buffer space, we'll catch eof
|
||||
next round */
|
||||
size += 1024;
|
||||
@@ -146,7 +146,7 @@ auth_loop(POP *p, struct auth_mech *m)
|
||||
status = auth_execute(p, m, state, line);
|
||||
free(line);
|
||||
}
|
||||
|
||||
|
||||
|
||||
(*m->cleanup)(p, state);
|
||||
if(status == POP_AUTH_FAILURE)
|
||||
@@ -177,7 +177,7 @@ pop_capa_sasl(POP *p)
|
||||
|
||||
if(methods[0] == NULL)
|
||||
return;
|
||||
|
||||
|
||||
fprintf(p->output, "SASL");
|
||||
for (i = 0; methods[i] != NULL; ++i)
|
||||
fprintf(p->output, " %s", methods[i]->name);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -70,7 +70,7 @@ get_socket (const char *hostname, int port)
|
||||
struct addrinfo *ai, *a;
|
||||
struct addrinfo hints;
|
||||
char portstr[NI_MAXSERV];
|
||||
|
||||
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
snprintf (portstr, sizeof(portstr), "%d", ntohs(port));
|
||||
@@ -107,7 +107,7 @@ doit_v4 (char *host, int port)
|
||||
|
||||
ret = krb_sendauth(0,
|
||||
s,
|
||||
&ticket,
|
||||
&ticket,
|
||||
"pop",
|
||||
host,
|
||||
krb_realmofhost(host),
|
||||
@@ -140,7 +140,7 @@ doit_v5 (char *host, int port)
|
||||
ret = krb5_init_context (&context);
|
||||
if (ret)
|
||||
errx (1, "krb5_init_context failed: %d", ret);
|
||||
|
||||
|
||||
ret = krb5_sname_to_principal (context,
|
||||
host,
|
||||
"pop",
|
||||
@@ -268,7 +268,7 @@ main(int argc, char **argv)
|
||||
use_v4 = 0;
|
||||
if(use_v5 == -1 && use_v4 == 1)
|
||||
use_v5 = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef KRB5
|
||||
if (ret && use_v5) {
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* dele: Delete a message from the POP maildrop
|
||||
*/
|
||||
int
|
||||
@@ -45,7 +45,7 @@ pop_dele (POP *p)
|
||||
p->msgs_deleted++;
|
||||
p->bytes_deleted += mp->length;
|
||||
|
||||
/* Update the last-message-accessed number if it is lower than
|
||||
/* Update the last-message-accessed number if it is lower than
|
||||
the deleted message */
|
||||
if (p->last_msg < msg_num) p->last_msg = msg_num;
|
||||
|
||||
@@ -96,12 +96,12 @@ pop_xdele(POP *p)
|
||||
p->bytes_deleted += mp->length;
|
||||
}
|
||||
|
||||
/* Update the last-message-accessed number if it is lower than
|
||||
/* Update the last-message-accessed number if it is lower than
|
||||
the deleted message */
|
||||
if (p->last_msg < msg_max) p->last_msg = msg_max;
|
||||
|
||||
|
||||
return (pop_msg (p,POP_SUCCESS,"Messages %d-%d has been deleted.",
|
||||
msg_min, msg_max));
|
||||
|
||||
|
||||
}
|
||||
#endif /* XDELE */
|
||||
|
@@ -39,17 +39,17 @@ changeuser(POP *p, struct passwd *pwd)
|
||||
return POP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* dropcopy: Make a temporary copy of the user's mail drop and
|
||||
/*
|
||||
* dropcopy: Make a temporary copy of the user's mail drop and
|
||||
* save a stream pointer for it.
|
||||
*/
|
||||
|
||||
int
|
||||
pop_dropcopy(POP *p, struct passwd *pwp)
|
||||
{
|
||||
int mfd; /* File descriptor for
|
||||
int mfd; /* File descriptor for
|
||||
the user's maildrop */
|
||||
int dfd; /* File descriptor for
|
||||
int dfd; /* File descriptor for
|
||||
the SERVER maildrop */
|
||||
FILE *tf; /* The temp file */
|
||||
char template[POP_TMPSIZE]; /* Temp name holder */
|
||||
@@ -110,11 +110,11 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
||||
}
|
||||
|
||||
/* Lock the temporary maildrop */
|
||||
if ( flock (dfd, (LOCK_EX | LOCK_NB)) == -1 )
|
||||
if ( flock (dfd, (LOCK_EX | LOCK_NB)) == -1 )
|
||||
switch(errno) {
|
||||
case EWOULDBLOCK:
|
||||
return pop_msg(p,POP_FAILURE,
|
||||
"%sMaildrop lock busy! Is another session active?",
|
||||
"%sMaildrop lock busy! Is another session active?",
|
||||
(p->flags & POP_FLAG_CAPA) ? "[IN-USE] " : "");
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
@@ -122,7 +122,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
||||
strerror(errno));
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
||||
/* May have grown or shrunk between open and lock! */
|
||||
offset = lseek(dfd,0, SEEK_END);
|
||||
|
||||
@@ -145,7 +145,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
||||
|
||||
if ( nchar != 0 ) {
|
||||
/* Error adding new mail. Truncate to original size,
|
||||
and leave the maildrop as is. The user will not
|
||||
and leave the maildrop as is. The user will not
|
||||
see the new mail until the error goes away.
|
||||
Should let them process the current backlog, in case
|
||||
the error is a quota problem requiring deletions! */
|
||||
|
@@ -55,10 +55,10 @@ parse_header(MsgInfoList *mp, char *buffer)
|
||||
if (strncasecmp("Message-Id:",buffer, 11) == 0) {
|
||||
if (mp->msg_id == NULL)
|
||||
mp->msg_id = find_value_after_colon(buffer);
|
||||
}
|
||||
}
|
||||
#ifdef UIDL
|
||||
else if (strncasecmp(buffer, "X-UIDL:", 7) == 0) {
|
||||
/* Courtesy to Qualcomm, there really is no such
|
||||
/* Courtesy to Qualcomm, there really is no such
|
||||
thing as X-UIDL */
|
||||
mp->msg_id = find_value_after_colon(buffer);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ add_missing_headers(POP *p, MsgInfoList *mp)
|
||||
p->user);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef XOVER
|
||||
if (mp->subject == NULL)
|
||||
mp->subject = "<none>";
|
||||
@@ -117,8 +117,8 @@ add_missing_headers(POP *p, MsgInfoList *mp)
|
||||
return POP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* dropinfo: Extract information about the POP maildrop and store
|
||||
/*
|
||||
* dropinfo: Extract information about the POP maildrop and store
|
||||
* it for use by the other POP routines.
|
||||
*/
|
||||
|
||||
@@ -126,14 +126,14 @@ int
|
||||
pop_dropinfo(POP *p)
|
||||
{
|
||||
char buffer[BUFSIZ]; /* Read buffer */
|
||||
MsgInfoList * mp; /* Pointer to message
|
||||
MsgInfoList * mp; /* Pointer to message
|
||||
info list */
|
||||
int msg_num; /* Current message
|
||||
int msg_num; /* Current message
|
||||
counter */
|
||||
int nchar; /* Bytes written/read */
|
||||
int blank_line = 1; /* previous line was blank */
|
||||
int in_header = 0; /* if we are in a header block */
|
||||
|
||||
|
||||
/* Initialize maildrop status variables in the POP parameter block */
|
||||
p->msg_count = 0;
|
||||
p->msgs_deleted = 0;
|
||||
@@ -153,7 +153,7 @@ pop_dropinfo(POP *p)
|
||||
|
||||
rewind (p->drop);
|
||||
|
||||
/* Scan the file, loading the message information list with
|
||||
/* Scan the file, loading the message information list with
|
||||
information about each message */
|
||||
|
||||
for (msg_num = p->drop_size = 0, mp = p->mlp - 1;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* get_command: Extract the command from an input line form a POP client
|
||||
*/
|
||||
|
||||
@@ -133,7 +133,7 @@ pop_get_command(POP *p, char *mp)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return a pointer to the entry for this command in
|
||||
/* Return a pointer to the entry for this command in
|
||||
the command/state table */
|
||||
return (s);
|
||||
}
|
||||
|
@@ -34,12 +34,12 @@ pop_write_addr(POP *p, struct sockaddr *addr)
|
||||
return;
|
||||
t = time(NULL);
|
||||
strftime(ts, sizeof(ts), "%Y%m%d%H%M%S", localtime(&t));
|
||||
if(inet_ntop (addr->sa_family, socket_get_address(addr),
|
||||
if(inet_ntop (addr->sa_family, socket_get_address(addr),
|
||||
as, sizeof(as)) == NULL) {
|
||||
pop_log(p, POP_PRIORITY, "failed to print address");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
f = fopen(addr_log, "a");
|
||||
if(f == NULL) {
|
||||
pop_log(p, POP_PRIORITY, "failed to open address log (%s)", addr_log);
|
||||
@@ -55,10 +55,10 @@ krb4_authenticate (POP *p, int s, u_char *buf, struct sockaddr *addr)
|
||||
{
|
||||
Key_schedule schedule;
|
||||
KTEXT_ST ticket;
|
||||
char instance[INST_SZ];
|
||||
char instance[INST_SZ];
|
||||
char version[9];
|
||||
int auth;
|
||||
|
||||
|
||||
if (memcmp (buf, KRB_SENDAUTH_VERS, 4) != 0)
|
||||
return -1;
|
||||
if (pop_net_read (p, s, buf + 4,
|
||||
@@ -79,18 +79,18 @@ krb4_authenticate (POP *p, int s, u_char *buf, struct sockaddr *addr)
|
||||
"",
|
||||
schedule,
|
||||
version);
|
||||
|
||||
|
||||
if (auth != KSUCCESS) {
|
||||
pop_msg(p, POP_FAILURE, "Kerberos authentication failure: %s",
|
||||
pop_msg(p, POP_FAILURE, "Kerberos authentication failure: %s",
|
||||
krb_get_err_text(auth));
|
||||
pop_log(p, POP_PRIORITY, "%s: (%s.%s@%s) %s", p->client,
|
||||
pop_log(p, POP_PRIORITY, "%s: (%s.%s@%s) %s", p->client,
|
||||
p->kdata.pname, p->kdata.pinst, p->kdata.prealm,
|
||||
krb_get_err_text(auth));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
pop_log(p, POP_DEBUG, "%s.%s@%s (%s): ok", p->kdata.pname,
|
||||
pop_log(p, POP_DEBUG, "%s.%s@%s (%s): ok", p->kdata.pname,
|
||||
p->kdata.pinst, p->kdata.prealm, p->ipaddr);
|
||||
#endif /* DEBUG */
|
||||
return 0;
|
||||
@@ -134,7 +134,7 @@ krb5_authenticate (POP *p, int s, u_char *buf, struct sockaddr *addr)
|
||||
|
||||
ret = krb5_unparse_name(p->context, ticket->server, &server);
|
||||
if(ret) {
|
||||
pop_log(p, POP_PRIORITY, "krb5_unparse_name: %s",
|
||||
pop_log(p, POP_PRIORITY, "krb5_unparse_name: %s",
|
||||
krb5_get_err_text(p->context, ret));
|
||||
ret = -1;
|
||||
goto out;
|
||||
@@ -146,7 +146,7 @@ krb5_authenticate (POP *p, int s, u_char *buf, struct sockaddr *addr)
|
||||
ret = -1;
|
||||
goto out;
|
||||
} else if(p->debug)
|
||||
pop_log(p, POP_DEBUG,
|
||||
pop_log(p, POP_DEBUG,
|
||||
"Accepted ticket for service `%s'", server);
|
||||
free(server);
|
||||
out:
|
||||
@@ -210,7 +210,7 @@ static struct getargs args[] = {
|
||||
#if defined(KRB4) || defined(KRB5)
|
||||
{ "kerberos", 'k', arg_flag, &kerberos_flag, "use kerberos" },
|
||||
#endif
|
||||
{ "auth-mode", 'a', arg_string, &auth_str, "required authentication",
|
||||
{ "auth-mode", 'a', arg_string, &auth_str, "required authentication",
|
||||
"plaintext"
|
||||
#ifdef OTP
|
||||
"|otp"
|
||||
@@ -231,12 +231,12 @@ static struct getargs args[] = {
|
||||
|
||||
static int num_args = sizeof(args) / sizeof(args[0]);
|
||||
|
||||
/*
|
||||
/*
|
||||
* init: Start a Post Office Protocol session
|
||||
*/
|
||||
|
||||
static int
|
||||
pop_getportbyname(POP *p, const char *service,
|
||||
pop_getportbyname(POP *p, const char *service,
|
||||
const char *proto, short def)
|
||||
{
|
||||
#ifdef KRB5
|
||||
@@ -310,7 +310,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
}
|
||||
|
||||
if(auth_str){
|
||||
if (strcasecmp (auth_str, "plaintext") == 0 ||
|
||||
if (strcasecmp (auth_str, "plaintext") == 0 ||
|
||||
strcasecmp (auth_str, "none") == 0)
|
||||
p->auth_level = AUTH_NONE;
|
||||
else if(strcasecmp(auth_str, "otp") == 0) {
|
||||
@@ -354,7 +354,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
|
||||
if(timeout)
|
||||
pop_timeout = timeout;
|
||||
|
||||
|
||||
/* Fake inetd */
|
||||
if (interactive_flag) {
|
||||
if (portnum == 0)
|
||||
@@ -372,7 +372,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Save the dotted decimal form of the client's IP address
|
||||
/* Save the dotted decimal form of the client's IP address
|
||||
in the POP parameter block */
|
||||
inet_ntop (cs->sa_family, socket_get_address (cs),
|
||||
p->ipaddr, sizeof(p->ipaddr));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* last: Display the last message touched in a POP session
|
||||
*/
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* list: List the contents of a POP maildrop
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@ pop_list (POP *p)
|
||||
/* Display message information */
|
||||
return (pop_msg(p,POP_SUCCESS,"%d %ld",msg_num,mp->length));
|
||||
}
|
||||
|
||||
|
||||
/* Display the entire list of messages */
|
||||
pop_msg(p,POP_SUCCESS,
|
||||
"%d messages (%ld octets)",
|
||||
@@ -47,7 +47,7 @@ pop_list (POP *p)
|
||||
|
||||
/* Loop through the message information list. Skip deleted messages */
|
||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
fprintf(p->output,"%u %lu\r\n",mp->number,mp->length);
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* log: Make a log entry
|
||||
*/
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* msg: Send a formatted line to the POP client
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ pop_msg(POP *p, int stat, char *format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
|
||||
|
||||
/* Point to the message buffer */
|
||||
mp = message;
|
||||
|
||||
@@ -31,10 +31,10 @@ pop_msg(POP *p, int stat, char *format, ...)
|
||||
mp += strlen(mp);
|
||||
|
||||
/* Append the message (formatted, if necessary) */
|
||||
if (format)
|
||||
if (format)
|
||||
vsnprintf (mp, sizeof(message) - strlen(message),
|
||||
format, ap);
|
||||
|
||||
|
||||
/* Log the message if debugging is turned on */
|
||||
#ifdef DEBUG
|
||||
if (p->debug && stat == POP_SUCCESS)
|
||||
@@ -42,12 +42,12 @@ pop_msg(POP *p, int stat, char *format, ...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* Log the message if a failure occurred */
|
||||
if (stat != POP_SUCCESS)
|
||||
if (stat != POP_SUCCESS)
|
||||
pop_log(p,POP_PRIORITY,"%s",message);
|
||||
|
||||
/* Append the <CR><LF> */
|
||||
strlcat(message, "\r\n", sizeof(message));
|
||||
|
||||
|
||||
/* Send the message to the client */
|
||||
fputs(message, p->output);
|
||||
fflush(p->output);
|
||||
|
@@ -7,8 +7,8 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
* parse: Parse a raw input line from a POP client
|
||||
/*
|
||||
* parse: Parse a raw input line from a POP client
|
||||
* into null-delimited tokens
|
||||
*/
|
||||
|
||||
@@ -17,10 +17,10 @@ pop_parse(POP *p, char *buf)
|
||||
{
|
||||
char * mp;
|
||||
int i;
|
||||
|
||||
|
||||
/* Loop through the POP command array */
|
||||
for (mp = buf, i = 0; ; i++) {
|
||||
|
||||
|
||||
/* Skip leading spaces and tabs in the message */
|
||||
while (isspace((unsigned char)*mp))mp++;
|
||||
|
||||
@@ -51,5 +51,5 @@ pop_parse(POP *p, char *buf)
|
||||
|
||||
/* Return the number of tokens extracted minus the command itself */
|
||||
return (i-1);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ krb5_verify_password (POP *p)
|
||||
1);
|
||||
|
||||
krb5_verify_init_creds_opt_init (&verify_options);
|
||||
|
||||
|
||||
ret = krb5_parse_name (p->context, p->user, &client);
|
||||
if (ret) {
|
||||
pop_log(p, POP_PRIORITY, "krb5_parse_name: %s",
|
||||
@@ -108,7 +108,7 @@ krb5_verify_password (POP *p)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
* pass: Obtain the user password from a POP client
|
||||
*/
|
||||
|
||||
@@ -126,7 +126,7 @@ login_user(POP *p)
|
||||
}
|
||||
|
||||
pop_log(p, POP_INFO, "login from %s as %s", p->ipaddr, p->user);
|
||||
|
||||
|
||||
/* Build the name of the user's maildrop */
|
||||
snprintf(p->drop_name, sizeof(p->drop_name), "%s/%s", POP_MAILDIR, p->user);
|
||||
if(stat(p->drop_name, &st) < 0 || !S_ISDIR(st.st_mode)){
|
||||
@@ -153,7 +153,7 @@ pop_pass (POP *p)
|
||||
int status;
|
||||
|
||||
/* Make one string of all these parameters */
|
||||
|
||||
|
||||
for (i = 1; i < p->parm_count; ++i)
|
||||
p->pop_parm[i][strlen(p->pop_parm[i])] = ' ';
|
||||
|
||||
@@ -183,7 +183,7 @@ pop_pass (POP *p)
|
||||
#ifdef KRB5
|
||||
if (p->version == 5) {
|
||||
char *name;
|
||||
|
||||
|
||||
if (!krb5_kuserok (p->context, p->principal, p->user)) {
|
||||
pop_log (p, POP_PRIORITY,
|
||||
"krb5 permission denied");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* quit: Terminate a POP session
|
||||
*/
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* rset: Unflag all messages flagged for deletion in a POP maildrop
|
||||
*/
|
||||
|
||||
@@ -20,11 +20,11 @@ pop_rset (POP *p)
|
||||
/* Unmark all the messages */
|
||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++)
|
||||
mp->flags &= ~DEL_FLAG;
|
||||
|
||||
|
||||
/* Reset the messages-deleted and bytes-deleted counters */
|
||||
p->msgs_deleted = 0;
|
||||
p->bytes_deleted = 0;
|
||||
|
||||
|
||||
/* Reset the last-message-access flag */
|
||||
p->last_msg = 0;
|
||||
|
||||
|
@@ -16,7 +16,7 @@ pop_sendline(POP *p, char *buffer)
|
||||
char * bp;
|
||||
|
||||
/* Byte stuff lines that begin with the termination octet */
|
||||
if (*buffer == POP_TERMINATE)
|
||||
if (*buffer == POP_TERMINATE)
|
||||
fputc(POP_TERMINATE,p->output);
|
||||
|
||||
/* Look for a <NL> in the buffer */
|
||||
@@ -37,8 +37,8 @@ pop_sendline(POP *p, char *buffer)
|
||||
return bp != NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* send: Send the header and a specified number of lines
|
||||
/*
|
||||
* send: Send the header and a specified number of lines
|
||||
* from a mail message to a POP client.
|
||||
*/
|
||||
|
||||
@@ -83,7 +83,7 @@ pop_send(POP *p)
|
||||
/* Flag the message as retreived */
|
||||
mp->flags |= RETR_FLAG;
|
||||
}
|
||||
|
||||
|
||||
/* Display the number of bytes in the message */
|
||||
pop_msg(p, POP_SUCCESS, "%ld octets", mp->length);
|
||||
|
||||
@@ -138,8 +138,8 @@ pop_send(POP *p)
|
||||
if (!return_path_sent || strncasecmp(buffer, "Return-Path:", 12) != 0)
|
||||
#endif
|
||||
sent_nl = pop_sendline (p,buffer);
|
||||
/* A single newline (blank line) signals the
|
||||
end of the header. sendline() converts this to a NULL,
|
||||
/* A single newline (blank line) signals the
|
||||
end of the header. sendline() converts this to a NULL,
|
||||
so that's what we look for. */
|
||||
if (*buffer == 0) break;
|
||||
if (hangup)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* stat: Display the status of a POP maildrop to its client
|
||||
*/
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@@ -35,7 +35,7 @@
|
||||
RCSID("$Id$");
|
||||
|
||||
#ifdef UIDL
|
||||
/*
|
||||
/*
|
||||
* uidl: Uidl the contents of a POP maildrop
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,7 @@ pop_uidl (POP *p)
|
||||
/* Display message information */
|
||||
return (pop_msg(p,POP_SUCCESS,"%u %s",msg_num,mp->msg_id));
|
||||
}
|
||||
|
||||
|
||||
/* Display the entire list of messages */
|
||||
pop_msg(p,POP_SUCCESS,
|
||||
"%d messages (%ld octets)",
|
||||
@@ -75,7 +75,7 @@ pop_uidl (POP *p)
|
||||
|
||||
/* Loop through the message information list. Skip deleted messages */
|
||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
fprintf(p->output,"%u %s\r\n",mp->number,mp->msg_id);
|
||||
}
|
||||
|
||||
|
@@ -10,24 +10,24 @@ RCSID("$Id$");
|
||||
static char standard_error[] =
|
||||
"Error error updating primary drop. Mailbox unchanged";
|
||||
|
||||
/*
|
||||
/*
|
||||
* updt: Apply changes to a user's POP maildrop
|
||||
*/
|
||||
|
||||
int
|
||||
pop_updt (POP *p)
|
||||
{
|
||||
FILE * md; /* Stream pointer for
|
||||
FILE * md; /* Stream pointer for
|
||||
the user's maildrop */
|
||||
int mfd; /* File descriptor for
|
||||
above */
|
||||
char buffer[BUFSIZ]; /* Read buffer */
|
||||
|
||||
MsgInfoList * mp; /* Pointer to message
|
||||
MsgInfoList * mp; /* Pointer to message
|
||||
info list */
|
||||
int msg_num; /* Current message
|
||||
int msg_num; /* Current message
|
||||
counter */
|
||||
int status_written; /* Status header field
|
||||
int status_written; /* Status header field
|
||||
written */
|
||||
int nchar; /* Bytes read/written */
|
||||
|
||||
@@ -54,7 +54,7 @@ pop_updt (POP *p)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (p->debug)
|
||||
if (p->debug)
|
||||
pop_log(p,POP_DEBUG,"Opening mail drop \"%s\"",p->drop_name);
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -72,9 +72,9 @@ pop_updt (POP *p)
|
||||
}
|
||||
|
||||
/* Go to the right places */
|
||||
offset = lseek((int)fileno(p->drop),0,SEEK_END) ;
|
||||
offset = lseek((int)fileno(p->drop),0,SEEK_END) ;
|
||||
|
||||
/* Append any messages that may have arrived during the session
|
||||
/* Append any messages that may have arrived during the session
|
||||
to the temporary maildrop */
|
||||
while ((nchar=read(mfd,buffer,BUFSIZ)) > 0)
|
||||
if ( nchar != write((int)fileno(p->drop),buffer,nchar) ) {
|
||||
@@ -96,10 +96,10 @@ pop_updt (POP *p)
|
||||
rewind(p->drop);
|
||||
lseek((int)fileno(p->drop),0,SEEK_SET);
|
||||
|
||||
/* Transfer messages not flagged for deletion from the temporary
|
||||
/* Transfer messages not flagged for deletion from the temporary
|
||||
maildrop to the new maildrop */
|
||||
#ifdef DEBUG
|
||||
if (p->debug)
|
||||
if (p->debug)
|
||||
pop_log(p,POP_DEBUG,"Creating new maildrop \"%s\" from \"%s\"",
|
||||
p->drop_name,p->temp_drop);
|
||||
#endif /* DEBUG */
|
||||
@@ -155,8 +155,8 @@ pop_updt (POP *p)
|
||||
}
|
||||
/* Save another header line */
|
||||
fputs (buffer, md);
|
||||
}
|
||||
else { /* Body */
|
||||
}
|
||||
else { /* Body */
|
||||
if (blank_line && strncmp(buffer,"From ",5) == 0) break;
|
||||
fputs (buffer, md);
|
||||
blank_line = (*buffer == '\n');
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <popper.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/*
|
||||
* user: Prompt for the user name at the start of a POP session
|
||||
*/
|
||||
|
||||
|
@@ -12,15 +12,15 @@ pop_xover (POP *p)
|
||||
"%d messages (%ld octets)",
|
||||
p->msg_count-p->msgs_deleted,
|
||||
p->drop_size-p->bytes_deleted);
|
||||
|
||||
|
||||
/* Loop through the message information list. Skip deleted messages */
|
||||
for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) {
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
if (!(mp->flags & DEL_FLAG))
|
||||
fprintf(p->output,"%u\t%s\t%s\t%s\t%s\t%lu\t%u\r\n",
|
||||
mp->number,
|
||||
mp->subject,
|
||||
mp->from,
|
||||
mp->date,
|
||||
mp->date,
|
||||
mp->msg_id,
|
||||
mp->length,
|
||||
mp->lines);
|
||||
|
@@ -29,7 +29,7 @@ ring(int sig)
|
||||
{
|
||||
longjmp(env,1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* fgets, but with a timeout
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ static char *
|
||||
tgets(char *str, int size, FILE *fp, int timeout)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
|
||||
signal(SIGALRM, ring);
|
||||
alarm(timeout);
|
||||
if (setjmp(env)) {
|
||||
@@ -51,7 +51,7 @@ tgets(char *str, int size, FILE *fp, int timeout)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* popper: Handle a Post Office Protocol version 3 session
|
||||
*/
|
||||
int
|
||||
@@ -70,10 +70,10 @@ main (int argc, char **argv)
|
||||
/* Tell the user that we are listenting */
|
||||
pop_msg(&p,POP_SUCCESS, "POP3 server ready");
|
||||
|
||||
/* State loop. The POP server is always in a particular state in
|
||||
which a specific suite of commands can be executed. The following
|
||||
loop reads a line from the client, gets the command, and processes
|
||||
it in the current context (if allowed) or rejects it. This continues
|
||||
/* State loop. The POP server is always in a particular state in
|
||||
which a specific suite of commands can be executed. The following
|
||||
loop reads a line from the client, gets the command, and processes
|
||||
it in the current context (if allowed) or rejects it. This continues
|
||||
until the client quits or an error occurs. */
|
||||
|
||||
for (p.CurrentState=auth1;p.CurrentState!=halt&&p.CurrentState!=error;) {
|
||||
@@ -94,7 +94,7 @@ main (int argc, char **argv)
|
||||
/* Search for the command in the command/state table */
|
||||
if ((s = pop_get_command(&p,message)) == NULL) continue;
|
||||
|
||||
/* Call the function associated with this command in
|
||||
/* Call the function associated with this command in
|
||||
the current state */
|
||||
if (s->function) p.CurrentState = s->result[(*s->function)(&p)];
|
||||
|
||||
@@ -103,7 +103,7 @@ main (int argc, char **argv)
|
||||
p.CurrentState = s->success_state;
|
||||
pop_msg(&p,POP_SUCCESS,"time passes");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Say goodbye to the client */
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Header file for the POP programs
|
||||
*/
|
||||
|
||||
@@ -178,20 +178,20 @@ extern int hangup;
|
||||
#define AUTH_SASL 2
|
||||
|
||||
#define pop_command pop_parm[0] /* POP command is first token */
|
||||
#define pop_subcommand pop_parm[1] /* POP XTND subcommand is the
|
||||
#define pop_subcommand pop_parm[1] /* POP XTND subcommand is the
|
||||
second token */
|
||||
|
||||
typedef enum { /* POP processing states */
|
||||
auth1, /* Authorization: waiting for
|
||||
auth1, /* Authorization: waiting for
|
||||
USER command */
|
||||
auth2, /* Authorization: waiting for
|
||||
auth2, /* Authorization: waiting for
|
||||
PASS command */
|
||||
trans, /* Transaction */
|
||||
update, /* Update: session ended,
|
||||
update, /* Update: session ended,
|
||||
process maildrop changes */
|
||||
halt, /* (Halt): stop processing
|
||||
halt, /* (Halt): stop processing
|
||||
and exit */
|
||||
error /* (Error): something really
|
||||
error /* (Error): something really
|
||||
bad happened */
|
||||
} state;
|
||||
|
||||
@@ -201,12 +201,12 @@ typedef enum { /* POP processing states */
|
||||
#define NEW_FLAG 4
|
||||
|
||||
typedef struct { /* Message information */
|
||||
int number; /* Message number relative to
|
||||
int number; /* Message number relative to
|
||||
the beginning of list */
|
||||
long length; /* Length of message in
|
||||
long length; /* Length of message in
|
||||
bytes */
|
||||
int lines; /* Number of (null-terminated) lines in the message */
|
||||
long offset; /* Offset from beginning of
|
||||
long offset; /* Offset from beginning of
|
||||
file */
|
||||
unsigned flags;
|
||||
|
||||
@@ -225,40 +225,40 @@ typedef struct { /* Message information */
|
||||
|
||||
typedef struct { /* POP parameter block */
|
||||
int debug; /* Debugging requested */
|
||||
char * myname; /* The name of this POP
|
||||
char * myname; /* The name of this POP
|
||||
daemon program */
|
||||
char myhost[MaxHostNameLen]; /* The name of our host
|
||||
char myhost[MaxHostNameLen]; /* The name of our host
|
||||
computer */
|
||||
char client[MaxHostNameLen]; /* Canonical name of client
|
||||
char client[MaxHostNameLen]; /* Canonical name of client
|
||||
computer */
|
||||
char ipaddr[MaxHostNameLen]; /* Dotted-notation format of
|
||||
char ipaddr[MaxHostNameLen]; /* Dotted-notation format of
|
||||
client IP address */
|
||||
unsigned short ipport; /* Client port for privileged
|
||||
unsigned short ipport; /* Client port for privileged
|
||||
operations */
|
||||
char user[MAXUSERNAMELEN]; /* Name of the POP user */
|
||||
state CurrentState; /* The current POP operational state */
|
||||
MsgInfoList * mlp; /* Message information list */
|
||||
int msg_count; /* Number of messages in
|
||||
int msg_count; /* Number of messages in
|
||||
the maildrop */
|
||||
int msgs_deleted; /* Number of messages flagged
|
||||
int msgs_deleted; /* Number of messages flagged
|
||||
for deletion */
|
||||
int last_msg; /* Last message touched by
|
||||
int last_msg; /* Last message touched by
|
||||
the user */
|
||||
long bytes_deleted; /* Number of maildrop bytes
|
||||
long bytes_deleted; /* Number of maildrop bytes
|
||||
flagged for deletion */
|
||||
char drop_name[MAXPATHLEN]; /* The name of the user's
|
||||
char drop_name[MAXPATHLEN]; /* The name of the user's
|
||||
maildrop */
|
||||
char temp_drop[MAXPATHLEN]; /* The name of the user's
|
||||
char temp_drop[MAXPATHLEN]; /* The name of the user's
|
||||
temporary maildrop */
|
||||
long drop_size; /* Size of the maildrop in
|
||||
bytes */
|
||||
FILE * drop; /* (Temporary) mail drop */
|
||||
FILE * input; /* Input TCP/IP communication
|
||||
FILE * input; /* Input TCP/IP communication
|
||||
stream */
|
||||
FILE * output; /* Output TCP/IP communication stream */
|
||||
FILE * trace; /* Debugging trace file */
|
||||
char * pop_parm[MAXPARMCOUNT]; /* Parse POP parameter list */
|
||||
int parm_count; /* Number of parameters in
|
||||
int parm_count; /* Number of parameters in
|
||||
parsed list */
|
||||
int kerberosp; /* Using KPOP? */
|
||||
#ifdef KRB4
|
||||
@@ -278,20 +278,20 @@ typedef struct { /* POP parameter block */
|
||||
#define POP_FLAG_CAPA 1
|
||||
} POP;
|
||||
|
||||
typedef struct { /* State information for
|
||||
typedef struct { /* State information for
|
||||
each POP command */
|
||||
state ValidCurrentState; /* The operating state of
|
||||
state ValidCurrentState; /* The operating state of
|
||||
the command */
|
||||
char * command; /* The POP command */
|
||||
int min_parms; /* Minimum number of parms
|
||||
int min_parms; /* Minimum number of parms
|
||||
for the command */
|
||||
int max_parms; /* Maximum number of parms
|
||||
int max_parms; /* Maximum number of parms
|
||||
for the command */
|
||||
int (*function) (); /* The function that process
|
||||
int (*function) (); /* The function that process
|
||||
the command */
|
||||
state result[2]; /* The resulting state after
|
||||
state result[2]; /* The resulting state after
|
||||
command processing */
|
||||
#define success_state result[0] /* State when a command
|
||||
#define success_state result[0] /* State when a command
|
||||
succeeds */
|
||||
} state_table;
|
||||
|
||||
@@ -301,7 +301,7 @@ typedef struct { /* Table of extensions */
|
||||
the subcommand */
|
||||
int max_parms; /* Maximum number of parms for
|
||||
the subcommand */
|
||||
int (*function) (); /* The function that processes
|
||||
int (*function) (); /* The function that processes
|
||||
the subcommand */
|
||||
} xtnd_table;
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "push_locl.h"
|
||||
@@ -57,7 +57,7 @@ struct getargs args[] = {
|
||||
#ifdef KRB4
|
||||
{ "krb4", '4', arg_flag, &use_v4, "Use Kerberos V4",
|
||||
NULL },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef KRB5
|
||||
{ "krb5", '5', arg_flag, &use_v5, "Use Kerberos V5",
|
||||
NULL },
|
||||
@@ -134,12 +134,12 @@ do_connect (const char *hostname, int port, int nodelay)
|
||||
return s;
|
||||
}
|
||||
|
||||
typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
|
||||
typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
|
||||
DELE, XDELE, QUIT} pop_state;
|
||||
|
||||
static char *pop_state_string[] = {
|
||||
"INIT", "GREET", "USER", "PASS", "STAT", "RETR", "TOP",
|
||||
"DELE", "XDELE", "QUIT"
|
||||
"DELE", "XDELE", "QUIT"
|
||||
};
|
||||
|
||||
#define PUSH_BUFSIZ 65536
|
||||
@@ -296,7 +296,7 @@ doit(int s,
|
||||
if (verbose > 1)
|
||||
fprintf (stderr, "state: %s count: %d asked_for: %d "
|
||||
"retrieved: %d asked_deleted: %d\n",
|
||||
pop_state_string[state],
|
||||
pop_state_string[state],
|
||||
count, asked_for, retrieved, asked_deleted);
|
||||
|
||||
if (((state == STAT || state == RETR || state == TOP)
|
||||
@@ -316,7 +316,7 @@ doit(int s,
|
||||
char *beg, *p;
|
||||
size_t rem;
|
||||
int blank_line = 0;
|
||||
|
||||
|
||||
if(in_len >= in_buf_size) {
|
||||
char *tmp = erealloc(in_buf, in_buf_size + PUSH_BUFSIZ + 1);
|
||||
in_ptr = tmp + (in_ptr - in_buf);
|
||||
@@ -329,11 +329,11 @@ doit(int s,
|
||||
err (1, "read");
|
||||
else if (ret == 0)
|
||||
errx (1, "EOF during read");
|
||||
|
||||
|
||||
in_len += ret;
|
||||
in_ptr += ret;
|
||||
*in_ptr = '\0';
|
||||
|
||||
|
||||
beg = in_buf;
|
||||
rem = in_len;
|
||||
while(rem > 1
|
||||
@@ -406,7 +406,7 @@ doit(int s,
|
||||
++copy;
|
||||
}
|
||||
*p = '\n';
|
||||
if(blank_line &&
|
||||
if(blank_line &&
|
||||
strncmp(copy, "From ", min(p - copy + 1, 5)) == 0)
|
||||
write_state_add(&write_state, ">", 1);
|
||||
write_state_add(&write_state, copy, p - copy + 1);
|
||||
@@ -419,7 +419,7 @@ doit(int s,
|
||||
write_state_add(&write_state,
|
||||
from_line, from_line_length);
|
||||
blank_line = 0;
|
||||
if (do_from)
|
||||
if (do_from)
|
||||
state = TOP;
|
||||
else
|
||||
state = RETR;
|
||||
@@ -588,7 +588,7 @@ do_v4 (const char *host,
|
||||
return 1;
|
||||
ret = krb_sendauth(0,
|
||||
s,
|
||||
&ticket,
|
||||
&ticket,
|
||||
"pop",
|
||||
(char *)host,
|
||||
krb_realmofhost(host),
|
||||
@@ -768,7 +768,7 @@ main(int argc, char **argv)
|
||||
use_v4 = 0;
|
||||
if(use_v5 == -1 && use_v4 == 1)
|
||||
use_v5 = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (do_help)
|
||||
usage (0);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
@@ -101,7 +101,7 @@ main(int argc, char **argv)
|
||||
print_version (NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
iamremote = (fflag || tflag);
|
||||
|
||||
argc -= optind;
|
||||
@@ -132,7 +132,7 @@ main(int argc, char **argv)
|
||||
remin = remout = -1;
|
||||
/* Command to be executed on remote system using "rsh". */
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"rcp%s%s%s", iamrecursive ? " -r" : "",
|
||||
"rcp%s%s%s", iamrecursive ? " -r" : "",
|
||||
pflag ? " -p" : "", targetshouldbedirectory ? " -d" : "");
|
||||
|
||||
signal(SIGPIPE, lostconn);
|
||||
@@ -189,7 +189,7 @@ toremote(char *targ, int argc, char **argv)
|
||||
continue;
|
||||
ret = asprintf(&bp,
|
||||
"%s%s %s -l %s -n %s %s '%s%s%s:%s'",
|
||||
_PATH_RSH, eflag ? " -e" : "",
|
||||
_PATH_RSH, eflag ? " -e" : "",
|
||||
host, suser, cmd, src,
|
||||
tuser ? tuser : "", tuser ? "@" : "",
|
||||
thost, targ);
|
||||
@@ -197,7 +197,7 @@ toremote(char *targ, int argc, char **argv)
|
||||
host = unbracket(argv[i]);
|
||||
ret = asprintf(&bp,
|
||||
"exec %s%s %s -n %s %s '%s%s%s:%s'",
|
||||
_PATH_RSH, eflag ? " -e" : "",
|
||||
_PATH_RSH, eflag ? " -e" : "",
|
||||
host, cmd, src,
|
||||
tuser ? tuser : "", tuser ? "@" : "",
|
||||
thost, targ);
|
||||
@@ -715,7 +715,7 @@ run_err(const char *fmt, ...)
|
||||
* If it cannot create necessary pipes it exits with error message.
|
||||
*/
|
||||
|
||||
int
|
||||
int
|
||||
do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
|
||||
{
|
||||
int pin[2], pout[2], reserved[2];
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user