Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/utils/nmblookup.c

    r414 r740  
    2121
    2222#include "includes.h"
    23 
    24 extern bool AllowDebugChange;
     23#include "popt_common.h"
     24#include "libsmb/nmblib.h"
    2525
    2626static bool give_flags = false;
     
    108108****************************************************************************/
    109109
    110 static void do_node_status(int fd,
    111                 const char *name,
     110static void do_node_status(const char *name,
    112111                int type,
    113112                struct sockaddr_storage *pss)
     
    115114        struct nmb_name nname;
    116115        int count, i, j;
    117         NODE_STATUS_STRUCT *status;
     116        struct node_status *addrs;
    118117        struct node_status_extra extra;
    119118        fstring cleanname;
    120119        char addr[INET6_ADDRSTRLEN];
     120        NTSTATUS status;
    121121
    122122        print_sockaddr(addr, sizeof(addr), pss);
    123123        d_printf("Looking up status of %s\n",addr);
    124124        make_nmb_name(&nname, name, type);
    125         status = node_status_query(fd, &nname, pss, &count, &extra);
    126         if (status) {
     125        status = node_status_query(talloc_tos(), &nname, pss,
     126                                   &addrs, &count, &extra);
     127        if (NT_STATUS_IS_OK(status)) {
    127128                for (i=0;i<count;i++) {
    128                         pull_ascii_fstring(cleanname, status[i].name);
     129                        pull_ascii_fstring(cleanname, addrs[i].name);
    129130                        for (j=0;cleanname[j];j++) {
    130131                                if (!isprint((int)cleanname[j])) {
     
    133134                        }
    134135                        d_printf("\t%-15s <%02x> - %s\n",
    135                                cleanname,status[i].type,
    136                                node_status_flags(status[i].flags));
     136                               cleanname,addrs[i].type,
     137                               node_status_flags(addrs[i].flags));
    137138                }
    138139                d_printf("\n\tMAC Address = %02X-%02X-%02X-%02X-%02X-%02X\n",
     
    141142                                extra.mac_addr[4], extra.mac_addr[5]);
    142143                d_printf("\n");
    143                 SAFE_FREE(status);
     144                TALLOC_FREE(addrs);
    144145        } else {
    145146                d_printf("No reply from %s\n\n",addr);
     
    154155static bool query_one(const char *lookup, unsigned int lookup_type)
    155156{
    156         int j, count, flags = 0;
     157        int j, count;
     158        uint8_t flags;
    157159        struct sockaddr_storage *ip_list=NULL;
     160        NTSTATUS status = NT_STATUS_NOT_FOUND;
    158161
    159162        if (got_bcast) {
     
    161164                print_sockaddr(addr, sizeof(addr), &bcast_addr);
    162165                d_printf("querying %s on %s\n", lookup, addr);
    163                 ip_list = name_query(ServerFD,lookup,lookup_type,use_bcast,
    164                                      use_bcast?true:recursion_desired,
    165                                      &bcast_addr, &count, &flags, NULL);
     166                status = name_query(lookup,lookup_type,use_bcast,
     167                                    use_bcast?true:recursion_desired,
     168                                    &bcast_addr, talloc_tos(),
     169                                    &ip_list, &count, &flags);
    166170        } else {
    167171                const struct in_addr *bcast;
     
    180184                        d_printf("querying %s on %s\n",
    181185                               lookup, addr);
    182                         ip_list = name_query(ServerFD,lookup,lookup_type,
    183                                              use_bcast,
    184                                              use_bcast?True:recursion_desired,
    185                                              &bcast_ss,&count, &flags, NULL);
    186                 }
    187         }
    188 
    189         if (!ip_list) {
     186                        status = name_query(lookup,lookup_type,
     187                                            use_bcast,
     188                                            use_bcast?True:recursion_desired,
     189                                            &bcast_ss, talloc_tos(),
     190                                            &ip_list, &count, &flags);
     191                }
     192        }
     193
     194        if (!NT_STATUS_IS_OK(status)) {
    190195                return false;
    191196        }
     
    215220                 */
    216221                if (find_status) {
    217                         do_node_status(ServerFD, lookup,
    218                                         lookup_type, &ip_list[j]);
    219                 }
    220         }
    221 
    222         free(ip_list);
    223 
    224         return (ip_list != NULL);
     222                        do_node_status(lookup, lookup_type, &ip_list[j]);
     223                }
     224        }
     225
     226        TALLOC_FREE(ip_list);
     227
     228        return NT_STATUS_IS_OK(status);
    225229}
    226230
     
    259263        load_case_tables();
    260264
    261         setup_logging(argv[0],True);
     265        setup_logging(argv[0], DEBUG_STDOUT);
    262266
    263267        pc = poptGetContext("nmblookup", argc, (const char **)argv,
     
    336340                        in_addr_to_sockaddr_storage(&ss, ip);
    337341                        fstrcpy(lookup,"*");
    338                         do_node_status(ServerFD, lookup, lookup_type, &ss);
     342                        do_node_status(lookup, lookup_type, &ss);
    339343                        continue;
    340344                }
Note: See TracChangeset for help on using the changeset viewer.