~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/ipc/client.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2011-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2011-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "llist.h"
44
44
        }
45
45
 
46
46
        T_BEGIN {
47
 
                o_stream_send_str(client->output,
48
 
                                  t_strdup_printf("%c%s\n", chr, line));
 
47
                o_stream_nsend_str(client->output,
 
48
                                   t_strdup_printf("%c%s\n", chr, line));
49
49
        } T_END;
50
50
 
51
51
        if (status != IPC_CMD_STATUS_REPLY && client->io == NULL) {
72
72
                        data = strchr(id, '\t');
73
73
                }
74
74
                if (data == NULL || data[1] == '\0') {
75
 
                        o_stream_send_str(client->output, "-Invalid input\n");
 
75
                        o_stream_nsend_str(client->output, "-Invalid input\n");
76
76
                        continue;
77
77
                }
78
78
                *data++ = '\0';
83
83
                if (strcmp(id, "*") == 0) {
84
84
                        /* send to everyone */
85
85
                        if (group == NULL) {
86
 
                                client_cmd_input(IPC_CMD_STATUS_OK,
87
 
                                                 NULL, client);
 
86
                                client_cmd_input(IPC_CMD_STATUS_OK, "", client);
88
87
                        } else {
89
88
                                ret = ipc_group_cmd(group, data,
90
89
                                                    client_cmd_input, client);
91
90
                        }
92
91
                } else if (str_to_uint(id, &id_num) < 0) {
93
 
                        o_stream_send_str(client->output,
 
92
                        o_stream_nsend_str(client->output,
94
93
                                t_strdup_printf("-Invalid IPC connection id: %s\n", id));
95
94
                        continue;
96
95
                } else if (group == NULL) {
97
 
                        o_stream_send_str(client->output,
 
96
                        o_stream_nsend_str(client->output,
98
97
                                t_strdup_printf("-Unknown IPC group: %s\n", line));
99
98
                } else if ((conn = ipc_connection_lookup_id(group, id_num)) == NULL) {
100
 
                        o_stream_send_str(client->output,
 
99
                        o_stream_nsend_str(client->output,
101
100
                                t_strdup_printf("-Unknown IPC connection id: %u\n", id_num));
102
101
                        continue;
103
102
                } else {
125
124
        client->io = io_add(fd, IO_READ, client_input, client);
126
125
        client->input = i_stream_create_fd(fd, (size_t)-1, FALSE);
127
126
        client->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
 
127
        o_stream_set_no_error_handling(client->output, TRUE);
128
128
 
129
129
        DLLIST_PREPEND(&clients, client);
130
130
        return client;