This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <errno.h>
+#include <time.h>
#include <sys/time.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <libsmbclient.h>
-
-void auth_fn(const char *server, const char *share,
- char *workgroup, int wgmaxlen, char *username, int unmaxlen,
- char *password, int pwmaxlen)
-{
- char temp[128];
-
- fprintf(stdout, "Need password for //%s/%s\n", server, share);
-
- fprintf(stdout, "Enter workgroup: [%s] ", workgroup);
- fgets(temp, sizeof(temp), stdin);
-
- if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
- temp[strlen(temp) - 1] = 0x00;
-
- if (temp[0]) strncpy(workgroup, temp, wgmaxlen - 1);
-
- fprintf(stdout, "Enter username: [%s] ", username);
- fgets(temp, sizeof(temp), stdin);
-
- if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
- temp[strlen(temp) - 1] = 0x00;
-
- if (temp[0]) strncpy(username, temp, unmaxlen - 1);
-
- fprintf(stdout, "Enter password: [%s] ", password);
- fgets(temp, sizeof(temp), stdin);
-
- if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
- temp[strlen(temp) - 1] = 0x00;
-
- if (temp[0]) strncpy(password, temp, pwmaxlen - 1);
-
-}
+#include "libsmbclient.h"
+#include "get_auth_data_fn.h"
int global_id = 0;
void print_list_fn(struct print_job_info *pji)
{
- fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n",
- pji->id, pji->priority, pji->size, pji->user, pji->name);
+ fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n",
+ pji->id,
+ pji->priority,
+ (unsigned long) pji->size,
+ pji->user,
+ pji->name);
global_id = pji->id;
char *dirp;
struct stat st1, st2;
- err = smbc_init(auth_fn, 10); /* Initialize things */
+ err = smbc_init(get_auth_data_fn, 10); /* Initialize things */
if (err < 0) {
((struct smbc_dirent *)dirp)->comment);
dirp += dsize;
- (char *)dirc -= dsize;
+ dirc -= dsize;
}
}
- fprintf(stdout, "Wrote %d bytes to file: %s\n", sizeof(buff), buff);
+ fprintf(stdout, "Wrote %lu bytes to file: %s\n",
+ (unsigned long) sizeof(buff), buff);
/* Now, seek the file back to offset 0 */