Import ncpfs 2.2.2
This commit is contained in:
BIN
.downloads/ncpfs-2.2.2.tar.gz
Normal file
BIN
.downloads/ncpfs-2.2.2.tar.gz
Normal file
Binary file not shown.
64
Changes
64
Changes
@@ -1,3 +1,67 @@
|
||||
ChangeSet@1.245, 2003-02-15 10:14:01+01:00
|
||||
Update Czech translations.
|
||||
|
||||
ChangeSet@1.244, 2003-02-15 09:59:55+01:00
|
||||
Honor default name context setting in ncpmount, and in file and
|
||||
print utilities.
|
||||
|
||||
ChangeSet@1.243, 2003-02-14 10:58:30+01:00
|
||||
Teach nds_login to honor character encoding specified in context.
|
||||
Teach nds_login_auth to use default name context specified in
|
||||
configuration file.
|
||||
|
||||
ChangeSet@1.242, 2003-02-14 10:25:31+01:00
|
||||
Fix few compile warnings...
|
||||
|
||||
ChangeSet@1.241, 2003-02-14 10:21:06+01:00
|
||||
Make authenticators user configurable, some people may want to
|
||||
disable bindery (or NDS) authentication.
|
||||
|
||||
ChangeSet@1.240, 2003-02-14 09:28:28+01:00
|
||||
Learn pqlist to use default name context from /etc/ncpfs.conf.
|
||||
|
||||
ChangeSet@1.239, 2003-02-14 09:27:26+01:00
|
||||
Do not store compiled ipxdump and ipxparse in BitKeeper...
|
||||
|
||||
ChangeSet@1.238, 2003-02-14 09:26:02+01:00
|
||||
Update /etc/ncpfs.conf format to allow unquoted values with embeded
|
||||
spaces. We'll need that in future for 'NDS BIND' without quotes...
|
||||
|
||||
ChangeSet@1.237, 2003-02-13 10:20:37+01:00
|
||||
Store session key also for temporary connections, so NDS aware utilities
|
||||
as for example pqstat or nprint can do what they promise.
|
||||
|
||||
Please note bindery authentication is tried first, and if you are
|
||||
bindery authenticated then there is no session key, and thus no background
|
||||
authentication. So you may want to use FQDN instead of short name for
|
||||
pqstat or nprint.
|
||||
|
||||
ChangeSet@1.236, 2003-02-13 10:16:18+01:00
|
||||
Retrieve queue name and job owner in pqstat from NDS. Reported by
|
||||
Jimmy Kaplowitz.
|
||||
|
||||
ChangeSet@1.235, 2003-02-13 09:03:01+01:00
|
||||
Remove references to RSA patent #4,405,829 from README.NDS. Patent expired
|
||||
more than two years ago... Reported by Ken Conrad.
|
||||
|
||||
ChangeSet@1.234, 2003-02-11 10:36:50+01:00
|
||||
Add GIVEN_NAME to the list of known text properties.
|
||||
|
||||
ChangeSet@1.233, 2003-02-09 04:59:37+01:00
|
||||
Learn BitKeeper to ignore temporary products of --with-included-gettext.
|
||||
|
||||
ChangeSet@1.232, 2003-02-09 04:57:06+01:00
|
||||
Fix dependencies for --with-included-gettext build. Spotted
|
||||
by David Walser.
|
||||
|
||||
ChangeSet@1.231, 2003-02-09 04:38:09+01:00
|
||||
Create directory for pam_ncp module during install. Spotted and fixed
|
||||
by David Walser.
|
||||
|
||||
ChangeSet@1.230, 2003-02-08 11:30:40+01:00
|
||||
ncpfs-2.2.1 released
|
||||
TAG: ncpfs-2.2.1
|
||||
|
||||
ChangeSet@1.229, 2003-02-08 11:06:50+01:00
|
||||
Ignore editor backup files *~
|
||||
|
||||
|
||||
24
ConfigFile
24
ConfigFile
@@ -11,17 +11,18 @@ triplets (eventually with user or password ommited).
|
||||
|
||||
Sectioned part (and whole /etc/ncpfs.conf file) contains couple of sections.
|
||||
Each section is started with "[Section Name]" line, lines in section are in
|
||||
format "Key Name = value". If value contains spaces, you must either prefix
|
||||
spaces with backslash "\" or enclose value into quotes (') or double quotes
|
||||
("). If value contains backslash "\", you must prefix it with backslash. If
|
||||
value in quotes contains quote, you must prefix it with backslash. Code knows
|
||||
two special values, "\n" for LF and "\r" for CR - although currently there is
|
||||
no reason for embed them into values.
|
||||
format "Key Name = value". If value contains hash (#) or semicolon (;), you
|
||||
must either prefix these characters with backslash (\) or enclose value into
|
||||
quotes (') or double quotes ("). If value contains backslash (\), you must
|
||||
prefix it with backslash. If value in quotes contains same quote, you must prefix
|
||||
it with backslash. Code knows two special values, "\n" for LF and "\r" for CR
|
||||
- although currently there is no reason for embed them into values.
|
||||
|
||||
Everything after closing bracket on "[Section Name]" line is ignored.
|
||||
Everything after value on "Key Name = value" line is ignored too.
|
||||
Comments begin with hash (#) or semicolon (;) and can occur on any place
|
||||
outside quotes.
|
||||
|
||||
Following three examples mean same thing:
|
||||
Following four examples mean same thing:
|
||||
Strange Value = Strange Value "1
|
||||
Strange Value = Strange\ Value\ "1
|
||||
Strange Value = "Strange Value \"1"
|
||||
Strange Value = 'Strange Value "1'
|
||||
@@ -58,6 +59,11 @@ Default Tree Name = <tree name>
|
||||
Default Name Context = <default name context>
|
||||
Default name context is specified relative to [Root].
|
||||
Default: "[Root]"
|
||||
|
||||
NetWare Protocol = <authenticators>
|
||||
List of authenticators, separated by spaces or commas.
|
||||
Currently two authenticators are known, "NDS" and "BIND".
|
||||
Default: "NDS BIND"
|
||||
|
||||
[Tree <tree name>]
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
The NDS login code uses the RSA public key cryptosystem. Because of a patent
|
||||
right on this algorithm (U.S. patent #4,405,829, issued 20 Sep 1983), you
|
||||
are probably not allowed to use this code in the U.S.A. and Canada, and
|
||||
possibly neither in other countries. Check this before you use NDS logins!
|
||||
|
||||
The mpilib.c, mpilib.h, platform.h, and usuals.h in the lib/ directory are
|
||||
taken from the PGP 2.3 source distribution (Copyright 1986-92 by Philip
|
||||
Zimmermann), which is distributed under the GPL, as stated below.
|
||||
@@ -11,8 +6,5 @@ Excerpt from pgpdoc2.txt (contained in pgp23src.zip):
|
||||
"All the source code for PGP is available for free under the "Copyleft"
|
||||
General Public License from the Free Software Foundation (FSF)."
|
||||
|
||||
For more details on the RSA patent see the pgp23src archive, or more recent
|
||||
PGP packages.
|
||||
|
||||
Arne de Bruijn
|
||||
arne@knoware.nl
|
||||
|
||||
20
configure
vendored
20
configure
vendored
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac 2.2.1.
|
||||
# From configure.ac 2.2.2.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.57 for ncpfs 2.2.1.
|
||||
# Generated by GNU Autoconf 2.57 for ncpfs 2.2.2.
|
||||
#
|
||||
# Report bugs to <vandrove@vc.cvut.cz>.
|
||||
#
|
||||
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='ncpfs'
|
||||
PACKAGE_TARNAME='-ncpfs-'
|
||||
PACKAGE_VERSION='2.2.1'
|
||||
PACKAGE_STRING='ncpfs 2.2.1'
|
||||
PACKAGE_VERSION='2.2.2'
|
||||
PACKAGE_STRING='ncpfs 2.2.2'
|
||||
PACKAGE_BUGREPORT='vandrove@vc.cvut.cz'
|
||||
|
||||
ac_unique_file="lib/ncplib.c"
|
||||
@@ -781,7 +781,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures ncpfs 2.2.1 to adapt to many kinds of systems.
|
||||
\`configure' configures ncpfs 2.2.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -842,7 +842,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of ncpfs 2.2.1:";;
|
||||
short | recursive ) echo "Configuration of ncpfs 2.2.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -954,7 +954,7 @@ fi
|
||||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
ncpfs configure 2.2.1
|
||||
ncpfs configure 2.2.2
|
||||
generated by GNU Autoconf 2.57
|
||||
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||
@@ -969,7 +969,7 @@ cat >&5 <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by ncpfs $as_me 2.2.1, which was
|
||||
It was created by ncpfs $as_me 2.2.2, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -11008,7 +11008,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by ncpfs $as_me 2.2.1, which was
|
||||
This file was extended by ncpfs $as_me 2.2.2, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -11071,7 +11071,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
ncpfs config.status 2.2.1
|
||||
ncpfs config.status 2.2.2
|
||||
configured by $0, generated by GNU Autoconf 2.57,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT([[ncpfs]],[[2.2.1]],[[vandrove@vc.cvut.cz]])
|
||||
AC_INIT([[ncpfs]],[[2.2.2]],[[vandrove@vc.cvut.cz]])
|
||||
AC_CONFIG_SRCDIR([[lib/ncplib.c]])
|
||||
AC_REVISION([[2.2.1]])
|
||||
AC_REVISION([[2.2.2]])
|
||||
AC_CONFIG_HEADER(include/config.h)
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ default:
|
||||
all: $(PAM_LIBRARY)
|
||||
|
||||
install: all
|
||||
${INSTALL} -d $(DESTDIR)$(LIB_PAM_SECURITY)
|
||||
${INSTALL} -m 755 $(PAM_LIBRARY) $(DESTDIR)$(LIB_PAM_SECURITY)
|
||||
|
||||
install-dev:
|
||||
|
||||
@@ -711,6 +711,7 @@ long
|
||||
#define NWE_SIGNATURE_LEVEL_CONFLICT (NWE_REQUESTER_ERROR | 0x61)
|
||||
#define NWE_INVALID_LEVEL (NWE_REQUESTER_ERROR | 0x6B)
|
||||
#define NWE_UNSUPPORTED_TRAN_TYPE (NWE_REQUESTER_ERROR | 0x70)
|
||||
#define NWE_UNSUPPORTED_AUTHENTICATOR (NWE_REQUESTER_ERROR | 0x73)
|
||||
#define NWE_REQUESTER_FAILURE (NWE_REQUESTER_ERROR | 0xFF)
|
||||
|
||||
#define NWE_SERVER_ERROR (0x8900)
|
||||
|
||||
@@ -275,7 +275,7 @@ uninstall:
|
||||
|
||||
info dvi:
|
||||
|
||||
$(OBJECTS): ../config.h libgnuintl.h
|
||||
$(OBJECTS): ../include/config.h libgnuintl.h
|
||||
bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: gettextP.h gmo.h loadinfo.h
|
||||
dcigettext.$lo: hash-string.h
|
||||
explodename.$lo l10nflist.$lo: loadinfo.h
|
||||
|
||||
@@ -127,8 +127,18 @@ sstart:;
|
||||
while ((cc = *cptr++) != 0) {
|
||||
if (cc == '\n')
|
||||
break;
|
||||
if (!ec && isspace(cc))
|
||||
break;
|
||||
if (!ec && isspace(cc)) {
|
||||
char* cp = sptr;
|
||||
|
||||
do {
|
||||
*cp++ = cc;
|
||||
cc = *cptr++;
|
||||
} while (cc && cc != '\n' && isspace(cc));
|
||||
if (!cc || cc == '\n' || cc == '#' || cc == ';') {
|
||||
break;
|
||||
}
|
||||
sptr = cp;
|
||||
}
|
||||
if (cc == ec)
|
||||
break;
|
||||
if (cc == '\\') {
|
||||
@@ -138,6 +148,13 @@ sstart:;
|
||||
if (cc == '\n')
|
||||
break;
|
||||
switch (cc) {
|
||||
case '#':
|
||||
case ';':
|
||||
case ' ':
|
||||
/* List these explicitly so it is clear that they are used/supported */
|
||||
break;
|
||||
case 't':
|
||||
cc = '\t'; break;
|
||||
case 'n':
|
||||
cc = '\n'; break;
|
||||
case 'r':
|
||||
|
||||
@@ -488,7 +488,7 @@ NWDSCCODE NWDSChangeObjectPassword(
|
||||
|
||||
NWDSCCODE nds_login(
|
||||
NWDSContextHandle ctx,
|
||||
const wchar_t* objectName,
|
||||
const NWDSChar* objectName,
|
||||
const char *objectPassword) {
|
||||
NWCONN_HANDLE conn;
|
||||
NWObjectID objectID;
|
||||
@@ -503,23 +503,23 @@ NWDSCCODE nds_login(
|
||||
nuint8 logindata[8];
|
||||
NWDSCCODE grace_err;
|
||||
wchar_t unaliasedName[MAX_DN_CHARS + 1];
|
||||
NWDSContextHandle wctx;
|
||||
|
||||
err = __NWDSGenerateObjectKeyPairStep1(ctx, (const NWDSChar*)objectName,
|
||||
err = __NWDSGenerateObjectKeyPairStep1(ctx, objectName,
|
||||
&conn, &objectID, &pseudoID, rndseed,
|
||||
&serverPublicKey);
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
NWDSContextHandle wctx;
|
||||
|
||||
err = NWDSDuplicateContextHandleInt(ctx, &wctx);
|
||||
if (!err) {
|
||||
err = NWDSMapIDToName(wctx, conn, objectID,
|
||||
(NWDSChar*)unaliasedName);
|
||||
NWDSFreeContext(wctx);
|
||||
}
|
||||
if (err)
|
||||
wcscpy(unaliasedName, objectName);
|
||||
err = NWDSDuplicateContextHandleInt(ctx, &wctx);
|
||||
if (err) {
|
||||
__NWDSGenerateObjectKeyPairStep3(conn, serverPublicKey);
|
||||
return err;
|
||||
}
|
||||
err = NWDSMapIDToName(wctx, conn, objectID, (NWDSChar*)unaliasedName);
|
||||
if (err) {
|
||||
NWDSFreeContext(wctx);
|
||||
__NWDSGenerateObjectKeyPairStep3(conn, serverPublicKey);
|
||||
return err;
|
||||
}
|
||||
/* compute key... */
|
||||
pwdLen = strlen(objectPassword);
|
||||
@@ -541,7 +541,7 @@ NWDSCCODE nds_login(
|
||||
rndseed, objectID, pwdHash, logindata, &privKey, &privKeyLen);
|
||||
__NWDSGenerateObjectKeyPairStep3(conn, serverPublicKey);
|
||||
if (!grace_err || grace_err == NWE_PASSWORD_EXPIRED) {
|
||||
err = NWDSSetKeys(ctx, logindata, unaliasedName, privKey, privKeyLen);
|
||||
err = NWDSSetKeys(wctx, logindata, unaliasedName, privKey, privKeyLen);
|
||||
memset(privKey, 0, privKeyLen);
|
||||
free(privKey);
|
||||
if (err)
|
||||
@@ -549,6 +549,7 @@ NWDSCCODE nds_login(
|
||||
}
|
||||
err = grace_err;
|
||||
err_exit:
|
||||
NWDSFreeContext(wctx);
|
||||
memset(logindata, 0, sizeof(logindata));
|
||||
return err;
|
||||
}
|
||||
|
||||
125
lib/ncplib.c
125
lib/ncplib.c
@@ -151,6 +151,7 @@ int bindery_only = 0;
|
||||
#include <ncp/kernel/route.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#ifdef NCP_KERNEL_NCPFS_AVAILABLE
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
@@ -167,6 +168,7 @@ int bindery_only = 0;
|
||||
|
||||
#include "private/ncp-new.h"
|
||||
#include "ncpcode.h"
|
||||
#include "cfgfile.h"
|
||||
|
||||
#include "private/libintl.h"
|
||||
#define _(X) dgettext(NCPFS_PACKAGE, (X))
|
||||
@@ -1578,11 +1580,12 @@ ncp_find_fileserver(const char *server_name, struct sockaddr* addr, socklen_t le
|
||||
return ncp_find_server(&server_name, OT_FILE_SERVER, addr, len);
|
||||
}
|
||||
|
||||
NWCCODE
|
||||
ncp_login_conn(struct ncp_conn* conn, const char* object_name, NWObjectType object_type, const char* password) {
|
||||
int err;
|
||||
|
||||
#ifdef NDS_SUPPORT
|
||||
static NWCCODE
|
||||
ncp_login_nds(struct ncp_conn* conn, const char* object_name, const char* password) {
|
||||
NWCCODE err;
|
||||
|
||||
err = NWE_NCP_NOT_SUPPORTED;
|
||||
if (NWIsDSServer(conn, NULL)) {
|
||||
err = nds_login_auth(conn, object_name, password);
|
||||
if (!err) return 0;
|
||||
@@ -1590,14 +1593,47 @@ ncp_login_conn(struct ncp_conn* conn, const char* object_name, NWObjectType obje
|
||||
fprintf(stderr, _("Your password has expired\n"));
|
||||
return 0;
|
||||
}
|
||||
// fprintf(stderr, _("Unable to NDS log-in (error %d [0x%04X]), trying bindery...\n"), err, err);
|
||||
}
|
||||
#endif
|
||||
err = ncp_login_object(conn, object_name, object_type, password);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
NWCCODE
|
||||
ncp_login_conn(struct ncp_conn* conn, const char* object_name, NWObjectType object_type, const char* password) {
|
||||
NWCCODE err;
|
||||
char* auth;
|
||||
|
||||
auth = cfgGetItem("Requester", "NetWare Protocol");
|
||||
if (auth) {
|
||||
char* ptr = auth;
|
||||
char* curr;
|
||||
|
||||
err = NWE_UNSUPPORTED_AUTHENTICATOR;
|
||||
while ((curr = strsep(&ptr, " \t,")) != NULL) {
|
||||
if (!strcasecmp(curr, "BIND")) {
|
||||
err = ncp_login_object(conn, object_name, object_type, password);
|
||||
#ifdef NDS_SUPPORT
|
||||
} else if (!strcasecmp(curr, "NDS")) {
|
||||
err = ncp_login_nds(conn, object_name, password);
|
||||
#endif
|
||||
} else {
|
||||
/* Leave error code as is... */
|
||||
}
|
||||
if (!err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(auth);
|
||||
} else {
|
||||
#ifdef NDS_SUPPORT
|
||||
err = ncp_login_nds(conn, object_name, password);
|
||||
if (!err) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
err = ncp_login_object(conn, object_name, object_type, password);
|
||||
}
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static long
|
||||
@@ -1956,6 +1992,11 @@ ncp_do_close(struct ncp_conn *conn)
|
||||
conn->ncp_reply_buffer = NULL;
|
||||
conn->ncp_reply_alloc = 0;
|
||||
}
|
||||
if (conn->private_key) {
|
||||
free(conn->private_key);
|
||||
conn->private_key = NULL;
|
||||
conn->private_key_len = 0;
|
||||
}
|
||||
ncpt_mutex_destroy(&conn->serverInfo.mutex);
|
||||
ncpt_mutex_destroy(&conn->buffer_mutex);
|
||||
free(conn);
|
||||
@@ -3969,8 +4010,8 @@ ncp_set_dentry_ttl(struct ncp_conn* conn, unsigned int ttl) {
|
||||
#endif
|
||||
}
|
||||
|
||||
NWCCODE
|
||||
ncp_get_private_key(struct ncp_conn* conn, void* pk, size_t* pk_len) {
|
||||
static NWCCODE
|
||||
ncp_get_private_key_perm(struct ncp_conn* conn, void* pk, size_t* pk_len) {
|
||||
#ifdef NCP_KERNEL_NCPFS_AVAILABLE
|
||||
int fd = ncp_get_fid(conn);
|
||||
struct ncp_privatedata_ioctl npi;
|
||||
@@ -3995,8 +4036,35 @@ ncp_get_private_key(struct ncp_conn* conn, void* pk, size_t* pk_len) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static NWCCODE
|
||||
ncp_get_private_key_temp(struct ncp_conn* conn, void* pk, size_t* pk_len) {
|
||||
NWCCODE err = 0;
|
||||
|
||||
ncp_lock_conn(conn);
|
||||
if (pk) {
|
||||
size_t maxln = *pk_len;
|
||||
if (maxln > conn->private_key_len) {
|
||||
maxln = conn->private_key_len;
|
||||
}
|
||||
memcpy(pk, conn->private_key, maxln);
|
||||
}
|
||||
*pk_len = conn->private_key_len;
|
||||
ncp_unlock_conn(conn);
|
||||
return err;
|
||||
}
|
||||
|
||||
NWCCODE
|
||||
ncp_set_private_key(struct ncp_conn* conn, const void* pk, size_t pk_len) {
|
||||
ncp_get_private_key(struct ncp_conn* conn, void* pk, size_t* pk_len) {
|
||||
switch (ncp_get_conn_type(conn)) {
|
||||
case NCP_CONN_TEMPORARY:
|
||||
return ncp_get_private_key_temp(conn, pk, pk_len);
|
||||
default:
|
||||
return ncp_get_private_key_perm(conn, pk, pk_len);
|
||||
}
|
||||
}
|
||||
|
||||
static NWCCODE
|
||||
ncp_set_private_key_perm(struct ncp_conn* conn, const void* pk, size_t pk_len) {
|
||||
#ifdef NCP_KERNEL_NCPFS_AVAILABLE
|
||||
int fd = ncp_get_fid(conn);
|
||||
struct ncp_privatedata_ioctl npi;
|
||||
@@ -4015,6 +4083,37 @@ ncp_set_private_key(struct ncp_conn* conn, const void* pk, size_t pk_len) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static NWCCODE
|
||||
ncp_set_private_key_temp(struct ncp_conn* conn, const void* pk, size_t pk_len) {
|
||||
void *keydata;
|
||||
void *oldkeydata;
|
||||
|
||||
keydata = malloc(pk_len);
|
||||
if (!keydata)
|
||||
return ENOMEM;
|
||||
mlock(keydata, pk_len);
|
||||
memcpy(keydata, pk, pk_len);
|
||||
|
||||
ncp_lock_conn(conn);
|
||||
oldkeydata = conn->private_key;
|
||||
conn->private_key = keydata;
|
||||
conn->private_key_len = pk_len;
|
||||
ncp_unlock_conn(conn);
|
||||
|
||||
free(oldkeydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NWCCODE
|
||||
ncp_set_private_key(struct ncp_conn* conn, const void* pk, size_t pk_len) {
|
||||
switch (ncp_get_conn_type(conn)) {
|
||||
case NCP_CONN_TEMPORARY:
|
||||
return ncp_set_private_key_temp(conn, pk, pk_len);
|
||||
default:
|
||||
return ncp_set_private_key_perm(conn, pk, pk_len);
|
||||
}
|
||||
}
|
||||
|
||||
NWCCODE
|
||||
ncp_next_conn(NWCONN_HANDLE conn, NWCONN_HANDLE* next_conn) {
|
||||
struct list_head* h;
|
||||
|
||||
@@ -110,6 +110,9 @@ struct ncp_conn {
|
||||
int has_subfunction;
|
||||
int verbose;
|
||||
size_t ncp_reply_size;
|
||||
|
||||
void *private_key;
|
||||
size_t private_key_len;
|
||||
|
||||
int lock;
|
||||
|
||||
|
||||
12
lib/ndslib.c
12
lib/ndslib.c
@@ -1327,15 +1327,18 @@ long nds_login_auth(struct ncp_conn *conn, const char *user,
|
||||
err = NWDSCreateContextHandle(&ctx);
|
||||
if (err)
|
||||
return err;
|
||||
ctx->dck.flags = DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES | DCV_DEREF_ALIASES;
|
||||
ctx->dck.flags = DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES | DCV_DEREF_ALIASES | DCV_CANONICALIZE_NAMES;
|
||||
ctx->priv_flags |= DCV_PRIV_AUTHENTICATING;
|
||||
err = NWDSXlateFromCtx(ctx, user_w, sizeof(user_w), user);
|
||||
if (err)
|
||||
goto err_exit;
|
||||
err = NWDSSetContext(ctx, DCK_LOCAL_CHARSET, "WCHAR_T//");
|
||||
if (err)
|
||||
goto err_exit;
|
||||
NWDSAddConnection(ctx, conn);
|
||||
strcpy_cw(user_w, user);
|
||||
err = nds_login(ctx, (const wchar_t*)user_w, pwd);
|
||||
err = nds_login(ctx, (const NWDSChar*)user_w, pwd);
|
||||
if ((err == ERR_NO_SUCH_ENTRY) &&
|
||||
(user_w[0] != '.') &&
|
||||
(user_w[wcslen(user_w)-1] != '.')) {
|
||||
#ifdef ERR_MSG
|
||||
printf(_("User %s not found in current context.\n"
|
||||
@@ -1354,7 +1357,8 @@ long nds_login_auth(struct ncp_conn *conn, const char *user,
|
||||
memcpy(user_w + wcslen(user_w),
|
||||
server_name + i,
|
||||
(wcslen(server_name + i) + 1) * sizeof(wchar_t));
|
||||
err = nds_login(ctx, user_w, pwd);
|
||||
ctx->dck.flags &= ~DCV_CANONICALIZE_NAMES;
|
||||
err = nds_login(ctx, (const NWDSChar*)user_w, pwd);
|
||||
}
|
||||
if (err) {
|
||||
if (err != NWE_PASSWORD_EXPIRED) {
|
||||
|
||||
@@ -48,7 +48,7 @@ NWDSCCODE __NWDSGetPrivateKey(NWCONN_HANDLE conn, const nuint8* connPublicKey,
|
||||
const nuint8 rndseed[4], NWObjectID objectID,
|
||||
const nuint8 pwdHash[16], nuint8 logindata[8],
|
||||
nuint8** privateKey, size_t* privateKeyLen);
|
||||
NWDSCCODE nds_login(NWDSContextHandle ctx, const wchar_t* objectName,
|
||||
NWDSCCODE nds_login(NWDSContextHandle ctx, const NWDSChar* objectName,
|
||||
const char* objectPassword);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -277,6 +277,9 @@ strrqerror(int err)
|
||||
{NWE_UNSUPPORTED_TRAN_TYPE, /* 8870 */
|
||||
N_("Unsupported transport type")},
|
||||
/* ... */
|
||||
{NWE_UNSUPPORTED_AUTHENTICATOR, /* 8873 */
|
||||
N_("Unsupported authenticator")},
|
||||
/* ... */
|
||||
{0x10000,
|
||||
NULL}};
|
||||
const struct errxlat* eptr = rqerrors;
|
||||
|
||||
465
po/ncpfs.pot
465
po/ncpfs.pot
File diff suppressed because it is too large
Load Diff
@@ -382,9 +382,10 @@ main(int argc, char *argv[])
|
||||
mycom_err(err, _("in create context"));
|
||||
exit(68);
|
||||
}
|
||||
ctxf = DCV_XLATE_STRINGS | DCV_DEREF_ALIASES | DCV_CANONICALIZE_NAMES | DCV_TYPELESS_NAMES
|
||||
| DCV_DEREF_BASE_CLASS;
|
||||
NWDSSetContext(ctx, DCK_FLAGS, &ctxf);
|
||||
if (!NWDSGetContext(ctx, DCK_FLAGS, &ctxf)) {
|
||||
ctxf |= DCV_XLATE_STRINGS | DCV_DEREF_ALIASES | DCV_TYPELESS_NAMES | DCV_DEREF_BASE_CLASS;
|
||||
NWDSSetContext(ctx, DCK_FLAGS, &ctxf);
|
||||
}
|
||||
err = NWCCOpenConnByName(NULL, info.tree, NWCC_NAME_FORMAT_NDS_TREE,
|
||||
NWCC_OPEN_NEW_CONN,
|
||||
NWCC_RESERVED, &conn);
|
||||
|
||||
@@ -53,7 +53,7 @@ NWDSCCODE try_nds_queue(NWCONN_HANDLE* conn, const char* name, NWObjectID* id) {
|
||||
err = NWDSGetContext(ctx, DCK_FLAGS, &flags);
|
||||
if (err)
|
||||
goto freectx;
|
||||
flags &= ~DCV_CANONICALIZE_NAMES;
|
||||
flags |= DCV_TYPELESS_NAMES;
|
||||
err = NWDSSetContext(ctx, DCK_FLAGS, &flags);
|
||||
if (err)
|
||||
goto freectx;
|
||||
|
||||
@@ -292,9 +292,10 @@ print_unknown(u_int8_t * val)
|
||||
}
|
||||
|
||||
static void
|
||||
print_string(u_int8_t * val)
|
||||
print_string(u_int8_t * val, int segments)
|
||||
{
|
||||
puts(val);
|
||||
(void)segments;
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -345,7 +346,7 @@ print_station_addr(const char *fmt, const struct ncp_station_addr *addr, char *b
|
||||
}
|
||||
|
||||
static void
|
||||
print_login_control(u_int8_t * val)
|
||||
print_login_control(u_int8_t * val, int segments)
|
||||
{
|
||||
static const time_t zero_time_t = 0;
|
||||
int i, j, mask;
|
||||
@@ -485,62 +486,52 @@ print_login_control(u_int8_t * val)
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
(void)segments;
|
||||
}
|
||||
|
||||
static void
|
||||
print_addr(u_int8_t * val)
|
||||
print_addr(u_int8_t * val, int segments)
|
||||
{
|
||||
char buff[50];
|
||||
print_station_addr("(%L): %N[%S]",
|
||||
(struct ncp_station_addr *) val, buff);
|
||||
printf("%s\n", buff);
|
||||
(void)segments;
|
||||
}
|
||||
|
||||
static void
|
||||
print_hex(u_int8_t *val, int segments) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < segments; i++) {
|
||||
printf(_("Segment: %03d\n"), i + 1);
|
||||
print_unknown(val + i * 128);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
void (*func) (u_int8_t *, int);
|
||||
const char *pname;
|
||||
void (*func) (u_int8_t *);
|
||||
}
|
||||
formats[] =
|
||||
{
|
||||
{
|
||||
"DESCRIPTION", print_string
|
||||
}
|
||||
,
|
||||
{
|
||||
"SURNAME", print_string
|
||||
}
|
||||
,
|
||||
{
|
||||
"OBJECT_CLASS", print_string
|
||||
}
|
||||
,
|
||||
{
|
||||
"IDENTIFICATION", print_string
|
||||
}
|
||||
,
|
||||
{
|
||||
"Q_DIRECTORY", print_string
|
||||
}
|
||||
,
|
||||
{
|
||||
"LOGIN_CONTROL", print_login_control
|
||||
}
|
||||
,
|
||||
{
|
||||
"NET_ADDRESS", print_addr
|
||||
}
|
||||
,
|
||||
{
|
||||
NULL, NULL
|
||||
}
|
||||
{ print_string, "DESCRIPTION" },
|
||||
{ print_string, "SURNAME" },
|
||||
{ print_string, "GIVEN_NAME" },
|
||||
{ print_string, "OBJECT_CLASS" },
|
||||
{ print_string, "IDENTIFICATION" },
|
||||
{ print_string, "Q_DIRECTORY" },
|
||||
{ print_login_control, "LOGIN_CONTROL" },
|
||||
{ print_addr, "NET_ADDRESS" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
print_property(char *prop_name, u_int8_t * val, int segments)
|
||||
{
|
||||
int i;
|
||||
void (*f) (u_int8_t *);
|
||||
|
||||
for (i = 0; formats[i].pname != NULL; i++)
|
||||
{
|
||||
@@ -549,17 +540,5 @@ print_property(char *prop_name, u_int8_t * val, int segments)
|
||||
break;
|
||||
}
|
||||
}
|
||||
f = formats[i].func;
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
f(val);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < segments; i++)
|
||||
{
|
||||
printf(_("Segment: %03d\n"), i + 1);
|
||||
print_unknown(&(val[i * 128]));
|
||||
printf("\n");
|
||||
}
|
||||
formats[i].func(val, segments);
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ main(int argc, char *argv[])
|
||||
|
||||
if (object_type < 0) {
|
||||
#ifdef NDS_SUPPORT
|
||||
u_int32_t flags;
|
||||
NWDSContextHandle ctx;
|
||||
|
||||
nwerr = NWDSCreateContextHandle(&ctx);
|
||||
@@ -196,6 +197,10 @@ failDS:;
|
||||
if (nwerr) {
|
||||
goto failDS;
|
||||
}
|
||||
if (!NWDSGetContext(ctx, DCK_FLAGS, &flags)) {
|
||||
flags |= DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES;
|
||||
NWDSSetContext(ctx, DCK_FLAGS, &flags);
|
||||
}
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &o.object_id);
|
||||
if (nwerr) {
|
||||
goto failDS;
|
||||
|
||||
@@ -152,6 +152,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
if (object_type < 0) {
|
||||
#ifdef NDS_SUPPORT
|
||||
u_int32_t flags;
|
||||
NWDSContextHandle ctx;
|
||||
|
||||
nwerr = NWDSCreateContextHandle(&ctx);
|
||||
@@ -166,6 +167,9 @@ failDS:;
|
||||
NWDSFreeContext(ctx);
|
||||
goto failDS;
|
||||
}
|
||||
if (!NWDSGetContext(ctx, DCK_FLAGS, &flags)) {
|
||||
flags |= DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES;
|
||||
}
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &o.object_id);
|
||||
if (nwerr) {
|
||||
NWDSFreeContext(ctx);
|
||||
|
||||
@@ -154,7 +154,10 @@ main(int argc, char *argv[])
|
||||
if (!err && (ver >= 0x0400)) {
|
||||
errctx = NWDSCreateContextHandle(&ctx);
|
||||
if (!errctx) {
|
||||
static const u_int32_t flags = DCV_XLATE_STRINGS;
|
||||
u_int32_t flags;
|
||||
NWDSAddConnection(ctx, conn);
|
||||
NWDSGetContext(ctx, DCK_FLAGS, &flags);
|
||||
flags |= DCV_XLATE_STRINGS;
|
||||
NWDSSetContext(ctx, DCK_FLAGS, &flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ static int nds_qlist(NWCONN_HANDLE conn, char* pattern) {
|
||||
NWDSContextHandle ctx;
|
||||
NWDSCCODE err;
|
||||
nuint32 dsi;
|
||||
nuint32 dckflags;
|
||||
Buf_T* buf;
|
||||
nuint32 iter = NO_MORE_ITERATIONS;
|
||||
|
||||
@@ -88,11 +89,11 @@ static int nds_qlist(NWCONN_HANDLE conn, char* pattern) {
|
||||
err = NWDSAddConnection(ctx, conn);
|
||||
if (err)
|
||||
goto freectx;
|
||||
err = NWDSGetContext(ctx, DCK_FLAGS, &dsi);
|
||||
err = NWDSGetContext(ctx, DCK_FLAGS, &dckflags);
|
||||
if (err)
|
||||
goto freectx;
|
||||
dsi &= ~DCV_CANONICALIZE_NAMES;
|
||||
err = NWDSSetContext(ctx, DCK_FLAGS, &dsi);
|
||||
dckflags |= DCV_TYPELESS_NAMES;
|
||||
err = NWDSSetContext(ctx, DCK_FLAGS, &dckflags);
|
||||
if (err)
|
||||
goto freectx;
|
||||
dsi = DSI_OUTPUT_FIELDS | DSI_ENTRY_DN;
|
||||
|
||||
@@ -83,16 +83,37 @@ ncp_cmp_time(struct tm* tm1, struct tm* tm2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_object_name(NWCONN_HANDLE conn, NWObjectID objID, char* buff) {
|
||||
NWCCODE err;
|
||||
|
||||
err = NWGetObjectName(conn, objID, buff, NULL);
|
||||
if (err) {
|
||||
NWDSContextHandle ctx;
|
||||
|
||||
err = NWDSCreateContextHandle(&ctx);
|
||||
if (!err) {
|
||||
err = NWDSAddConnection(ctx, conn);
|
||||
if (!err) {
|
||||
err = NWDSMapIDToName(ctx, conn, objID, buff);
|
||||
}
|
||||
NWDSFreeContext(ctx);
|
||||
}
|
||||
}
|
||||
if (err) {
|
||||
sprintf(buff, "<%s>", strnwerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct ncp_conn *conn;
|
||||
struct ncp_bindery_object q,u;
|
||||
unsigned long maxqlen=~0;
|
||||
struct ncp_bindery_object q;
|
||||
unsigned long maxqlen=~0;
|
||||
long err;
|
||||
|
||||
u_int32_t qlen, idl1,idl2, job_id;
|
||||
struct nw_queue_job_entry j;
|
||||
u_int32_t qlen, idl1,idl2, job_id;
|
||||
struct nw_queue_job_entry j;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(NCPFS_PACKAGE, LOCALEDIR);
|
||||
@@ -104,8 +125,7 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
if (argc == 3) {
|
||||
char *end;
|
||||
|
||||
maxqlen=strtoul(argv[2], &end, 10);
|
||||
@@ -145,6 +165,7 @@ main(int argc, char **argv)
|
||||
if (isatty(1))
|
||||
{
|
||||
char server[NW_MAX_SERVER_NAME_LEN];
|
||||
char qname[MAX_DN_BYTES];
|
||||
const char* sptr = server;
|
||||
NWCCODE err2;
|
||||
|
||||
@@ -153,8 +174,9 @@ main(int argc, char **argv)
|
||||
if (err2)
|
||||
sptr = "?";
|
||||
|
||||
get_object_name(conn, q.object_id, qname);
|
||||
printf(_("\nServer: %s\tQueue: %s\tQueue ID: %8.8X\n"), sptr,
|
||||
q.object_name, q.object_id);
|
||||
qname, q.object_id);
|
||||
printf(_(" %5s %-12s %-32s %-7s %-4s %-8s\n"
|
||||
"-----------------------------------------------"
|
||||
"--------------------------------\n"),
|
||||
@@ -191,19 +213,9 @@ main(int argc, char **argv)
|
||||
while (maxqlen-- && job_id && (ncp_get_queue_job_info(conn, q.object_id, job_id, &j) == 0))
|
||||
{
|
||||
const char* jst;
|
||||
char user[MAX_DN_BYTES];
|
||||
|
||||
char user[50];
|
||||
if ((ncp_get_bindery_object_name
|
||||
(conn, ntohl(j.ClientObjectID), &u))
|
||||
== 0)
|
||||
{
|
||||
memcpy(user,u.object_name,48);
|
||||
user[48]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(user,_("<Unknown>"));
|
||||
}
|
||||
get_object_name(conn, ntohl(j.ClientObjectID), user);
|
||||
|
||||
j.JobFileName[j.FileNameLen]=0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user