-rw-r--r-- | noncore/net/opie-smb/opie-smb.control | 2 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opie-smb/opie-smb.control b/noncore/net/opie-smb/opie-smb.control index 98a23b4..fc8c316 100644 --- a/noncore/net/opie-smb/opie-smb.control +++ b/noncore/net/opie-smb/opie-smb.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-smb | 1 | Package: opie-smb |
2 | Files: plugins/application/libopie-smb.so* bin/opie-smb pics/opie-smb apps/Applications/opie-smb.desktop | 2 | Files: plugins/application/libopie-smb.so* bin/opie-smb bin/smbfind pics/opie-smb apps/Applications/opie-smb.desktop |
3 | Version: $QPE_VERSION$EXTRAVERSION | 3 | Version: $QPE_VERSION$EXTRAVERSION |
4 | Architecture: arm | 4 | Architecture: arm |
5 | Arch: arm | 5 | Arch: arm |
6 | Maintainer: Kurt Korbatits (support@midget.net.au) | 6 | Maintainer: Kurt Korbatits (support@midget.net.au) |
7 | Section: Network | 7 | Section: Network |
8 | Priority: optional | 8 | Priority: optional |
9 | Description: Gui front end for samba utilities. | 9 | Description: Gui front end for samba utilities. |
10 | Source: | 10 | Source: |
11 | Depends: smbclient | 11 | Depends: smbclient |
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp index 527ab38..880573b 100644 --- a/noncore/net/opie-smb/qsmb.cpp +++ b/noncore/net/opie-smb/qsmb.cpp | |||
@@ -77,97 +77,97 @@ void Qsmb::DoItClicked() | |||
77 | 77 | ||
78 | void* runit(void* arg) | 78 | void* runit(void* arg) |
79 | { | 79 | { |
80 | Qsmb* caller = (Qsmb*)arg; | 80 | Qsmb* caller = (Qsmb*)arg; |
81 | caller->scan(); | 81 | caller->scan(); |
82 | return(0); | 82 | return(0); |
83 | } | 83 | } |
84 | 84 | ||
85 | void* runitm(void* arg) | 85 | void* runitm(void* arg) |
86 | { | 86 | { |
87 | Qsmb* caller = (Qsmb*)arg; | 87 | Qsmb* caller = (Qsmb*)arg; |
88 | caller->DoIt(); | 88 | caller->DoIt(); |
89 | return(0); | 89 | return(0); |
90 | } | 90 | } |
91 | 91 | ||
92 | void Qsmb::scan() | 92 | void Qsmb::scan() |
93 | { | 93 | { |
94 | int i; | 94 | int i; |
95 | 95 | ||
96 | if (scanning) return; | 96 | if (scanning) return; |
97 | scanning = true; | 97 | scanning = true; |
98 | 98 | ||
99 | char match[512], lmhosts[512]; | 99 | char match[512], lmhosts[512]; |
100 | QString cmd; | 100 | QString cmd; |
101 | char result[256]; | 101 | char result[256]; |
102 | 102 | ||
103 | FILE *pipe, *pipe2; | 103 | FILE *pipe, *pipe2; |
104 | 104 | ||
105 | LScan->setText("Scanning..."); | 105 | LScan->setText("Scanning..."); |
106 | qApp->processEvents(); | 106 | qApp->processEvents(); |
107 | 107 | ||
108 | cmd = "ifconfig |grep 'addr:'|awk '{print $2}'|awk 'BEGIN{FS=\":\"}{print $2}'|sed 's/\\.[0-9]*$//'|head -n1"; | 108 | cmd = "ifconfig |grep 'addr:'|awk '{print $2}'|awk 'BEGIN{FS=\":\"}{print $2}'|sed 's/\\.[0-9]*$//'|head -n1"; |
109 | 109 | ||
110 | owarn << "cmd: " << cmd << oendl; | 110 | owarn << "cmd: " << cmd << oendl; |
111 | 111 | ||
112 | /* run findsmb & read output */ | 112 | /* run findsmb & read output */ |
113 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { | 113 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { |
114 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 114 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
115 | TextViewOutput->append(result); | 115 | TextViewOutput->append(result); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | while(fgets(result, 256, pipe) != NULL) { | 118 | while(fgets(result, 256, pipe) != NULL) { |
119 | strcpy( match, result); | 119 | strcpy( match, result); |
120 | match[5]='\0'; | 120 | match[5]='\0'; |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | owarn << "match: " << match << oendl; | 123 | owarn << "match: " << match << oendl; |
124 | 124 | ||
125 | cmd = "/usr/bin/findsmb"; | 125 | cmd = "smbfind"; |
126 | owarn <<"cmd: " << cmd << oendl; | 126 | owarn <<"cmd: " << cmd << oendl; |
127 | 127 | ||
128 | TextViewOutput->append(cmd); | 128 | TextViewOutput->append(cmd); |
129 | 129 | ||
130 | snprintf(lmhosts, 512, "echo '127.0.0.1 localhost'>/etc/samba/lmhosts"); | 130 | snprintf(lmhosts, 512, "echo '127.0.0.1 localhost'>/etc/samba/lmhosts"); |
131 | 131 | ||
132 | if ((pipe2 = popen(lmhosts, "r")) == NULL) { | 132 | if ((pipe2 = popen(lmhosts, "r")) == NULL) { |
133 | snprintf(result, 256, "Error: Can't run %s", lmhosts); | 133 | snprintf(result, 256, "Error: Can't run %s", lmhosts); |
134 | //TextViewOutput->append(result); | 134 | //TextViewOutput->append(result); |
135 | return; | 135 | return; |
136 | } | 136 | } |
137 | 137 | ||
138 | /* run command & read output */ | 138 | /* run command & read output */ |
139 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { | 139 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { |
140 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 140 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
141 | TextViewOutput->append(result); | 141 | TextViewOutput->append(result); |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | /* parse output and display in ListViewScan */ | 145 | /* parse output and display in ListViewScan */ |
146 | while(fgets(result, 256, pipe) != NULL) { | 146 | while(fgets(result, 256, pipe) != NULL) { |
147 | /* put result into TextViewOutput */ | 147 | /* put result into TextViewOutput */ |
148 | TextViewOutput->append(result); | 148 | TextViewOutput->append(result); |
149 | 149 | ||
150 | if( strstr(result, match) != NULL ) { | 150 | if( strstr(result, match) != NULL ) { |
151 | char ip_addr[256], host[256], *ptr1; | 151 | char ip_addr[256], host[256], *ptr1; |
152 | 152 | ||
153 | strcpy( ip_addr, result); | 153 | strcpy( ip_addr, result); |
154 | ptr1 = strchr(ip_addr,' '); | 154 | ptr1 = strchr(ip_addr,' '); |
155 | strcpy( host, ptr1); | 155 | strcpy( host, ptr1); |
156 | ip_addr[ptr1 - ip_addr]='\0'; | 156 | ip_addr[ptr1 - ip_addr]='\0'; |
157 | 157 | ||
158 | for(i = 0; i < 256; i++) { | 158 | for(i = 0; i < 256; i++) { |
159 | if(host[i]!=' ') { | 159 | if(host[i]!=' ') { |
160 | strcpy( host, host + i); | 160 | strcpy( host, host + i); |
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | ptr1 = strchr(host,' '); | 164 | ptr1 = strchr(host,' '); |
165 | host[ptr1 - host] = '\0'; | 165 | host[ptr1 - host] = '\0'; |
166 | 166 | ||
167 | owarn << "add host: " << host << oendl; | 167 | owarn << "add host: " << host << oendl; |
168 | 168 | ||
169 | CBHost->insertItem( host, -1); | 169 | CBHost->insertItem( host, -1); |
170 | snprintf( lmhosts, 512, "echo '%s %s'>>/etc/samba/lmhosts", ip_addr,host); | 170 | snprintf( lmhosts, 512, "echo '%s %s'>>/etc/samba/lmhosts", ip_addr,host); |
171 | 171 | ||
172 | owarn << "lmhosts: " << lmhosts << oendl; | 172 | owarn << "lmhosts: " << lmhosts << oendl; |
173 | 173 | ||