1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
*** smb_abstraction.c.orig Wed Feb 5 16:50:50 1997
--- smb_abstraction.c Sat Jul 5 20:50:15 1997
***************
*** 118,123 ****
--- 118,128 ----
memset(&data, 0, sizeof(struct smb_mount_data));
memset(hostname, 0, sizeof(hostname));
gethostname(hostname, MAXHOSTNAMELEN);
+ {
+ char* s=strchr(hostname, '.');
+ if (s)
+ *s=0;
+ }
if((h = gethostbyname(p->server_ipname)) == NULL){
eprintf("%s: unknown host\n", p->server_ipname);
***************
*** 133,147 ****
--- 138,159 ----
}
data.version = SMB_MOUNT_VERSION;
strncpy(data.service, p->service, sizeof(data.service));
+ data.service[sizeof(data.service)-1] = 0;
+ str_upper(data.service);
strncpy(data.root_path, p->root_path, sizeof(data.root_path));
+ data.root_path[sizeof(data.root_path)-1] = 0;
strncpy(data.username, p->username, sizeof(data.username));
+ data.username[sizeof(data.username)-1] = 0;
strncpy(data.password, p->password, sizeof(data.password));
+ data.password[sizeof(data.password)-1] = 0;
if(p->max_xmit > 0)
data.max_xmit = p->max_xmit;
else
data.max_xmit = 4070;
strncpy(data.server_name, p->server_name, sizeof(data.server_name));
+ data.server_name[sizeof(data.server_name)-1]=0;
strncpy(data.client_name, p->client_name, sizeof(data.client_name));
+ data.client_name[sizeof(data.client_name)-1]=0;
if(data.server_name[0] == 0){
if(strlen(p->server_ipname) > 16){
***************
*** 150,157 ****
goto error_occured;
}
strcpy(data.server_name, p->server_ipname);
- str_upper(data.server_name);
}
if(data.client_name[0] == 0) {
if(strlen(hostname) > 16) {
eprintf("my hostname name too long for netbios: %s\n", hostname);
--- 162,169 ----
goto error_occured;
}
strcpy(data.server_name, p->server_ipname);
}
+ str_upper(data.server_name);
if(data.client_name[0] == 0) {
if(strlen(hostname) > 16) {
eprintf("my hostname name too long for netbios: %s\n", hostname);
***************
*** 446,451 ****
--- 458,464 ----
int smba_setattr(smba_file_t *f, smba_stat_t *data)
{
+ int error = 0;
if(data->atime != -1)
f->dirent.atime = data->atime;
if(data->ctime != -1)
***************
*** 456,462 ****
if(data->is_wp)
f->dirent.attr |= aRONLY;
f->attr_dirty = 1;
! return write_attr(f);
}
/* ------------------------------------------------------------------------- */
--- 469,487 ----
if(data->is_wp)
f->dirent.attr |= aRONLY;
f->attr_dirty = 1;
! error = write_attr(f);
! if (error)
! return error;
! if (data->size == -1)
! return error;
! if (data->size == f->dirent.size)
! return error;
! if ( (error = make_open(f, 1)) < 0)
! return error;
! if ( (error = smb_proc_trunc(&f->server->server, f->dirent.fileid, data->size)) < 0)
! return error;
! f->dirent.size = data->size;
! return error;
}
/* ------------------------------------------------------------------------- */
|