Apply patch: ncpfs-hg-commit-446.patch
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "private/libintl.h"
|
||||
#define _(X) gettext(X)
|
||||
@@ -73,6 +74,7 @@ help(void)
|
||||
"\n"
|
||||
"-o object_name Name of object added as trustee\n"
|
||||
"-t type Object type (decimal value)\n"
|
||||
"-O object_id Object identifier\n"
|
||||
"-r rights Rights mask (see manual page)\n"
|
||||
"\n"
|
||||
"directory\n"
|
||||
@@ -85,7 +87,6 @@ main(int argc, char *argv[])
|
||||
struct ncp_conn *conn;
|
||||
char *object_name = NULL;
|
||||
int object_type = -1;
|
||||
struct ncp_bindery_object o;
|
||||
u_int16_t rights = ~0;
|
||||
int perr = 0;
|
||||
const char *path = NULL;
|
||||
@@ -98,6 +99,8 @@ main(int argc, char *argv[])
|
||||
int enclen;
|
||||
TRUSTEE_INFO tstinfo;
|
||||
NWCCODE nwerr;
|
||||
NWObjectID object_id;
|
||||
int object_id_valid = 0;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(NCPFS_PACKAGE, LOCALEDIR);
|
||||
@@ -109,10 +112,14 @@ main(int argc, char *argv[])
|
||||
{
|
||||
useConn = 1;
|
||||
}
|
||||
while ((opt = getopt(argc, argv, "h?o:t:r:")) != EOF)
|
||||
while ((opt = getopt(argc, argv, "h?O:o:t:r:")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'O':
|
||||
object_id = strtoul(optarg, NULL, 0);
|
||||
object_id_valid = 1;
|
||||
break;
|
||||
case 'o':
|
||||
object_name = optarg;
|
||||
str_upper(object_name);
|
||||
@@ -121,10 +128,14 @@ main(int argc, char *argv[])
|
||||
object_type = atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
if (*optarg == '[') {
|
||||
perr = ncp_str_to_perms(optarg, &rights);
|
||||
} else {
|
||||
rights = strtol(optarg, NULL, 16);
|
||||
perr = ncp_str_to_perms(optarg, &rights);
|
||||
if (perr) {
|
||||
char* end;
|
||||
|
||||
rights = strtol(optarg, &end, 16);
|
||||
if (!*end || isspace(*end)) {
|
||||
perr = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
@@ -137,12 +148,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (object_name == NULL)
|
||||
{
|
||||
fprintf(stderr, _("%s: You must specify an object name\n"),
|
||||
argv[0]);
|
||||
goto finished;
|
||||
}
|
||||
if (perr < 0)
|
||||
{
|
||||
fprintf(stderr, _("%s: You must give a valid rights string\n"),
|
||||
@@ -181,7 +186,13 @@ main(int argc, char *argv[])
|
||||
path = volume;
|
||||
}
|
||||
|
||||
if (object_type < 0) {
|
||||
if (object_id_valid) {
|
||||
/* nothing */
|
||||
} else if (object_name == NULL) {
|
||||
fprintf(stderr, _("%s: You must specify an object name\n"),
|
||||
argv[0]);
|
||||
goto finished;
|
||||
} else if (object_type < 0) {
|
||||
#ifdef NDS_SUPPORT
|
||||
u_int32_t flags;
|
||||
NWDSContextHandle ctx;
|
||||
@@ -201,7 +212,7 @@ failDS:;
|
||||
flags |= DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES;
|
||||
NWDSSetContext(ctx, DCK_FLAGS, &flags);
|
||||
}
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &o.object_id);
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &object_id);
|
||||
if (nwerr) {
|
||||
goto failDS;
|
||||
}
|
||||
@@ -212,12 +223,15 @@ failDS:;
|
||||
goto finished;
|
||||
#endif
|
||||
} else {
|
||||
struct ncp_bindery_object o;
|
||||
|
||||
if ((nwerr = ncp_get_bindery_object_id(conn, object_type, object_name, &o)) != 0)
|
||||
{
|
||||
fprintf(stderr, _("%s: Could not find object %s: %s\n"),
|
||||
progname, object_name, strnwerror(nwerr));
|
||||
goto finished;
|
||||
}
|
||||
object_id = o.object_id;
|
||||
}
|
||||
enclen = ncp_path_to_NW_format(path, encpath, sizeof(encpath));
|
||||
if (enclen < 0) {
|
||||
@@ -225,7 +239,7 @@ failDS:;
|
||||
progname, strerror(-enclen));
|
||||
goto finished;
|
||||
}
|
||||
tstinfo.objectID = o.object_id;
|
||||
tstinfo.objectID = object_id;
|
||||
tstinfo.objectRights = rights;
|
||||
nwerr = ncp_ns_trustee_add(conn, NW_NS_DOS, SA_ALL,
|
||||
NCP_DIRSTYLE_NOHANDLE, 0, 0, encpath, enclen, &tstinfo, 1, ~0);
|
||||
|
||||
@@ -65,6 +65,7 @@ help(void)
|
||||
"\n"
|
||||
"-o object_name Name of object removed as trustee\n"
|
||||
"-t type Object type (decimal value)\n"
|
||||
"-O object_id Object identifier\n"
|
||||
"\n"
|
||||
"file/directory\n"
|
||||
"\n"));
|
||||
@@ -76,7 +77,6 @@ main(int argc, char *argv[])
|
||||
struct ncp_conn *conn;
|
||||
char *object_name = NULL;
|
||||
int object_type = -1;
|
||||
struct ncp_bindery_object o;
|
||||
const char *path = NULL;
|
||||
long err;
|
||||
int result = 1;
|
||||
@@ -87,6 +87,8 @@ main(int argc, char *argv[])
|
||||
TRUSTEE_INFO tstinfo;
|
||||
int useConn = 0;
|
||||
NWDSCCODE nwerr;
|
||||
NWObjectID object_id;
|
||||
int object_id_valid = 0;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(NCPFS_PACKAGE, LOCALEDIR);
|
||||
@@ -98,10 +100,14 @@ main(int argc, char *argv[])
|
||||
{
|
||||
useConn = 1;
|
||||
}
|
||||
while ((opt = getopt(argc, argv, "h?o:t:")) != EOF)
|
||||
while ((opt = getopt(argc, argv, "h?o:t:O:")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'O':
|
||||
object_id = strtoul(optarg, NULL, 0);
|
||||
object_id_valid = 1;
|
||||
break;
|
||||
case 'o':
|
||||
object_name = optarg;
|
||||
str_upper(object_name);
|
||||
@@ -119,12 +125,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (object_name == NULL)
|
||||
{
|
||||
fprintf(stderr, _("%s: You must specify an object name\n"),
|
||||
argv[0]);
|
||||
goto finished;
|
||||
}
|
||||
if (!useConn) {
|
||||
if (optind != argc - 1)
|
||||
{
|
||||
@@ -150,7 +150,13 @@ main(int argc, char *argv[])
|
||||
strcat(volume, directory);
|
||||
path = volume;
|
||||
}
|
||||
if (object_type < 0) {
|
||||
if (object_id_valid) {
|
||||
/* nothing */
|
||||
} else if (object_name == NULL) {
|
||||
fprintf(stderr, _("%s: You must specify an object name\n"),
|
||||
argv[0]);
|
||||
goto finished;
|
||||
} else if (object_type < 0) {
|
||||
#ifdef NDS_SUPPORT
|
||||
u_int32_t flags;
|
||||
NWDSContextHandle ctx;
|
||||
@@ -170,7 +176,7 @@ failDS:;
|
||||
if (!NWDSGetContext(ctx, DCK_FLAGS, &flags)) {
|
||||
flags |= DCV_XLATE_STRINGS | DCV_TYPELESS_NAMES;
|
||||
}
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &o.object_id);
|
||||
nwerr = NWDSMapNameToID(ctx, conn, object_name, &object_id);
|
||||
if (nwerr) {
|
||||
NWDSFreeContext(ctx);
|
||||
goto failDS;
|
||||
@@ -182,19 +188,22 @@ failDS:;
|
||||
goto finished;
|
||||
#endif
|
||||
} else {
|
||||
struct ncp_bindery_object o;
|
||||
|
||||
nwerr = ncp_get_bindery_object_id(conn, object_type, object_name, &o);
|
||||
if (nwerr != 0) {
|
||||
fprintf(stderr, _("%s: Could not find object %s: %s\n"),
|
||||
progname, object_name, strnwerror(nwerr));
|
||||
goto finished;
|
||||
}
|
||||
object_id = o.object_id;
|
||||
}
|
||||
enclen = ncp_path_to_NW_format(path, encpath, sizeof(encpath));
|
||||
if (enclen < 0) {
|
||||
fprintf(stderr, _("%s: Invalid path: %s\n"), progname, strerror(-enclen));
|
||||
goto finished;
|
||||
}
|
||||
tstinfo.objectID = o.object_id;
|
||||
tstinfo.objectID = object_id;
|
||||
tstinfo.objectRights = 0;
|
||||
nwerr = ncp_ns_trustee_del(conn, NW_NS_DOS, 0xFF, 0, 0,
|
||||
encpath, enclen, &tstinfo, 1);
|
||||
|
||||
Reference in New Issue
Block a user