Changeset 25213 for titan/plugins/networkbrowser
- Timestamp:
- 12/14/13 17:04:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/networkbrowser/networkbrowser.h
r25208 r25213 932 932 if(error == 1 && found == 0) 933 933 { 934 char* cmd = NULL; 935 cmd = ostrcat("smbclient -L //" , s, 0, 0); 934 char* cmd = NULL, *bin = NULL; 935 cmd = ostrcat("which smbclient3 | wc -l", NULL , 0, 0); 936 debug(70, "cmd: %s", cmd); 937 938 char* tmpstr1 = command(cmd); 939 debug(70, "---- binary check ----"); 940 debug(70, "%s", tmpstr1); 941 debug(70, "----------------------"); 942 if(!ostrncmp("0", tmpstr1, 1)) 943 { 944 textbox(_("Message"), _("For Better Win7 Support install please Tpk Install > Network > Smbclient"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 5, 0); 945 bin = ostrcat("smbclient", NULL , 0, 0); 946 } 947 else 948 bin = ostrcat("smbclient3", NULL , 0, 0); 949 950 free(cmd), cmd = NULL; 951 free(tmpstr1), tmpstr1 = NULL; 952 953 cmd = ostrcat(bin, " -L //" , 0, 0); 954 cmd = ostrcat(cmd , r, 1, 0); 936 955 cmd = ostrcat(cmd, " -U '" , 1, 0); 937 956 cmd = ostrcat(cmd, u , 1, 0); … … 941 960 debug(70, "cmd: %s", cmd); 942 961 943 char*tmpstr1 = command(cmd);944 printf("tmpstr1: %s\n",tmpstr1);962 tmpstr1 = command(cmd); 963 debug(70, "------ result 1 ------"); 945 964 debug(70, "%s", tmpstr1); 946 947 char* tmpstr2 = string_resub("--------- ---- -------", "This machine has a browse list:", tmpstr1, 0); 965 debug(70, "----------------------"); 966 967 char* tmpstr2 = NULL; 968 if(ostrstr(tmpstr1, "This machine has a browse list:") != NULL) 969 tmpstr2 = string_resub("--------- ---- -------", "This machine has a browse list:", tmpstr1, 0); 970 else 971 tmpstr2 = string_resub("--------- ---- -------", "Server Comment", tmpstr1, 0); 972 973 debug(70, "------ result 2 ------"); 974 debug(70, "%s", tmpstr2); 975 debug(70, "----------------------"); 976 948 977 free(tmpstr1), tmpstr1 = NULL; 949 978 … … 951 980 { 952 981 free(cmd), cmd = NULL; 953 cmd = ostrcat("smbclient -N -L //" , s, 0, 0); 982 cmd = ostrcat(bin, " -N -L //" , 0, 0); 983 cmd = ostrcat(cmd , r, 1, 0); 954 984 debug(70, "cmd: %s", cmd); 955 985 956 986 tmpstr1 = command(cmd); 987 debug(70, "------ result 3 ------"); 957 988 debug(70, "%s", tmpstr1); 989 debug(70, "----------------------"); 958 990 959 991 free(tmpstr2), tmpstr2 = NULL; 960 tmpstr2 = string_resub("--------- ---- -------", "This machine has a browse list:", tmpstr1, 0); 992 if(ostrstr(tmpstr1, "This machine has a browse list:") != NULL) 993 tmpstr2 = string_resub("--------- ---- -------", "This machine has a browse list:", tmpstr1, 0); 994 else 995 tmpstr2 = string_resub("--------- ---- -------", "Server Comment", tmpstr1, 0); 996 997 debug(70, "------ result 4 ------"); 998 debug(70, "%s", tmpstr2); 999 debug(70, "----------------------"); 1000 1001 if(tmpstr2 == NULL) 1002 { 1003 if(ostrstr(tmpstr1, "Anonymous login successful") != NULL && ostrstr(tmpstr1, "Error returning browse list: NT_STATUS_ACCESS_DENIED") != NULL) 1004 { 1005 textbox(_("Message"), _("Anonymous login Access Denied !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0); 1006 found = 1; 1007 } 1008 else if(ostrstr(tmpstr1, "Anonymous login successful") != NULL) 1009 textbox(_("Message"), _("Anonymous login successful"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0); 1010 else if(ostrstr(tmpstr1, "Access denied") != NULL) 1011 textbox(_("Message"), _("Anonymous login Access Denied !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0); 1012 } 1013 961 1014 free(tmpstr1), tmpstr1 = NULL; 962 1015 } … … 964 1017 if(tmpstr2 != NULL) 965 1018 { 1019 if(ostrstr(tmpstr2, "Anonymous login successful") != NULL && ostrstr(tmpstr2, "Error returning browse list: NT_STATUS_ACCESS_DENIED") != NULL) 1020 { 1021 textbox(_("Message"), _("Anonymous login Access Denied !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0); 1022 found = 1; 1023 } 1024 else if(ostrstr(tmpstr2, "Anonymous login successful") != NULL) 1025 textbox(_("Message"), _("Anonymous login successful"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0); 1026 966 1027 char* tmpstr3 = ostrcat("\t", tmpstr2, 0, 0); 967 1028 … … 971 1032 ret1 = strsplit(tmpstr3, "\n", &count); 972 1033 973 if( ret1 != NULL && count > 0)1034 if(found == 0 && ret1 != NULL && count > 0) 974 1035 { 975 1036 int max = count; 976 1037 for(j = 0; j < max; j++) 977 1038 { 1039 if(!ostrncmp("Error returning", ret1[j].part, 15)) 1040 { 1041 debug(70, "break: Error returning: %s\n", ret1[j].part); 1042 break; 1043 } 1044 978 1045 if(ostrncmp("\t", ret1[j].part, 1)) 979 1046 { 1047 debug(70, "continue: no tab: %s\n", ret1[j].part); 980 1048 continue; 981 1049 } … … 989 1057 990 1058 char* tmpstr6 = string_resub("\t", tmpstr5, ret1[j].part, 0); 991 1059 992 1060 stringreplacechar(tmpstr5, ' ', '\0'); 993 1061 … … 1119 1187 char* user = NULL, *pass = NULL; 1120 1188 1121 if(textbox(_("Message"), _("Use User authentication ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1)1189 if(textbox(_("Message"), _("Use User authentication ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 700, 200, 0, 0) == 1) 1122 1190 { 1123 1191 user = ostrcat(user, getconfig("netbrowser_user", NULL), 1, 0);
Note: See TracChangeset
for help on using the changeset viewer.