Update the DOS utilities and test suite with the current Novell comparison state. Validated/updated tool behavior: - improve CREATOR output by showing Novell-style attribute and rights masks - extend FLAGDIR handling with old NCP22 directory attribute read/write fallback paths - expand NDIR Novell-style formatting, filtering, /SUB handling, date output, DI/RI attribute display and richer metadata collection - adjust REVOKE output/grammar, recursive /SUBDIRECTORIES behavior and trustee update/delete paths to better match Novell tools - adjust SLIST header/output behavior for logged-in and logged-out cases - update README status to reflect the currently green/tested tools Test-suite changes: - add/refresh Novell comparison tests for CREATOR, NDIR, REVOKE and SLIST - update NCOPY tests and collection scripts for the current investigation state - refresh per-tool README files and top-level test documentation - keep MAP documented as still separately open NCOPY: - add the current NCOPY implementation and experimental NCP74/server-side-copy scaffolding - build ncopy.c so it stays compile-tested - keep NCOPY disabled in the NET multicall dispatch for now because the server-side-copy/open-handle path is still unsafe and needs further analysis Build: - include ncopy.c in the DOS utility build - drop the temporary MARS_DOSUTILS_VERSION define wiring from CMake
120 lines
2.6 KiB
C
120 lines
2.6 KiB
C
/* slist.c - list known NetWare file servers, DOS mars-dosutils version */
|
|
|
|
#include "net.h"
|
|
|
|
#define NCP_BINDERY_FSERVER 0x0004
|
|
|
|
static int usage(void)
|
|
{
|
|
fprintf(stdout, "Usage: SLIST [Server] [/Continue] \n");
|
|
return(0);
|
|
}
|
|
|
|
static int same_arg(char *a, char *b)
|
|
{
|
|
while (*a || *b) {
|
|
int ca = *a++;
|
|
int cb = *b++;
|
|
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
|
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
|
if (ca != cb) return(0);
|
|
}
|
|
return(1);
|
|
}
|
|
|
|
static int is_help_arg(char *s)
|
|
{
|
|
if (!s) return(0);
|
|
return(same_arg(s, "/?") || same_arg(s, "-?") || same_arg(s, "?"));
|
|
}
|
|
|
|
static unsigned long node_to_number(uint8 *addr)
|
|
{
|
|
unsigned long n = 0;
|
|
int i;
|
|
|
|
for (i = 4; i < 10; i++)
|
|
n = (n << 8) + addr[i];
|
|
|
|
return(n);
|
|
}
|
|
|
|
static void print_net_node_status(uint8 *addr, int is_default)
|
|
{
|
|
fprintf(stdout, "[%08lX][%12lu]%s",
|
|
(unsigned long)GET_BE32(addr),
|
|
node_to_number(addr),
|
|
is_default ? "Default " : "");
|
|
}
|
|
|
|
int func_slist(int argc, char *argv[], int mode)
|
|
{
|
|
BINDERY_OBJECT obj;
|
|
uint32 last_id = MAX_U32;
|
|
uint8 pattern[50];
|
|
int explicit_server = 0;
|
|
int found = 0;
|
|
int result;
|
|
int i;
|
|
int continuous = 0;
|
|
int line_count = 0;
|
|
|
|
(void)mode;
|
|
|
|
strcpy(pattern, "*");
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
if (is_help_arg(argv[i])) return(usage());
|
|
|
|
if (argv[i][0] == '/' || argv[i][0] == '-') {
|
|
if (same_arg(argv[i], "/C") || same_arg(argv[i], "/CONTINUE") ||
|
|
same_arg(argv[i], "-C") || same_arg(argv[i], "-CONTINUE")) {
|
|
continuous = 1;
|
|
continue;
|
|
}
|
|
return(usage());
|
|
}
|
|
|
|
strmaxcpy(pattern, argv[i], sizeof(pattern) - 1);
|
|
explicit_server = 1;
|
|
}
|
|
|
|
upstr(pattern);
|
|
|
|
while ((result = ncp_17_37(last_id, NCP_BINDERY_FSERVER,
|
|
pattern, &obj)) == 0) {
|
|
NW_PROPERTY prop;
|
|
|
|
found++;
|
|
last_id = obj.object_id;
|
|
|
|
if (found == 1) {
|
|
fprintf(stdout, "%-48sNetwork Node Address Status\n",
|
|
"Known NetWare File Servers");
|
|
fprintf(stdout, "%-48s------- ------------ ------\n",
|
|
"--------------------------");
|
|
}
|
|
|
|
fprintf(stdout, "%-47s", obj.object_name);
|
|
|
|
if (!ncp_17_3d(NCP_BINDERY_FSERVER, obj.object_name,
|
|
1, "NET_ADDRESS", &prop)) {
|
|
print_net_node_status(prop.value, found == 1);
|
|
}
|
|
|
|
fprintf(stdout, "\n");
|
|
tool_page_line(&line_count, &continuous);
|
|
|
|
if (last_id == MAX_U32) break;
|
|
}
|
|
|
|
if (explicit_server && !found) {
|
|
fprintf(stdout, "Server %s not found.\n", pattern);
|
|
return(0);
|
|
}
|
|
|
|
fprintf(stdout, "\nTotal of %d file servers found\n", found);
|
|
|
|
return(0);
|
|
}
|