Ignore:
Timestamp:
Sep 13, 2007, 8:44:04 AM (18 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.26a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/libsmb/libsmbclient.c

    r62 r71  
    504504        struct sockaddr addr;
    505505
    506         /*
    507          * Although the use of port 139 is not a guarantee that we're using
    508          * netbios, we assume so.  We don't want to send a keepalive packet if
    509          * not netbios because it's not valid, and Vista, at least,
    510          * disconnects the client on such a request.
    511          */
    512         if (server->cli->port == 139) {
    513                 /* Assuming netbios.  Send a keepalive packet */
    514                 if ( send_keepalive(server->cli->fd) == False ) {
    515                         return 1;
    516                 }
    517         } else {
    518                 /*
    519                  * Assuming not netbios.  Try a different method to detect if
    520                  * the connection is still alive.
    521                  */
    522                 size = sizeof(addr);
    523                 if (getpeername(server->cli->fd, &addr, &size) == -1) {
    524                         return 1;
    525                 }
    526         }
    527 
    528         /* connection is ok */
    529         return 0;
     506        size = sizeof(addr);
     507        return (getpeername(server->cli->fd, &addr, &size) == -1);
    530508}
    531509
     
    565543        DEBUG(3, ("smbc_remove_usused_server: %p removed.\n", srv));
    566544
    567         context->callbacks.remove_cached_srv_fn(context, srv);
     545        (context->callbacks.remove_cached_srv_fn)(context, srv);
    568546
    569547        SAFE_FREE(srv);
     
    585563 check_server_cache:
    586564
    587         srv = context->callbacks.get_cached_srv_fn(context, server, share,
    588                                                    workgroup, username);
     565        srv = (context->callbacks.get_cached_srv_fn)(context, server, share,
     566                                                     workgroup, username);
    589567
    590568        if (!auth_called && !srv && (!username[0] || !password[0])) {
    591569                if (context->internal->_auth_fn_with_context != NULL) {
    592                          context->internal->_auth_fn_with_context(
     570                        (context->internal->_auth_fn_with_context)(
    593571                                context,
    594572                                server, share,
     
    597575                                password, sizeof(fstring));
    598576                } else {
    599                         context->callbacks.auth_fn(
     577                        (context->callbacks.auth_fn)(
    600578                                server, share,
    601579                                workgroup, sizeof(fstring),
     
    615593       
    616594        if (srv) {
    617                 if (context->callbacks.check_server_fn(context, srv)) {
     595                if ((context->callbacks.check_server_fn)(context, srv)) {
    618596                        /*
    619597                         * This server is no good anymore
     
    621599                         * servers in the cache
    622600                         */
    623                         if (context->callbacks.remove_unused_server_fn(context,
    624                                                                        srv)) {
     601                        if ((context->callbacks.remove_unused_server_fn)(context,
     602                                                                         srv)) {
    625603                                /*
    626604                                 * We could not remove the server completely,
     
    629607                                 * file/dir is closed.
    630608                                 */
    631                                 context->callbacks.remove_cached_srv_fn(context,
    632                                                                         srv);
     609                                (context->callbacks.remove_cached_srv_fn)(context,
     610                                                                          srv);
    633611                        }
    634612                       
     
    707685                        /* Ensure we have accurate auth info */
    708686                        if (context->internal->_auth_fn_with_context != NULL) {
    709                                 context->internal->_auth_fn_with_context(
     687                                (context->internal->_auth_fn_with_context)(
    710688                                        context,
    711689                                        server, share,
     
    714692                                        password, sizeof(fstring));
    715693                        } else {
    716                                 context->callbacks.auth_fn(
     694                                (context->callbacks.auth_fn)(
    717695                                        server, share,
    718696                                        workgroup, sizeof(fstring),
     
    727705                                cli_shutdown(srv->cli);
    728706                                srv->cli = NULL;
    729                                 context->callbacks.remove_cached_srv_fn(context,
    730                                                                         srv);
     707                                (context->callbacks.remove_cached_srv_fn)(context,
     708                                                                          srv);
    731709                                srv = NULL;
    732710                        }
     
    905883        /* Let the cache function set errno if it wants to */
    906884        errno = 0;
    907         if (context->callbacks.add_cached_srv_fn(context, srv, server, share, workgroup, username)) {
     885        if ((context->callbacks.add_cached_srv_fn)(context, srv,
     886                                                   server, share,
     887                                                   workgroup, username)) {
    908888                int saved_errno = errno;
    909889                DEBUG(3, (" Failed to add server to cache\n"));
     
    964944                        /* ... then retrieve it now. */
    965945                        if (context->internal->_auth_fn_with_context != NULL) {
    966                                 context->internal->_auth_fn_with_context(
     946                                (context->internal->_auth_fn_with_context)(
    967947                                        context,
    968948                                        server, share,
     
    971951                                        password, sizeof(fstring));
    972952                        } else {
    973                                 context->callbacks.auth_fn(
     953                                (context->callbacks.auth_fn)(
    974954                                        server, share,
    975955                                        workgroup, sizeof(fstring),
     
    10431023
    10441024                errno = 0;      /* let cache function set errno if it likes */
    1045                 if (context->callbacks.add_cached_srv_fn(context, ipc_srv,
    1046                                                          server,
    1047                                                          "*IPC$",
    1048                                                          workgroup,
    1049                                                          username)) {
     1025                if ((context->callbacks.add_cached_srv_fn)(context, ipc_srv,
     1026                                                           server,
     1027                                                           "*IPC$",
     1028                                                           workgroup,
     1029                                                           username)) {
    10501030                        DEBUG(3, (" Failed to add server to cache\n"));
    10511031                        if (errno == 0) {
     
    12101190
    12111191                eno = smbc_errno(context, srv->cli);
    1212                 file = context->opendir(context, fname);
     1192                file = (context->opendir)(context, fname);
    12131193                if (!file) errno = eno;
    12141194                return file;
     
    14491429        if (!file->file) {
    14501430               
    1451                 return context->closedir(context, file);
     1431                return (context->closedir)(context, file);
    14521432
    14531433        }
     
    14861466                SAFE_FREE(file->fname);
    14871467                SAFE_FREE(file);
    1488                 context->callbacks.remove_unused_server_fn(context, srv);
     1468                (context->callbacks.remove_unused_server_fn)(context, srv);
    14891469
    14901470                return -1;
     
    21992179        if (!file->file) {
    22002180
    2201                 return context->fstatdir(context, file, st);
     2181                return (context->fstatdir)(context, file, st);
    22022182
    22032183        }
     
    29682948                                cb = &context->callbacks;
    29692949                                if (cli_is_error(targetcli) &&
    2970                                     cb->check_server_fn(context, srv)) {
    2971 
    2972                                     /* ... then remove it. */
    2973                                     if (cb->remove_unused_server_fn(context,
    2974                                                                     srv)) {
    2975                                         /*
    2976                                          * We could not remove the server
    2977                                          * completely, remove it from the
    2978                                          * cache so we will not get it
    2979                                          * again. It will be removed when the
    2980                                          * last file/dir is closed.
    2981                                          */
    2982                                         cb->remove_cached_srv_fn(context, srv);
    2983                                     }
     2950                                    (cb->check_server_fn)(context, srv)) {
     2951
     2952                                        /* ... then remove it. */
     2953                                        if ((cb->remove_unused_server_fn)(context,
     2954                                                                          srv)) {
     2955                                                /*
     2956                                                 * We could not remove the
     2957                                                 * server completely, remove
     2958                                                 * it from the cache so we
     2959                                                 * will not get it again. It
     2960                                                 * will be removed when the
     2961                                                 * last file/dir is closed.
     2962                                                 */
     2963                                                (cb->remove_cached_srv_fn)(context,
     2964                                                                           srv);
     2965                                        }
    29842966                                }
    29852967
     
    60035985        /* What if the path is empty, or the file exists? */
    60045986
    6005         return context->open(context, fname, O_WRONLY, 666);
     5987        return (context->open)(context, fname, O_WRONLY, 666);
    60065988
    60075989}
     
    60446026        /* Try to open the file for reading ... */
    60456027
    6046         if ((long)(fid1 = c_file->open(c_file, fname, O_RDONLY, 0666)) < 0) {
     6028        if ((long)(fid1 = (c_file->open)(c_file, fname, O_RDONLY, 0666)) < 0) {
    60476029               
    60486030                DEBUG(3, ("Error, fname=%s, errno=%i\n", fname, errno));
     
    60536035        /* Now, try to open the printer file for writing */
    60546036
    6055         if ((long)(fid2 = c_print->open_print_job(c_print, printq)) < 0) {
     6037        if ((long)(fid2 = (c_print->open_print_job)(c_print, printq)) < 0) {
    60566038
    60576039                saverr = errno;  /* Save errno */
    6058                 c_file->close_fn(c_file, fid1);
     6040                (c_file->close_fn)(c_file, fid1);
    60596041                errno = saverr;
    60606042                return -1;
     
    60626044        }
    60636045
    6064         while ((bytes = c_file->read(c_file, fid1, buf, sizeof(buf))) > 0) {
     6046        while ((bytes = (c_file->read)(c_file, fid1, buf, sizeof(buf))) > 0) {
    60656047
    60666048                tot_bytes += bytes;
    60676049
    6068                 if ((c_print->write(c_print, fid2, buf, bytes)) < 0) {
     6050                if (((c_print->write)(c_print, fid2, buf, bytes)) < 0) {
    60696051
    60706052                        saverr = errno;
    6071                         c_file->close_fn(c_file, fid1);
    6072                         c_print->close_fn(c_print, fid2);
     6053                        (c_file->close_fn)(c_file, fid1);
     6054                        (c_print->close_fn)(c_print, fid2);
    60736055                        errno = saverr;
    60746056
     
    60796061        saverr = errno;
    60806062
    6081         c_file->close_fn(c_file, fid1);  /* We have to close these anyway */
    6082         c_print->close_fn(c_print, fid2);
     6063        (c_file->close_fn)(c_file, fid1);  /* We have to close these anyway */
     6064        (c_print->close_fn)(c_print, fid2);
    60836065
    60846066        if (bytes < 0) {
     
    63306312                f = context->internal->_files;
    63316313                while (f) {
    6332                         context->close_fn(context, f);
     6314                        (context->close_fn)(context, f);
    63336315                        f = f->next;
    63346316                }
     
    63466328                                          s, s->cli->fd));
    63476329                                cli_shutdown(s->cli);
    6348                                 context->callbacks.remove_cached_srv_fn(context,
    6349                                                                         s);
     6330                                (context->callbacks.remove_cached_srv_fn)(context,
     6331                                                                          s);
    63506332                                next = s->next;
    63516333                                DLIST_REMOVE(context->internal->_servers, s);
     
    63586340        else {
    63596341                /* This is the polite way */   
    6360                 if (context->callbacks.purge_cached_fn(context)) {
     6342                if ((context->callbacks.purge_cached_fn)(context)) {
    63616343                        DEBUG(1, ("Could not purge all servers, "
    63626344                                  "free_context failed.\n"));
Note: See TracChangeset for help on using the changeset viewer.