Apply patch: ncpfs-hg-commit-431.patch
This commit is contained in:
@@ -532,10 +532,13 @@ dstDetermined:;
|
||||
ncopy = 1;
|
||||
}
|
||||
} else {
|
||||
err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddr), saddr);
|
||||
if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddr), daddr);
|
||||
char saddrs[100];
|
||||
char daddrs[100];
|
||||
|
||||
err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddrs), saddrs);
|
||||
if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddrs), daddrs);
|
||||
if (!err) {
|
||||
ncopy = !strcmp(saddr, daddr);
|
||||
ncopy = !strcmp(saddrs, daddrs);
|
||||
}
|
||||
}
|
||||
if (ncopy) {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
static char *progname;
|
||||
|
||||
static void
|
||||
print_property(char *prop_name, u_int8_t * val, int segments);
|
||||
print_property(char *prop_name, const u_int8_t * val, int segments);
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
@@ -265,7 +265,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
static void
|
||||
print_unknown(u_int8_t * val)
|
||||
print_unknown(const u_int8_t * val)
|
||||
{
|
||||
int j = (128 / 16);
|
||||
while (1)
|
||||
@@ -292,9 +292,9 @@ print_unknown(u_int8_t * val)
|
||||
}
|
||||
|
||||
static void
|
||||
print_string(u_int8_t * val, int segments)
|
||||
print_string(const u_int8_t * val, int segments)
|
||||
{
|
||||
puts(val);
|
||||
puts((const char*)val);
|
||||
(void)segments;
|
||||
}
|
||||
|
||||
@@ -351,12 +351,12 @@ static inline size_t my_strftime(char *s, size_t max, const char *fmt, const str
|
||||
|
||||
|
||||
static void
|
||||
print_login_control(u_int8_t * val, int segments)
|
||||
print_login_control(const u_int8_t * val, int segments)
|
||||
{
|
||||
static const time_t zero_time_t = 0;
|
||||
int i, j, mask;
|
||||
char buff[32];
|
||||
struct ncp_prop_login_control *a = (struct ncp_prop_login_control *) val;
|
||||
const struct ncp_prop_login_control *a = (const struct ncp_prop_login_control *) val;
|
||||
|
||||
if (a->LastLogin[2] || a->LastLogin[1] || a->LastLogin[0] ||
|
||||
a->LastLogin[3] || a->LastLogin[4] || a->LastLogin[5])
|
||||
@@ -495,17 +495,17 @@ print_login_control(u_int8_t * val, int segments)
|
||||
}
|
||||
|
||||
static void
|
||||
print_addr(u_int8_t * val, int segments)
|
||||
print_addr(const u_int8_t * val, int segments)
|
||||
{
|
||||
char buff[50];
|
||||
print_station_addr("(%L): %N[%S]",
|
||||
(struct ncp_station_addr *) val, buff);
|
||||
(const struct ncp_station_addr *) val, buff);
|
||||
printf("%s\n", buff);
|
||||
(void)segments;
|
||||
}
|
||||
|
||||
static void
|
||||
print_hex(u_int8_t *val, int segments) {
|
||||
print_hex(const u_int8_t *val, int segments) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < segments; i++) {
|
||||
@@ -517,7 +517,7 @@ print_hex(u_int8_t *val, int segments) {
|
||||
|
||||
static const struct
|
||||
{
|
||||
void (*func) (u_int8_t *, int);
|
||||
void (*func)(const u_int8_t *, int);
|
||||
const char *pname;
|
||||
}
|
||||
formats[] =
|
||||
@@ -534,7 +534,7 @@ formats[] =
|
||||
};
|
||||
|
||||
static void
|
||||
print_property(char *prop_name, u_int8_t * val, int segments)
|
||||
print_property(char *prop_name, const u_int8_t * val, int segments)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
|
||||
int object_type = NCP_BINDERY_USER;
|
||||
unsigned char ncp_key[8];
|
||||
struct ncp_bindery_object user;
|
||||
unsigned char buf_obj_name[50];
|
||||
char *buf_obj_name;
|
||||
long err;
|
||||
|
||||
char *str;
|
||||
@@ -113,12 +113,14 @@ main(int argc, char *argv[])
|
||||
com_err(argv[0], err, _("trying to find server"));
|
||||
exit(1);
|
||||
}
|
||||
if (!object_name)
|
||||
{
|
||||
if (!object_name) {
|
||||
object_name = spec.user;
|
||||
} else
|
||||
{
|
||||
strcpy(buf_obj_name, object_name);
|
||||
} else {
|
||||
buf_obj_name = strdup(object_name);
|
||||
if (!buf_obj_name) {
|
||||
fprintf(stderr, _("%s: Out of memory!\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
object_name = buf_obj_name;
|
||||
str_upper(object_name);
|
||||
}
|
||||
|
||||
@@ -124,6 +124,16 @@ init_queue(struct ncp_conn *conn, char *queue_name, char *command,
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
add_string(char *target, char *target_end, const char *str) {
|
||||
size_t len = strlen(str);
|
||||
if (target + len + 1 > target_end) {
|
||||
len = target_end - target - 1;
|
||||
}
|
||||
memcpy(target, str, len);
|
||||
return target + len;
|
||||
}
|
||||
|
||||
static void
|
||||
build_command(struct nw_queue *q, struct queue_job *j,
|
||||
char *target, int target_size, char *user)
|
||||
@@ -131,26 +141,12 @@ build_command(struct nw_queue *q, struct queue_job *j,
|
||||
char *s = q->command;
|
||||
char *target_end = target + target_size;
|
||||
|
||||
static void add_string(const char *str)
|
||||
{
|
||||
int len = strlen(str);
|
||||
if (target + len + 1 > target_end)
|
||||
{
|
||||
len = target_end - target - 1;
|
||||
}
|
||||
strncpy(target, str, len);
|
||||
target += len;
|
||||
}
|
||||
|
||||
memset(target, 0, target_size);
|
||||
|
||||
while ((*s != 0) && (target < target_end))
|
||||
{
|
||||
if (*s != '%')
|
||||
{
|
||||
*target = *s;
|
||||
target += 1;
|
||||
s += 1;
|
||||
if (*s != '%') {
|
||||
*target++ = *s++;
|
||||
continue;
|
||||
}
|
||||
switch (*(s + 1))
|
||||
@@ -160,13 +156,13 @@ build_command(struct nw_queue *q, struct queue_job *j,
|
||||
target += 1;
|
||||
break;
|
||||
case 'u':
|
||||
add_string(user);
|
||||
target = add_string(target, target_end, user);
|
||||
break;
|
||||
case 'd':
|
||||
if (j->j.JobTextDescription[0])
|
||||
add_string(j->j.JobTextDescription);
|
||||
target = add_string(target, target_end, j->j.JobTextDescription);
|
||||
else
|
||||
add_string(_("No Description"));
|
||||
target = add_string(target, target_end, _("No Description"));
|
||||
break;
|
||||
default:
|
||||
*target = '%';
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <ncp/nwcalls.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "private/libintl.h"
|
||||
#define _(X) gettext(X)
|
||||
|
||||
@@ -146,49 +146,44 @@ init_queue(struct ncp_conn *conn, char *queue_name, char *command,
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
add_string(char* target, char* target_end, const char *str) {
|
||||
size_t len = strlen(str);
|
||||
|
||||
if (target + len + 1 > target_end) {
|
||||
len = target_end - target - 1;
|
||||
}
|
||||
memcpy(target, str, len);
|
||||
return target + len;
|
||||
}
|
||||
|
||||
static void
|
||||
build_command(struct nw_queue *q, struct queue_job *j,
|
||||
char *target, int target_size, char *user)
|
||||
char *target, size_t target_size, char *user)
|
||||
{
|
||||
char *s = q->command;
|
||||
char *target_end = target + target_size;
|
||||
|
||||
static void add_string(const char *str)
|
||||
{
|
||||
int len = strlen(str);
|
||||
if (target + len + 1 > target_end)
|
||||
{
|
||||
len = target_end - target - 1;
|
||||
}
|
||||
strncpy(target, str, len);
|
||||
target += len;
|
||||
}
|
||||
|
||||
memset(target, 0, target_size);
|
||||
|
||||
while ((*s != 0) && (target < target_end))
|
||||
{
|
||||
if (*s != '%')
|
||||
{
|
||||
*target = *s;
|
||||
target += 1;
|
||||
s += 1;
|
||||
if (*s != '%') {
|
||||
*target++ = *s++;
|
||||
continue;
|
||||
}
|
||||
switch (*(s + 1))
|
||||
{
|
||||
switch (*(s + 1)) {
|
||||
case '%':
|
||||
*target = '%';
|
||||
target += 1;
|
||||
*target++ = '%';
|
||||
break;
|
||||
case 'u':
|
||||
add_string(user);
|
||||
target = add_string(target, target_end, user);
|
||||
break;
|
||||
case 'd':
|
||||
if (j->j.JobTextDescription[0])
|
||||
add_string(j->j.JobTextDescription);
|
||||
target = add_string(target, target_end, j->j.JobTextDescription);
|
||||
else
|
||||
add_string(_("No Description"));
|
||||
target = add_string(target, target_end, _("No Description"));
|
||||
break;
|
||||
default:
|
||||
*target = '%';
|
||||
|
||||
Reference in New Issue
Block a user