ipmishell.c (c076fde0a62b345ccd8ea50d1905b942843d527e) ipmishell.c (eb54136775f63a6a159f3c55ee4772d7aa363cc4)
1/*
2 * Copyright (c) 2003, 2004 Sun Microsystems, Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistribution of source code must retain the above copyright

--- 287 unchanged lines hidden (view full) ---

296 if (strncmp(argv[0], "host", 4) == 0 ||
297 strncmp(argv[0], "hostname", 8) == 0) {
298 ipmi_intf_session_set_hostname(intf, argv[1]);
299 if (intf->session == NULL) {
300 lprintf(LOG_ERR, "Failed to set session hostname.");
301 return (-1);
302 }
303 printf("Set session hostname to %s\n",
1/*
2 * Copyright (c) 2003, 2004 Sun Microsystems, Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistribution of source code must retain the above copyright

--- 287 unchanged lines hidden (view full) ---

296 if (strncmp(argv[0], "host", 4) == 0 ||
297 strncmp(argv[0], "hostname", 8) == 0) {
298 ipmi_intf_session_set_hostname(intf, argv[1]);
299 if (intf->session == NULL) {
300 lprintf(LOG_ERR, "Failed to set session hostname.");
301 return (-1);
302 }
303 printf("Set session hostname to %s\n",
304 intf->session->hostname);
304 intf->ssn_params.hostname);
305 }
306 else if (strncmp(argv[0], "user", 4) == 0 ||
307 strncmp(argv[0], "username", 8) == 0) {
308 ipmi_intf_session_set_username(intf, argv[1]);
309 if (intf->session == NULL) {
310 lprintf(LOG_ERR, "Failed to set session username.");
311 return (-1);
312 }
313 printf("Set session username to %s\n",
305 }
306 else if (strncmp(argv[0], "user", 4) == 0 ||
307 strncmp(argv[0], "username", 8) == 0) {
308 ipmi_intf_session_set_username(intf, argv[1]);
309 if (intf->session == NULL) {
310 lprintf(LOG_ERR, "Failed to set session username.");
311 return (-1);
312 }
313 printf("Set session username to %s\n",
314 intf->session->username);
314 intf->ssn_params.username);
315 }
316 else if (strncmp(argv[0], "pass", 4) == 0 ||
317 strncmp(argv[0], "password", 8) == 0) {
318 ipmi_intf_session_set_password(intf, argv[1]);
319 if (intf->session == NULL) {
320 lprintf(LOG_ERR, "Failed to set session password.");
321 return (-1);
322 }

--- 8 unchanged lines hidden (view full) ---

331 return (-1);
332 }
333 ipmi_intf_session_set_authtype(intf, authtype);
334 if (intf->session == NULL) {
335 lprintf(LOG_ERR, "Failed to set session authtype.");
336 return (-1);
337 }
338 printf("Set session authtype to %s\n",
315 }
316 else if (strncmp(argv[0], "pass", 4) == 0 ||
317 strncmp(argv[0], "password", 8) == 0) {
318 ipmi_intf_session_set_password(intf, argv[1]);
319 if (intf->session == NULL) {
320 lprintf(LOG_ERR, "Failed to set session password.");
321 return (-1);
322 }

--- 8 unchanged lines hidden (view full) ---

331 return (-1);
332 }
333 ipmi_intf_session_set_authtype(intf, authtype);
334 if (intf->session == NULL) {
335 lprintf(LOG_ERR, "Failed to set session authtype.");
336 return (-1);
337 }
338 printf("Set session authtype to %s\n",
339 val2str(intf->session->authtype_set,
339 val2str(intf->ssn_params.authtype_set,
340 ipmi_authtype_session_vals));
341 }
342 else if (strncmp(argv[0], "privlvl", 7) == 0) {
343 int privlvl;
344 privlvl = str2val(argv[1], ipmi_privlvl_vals);
345 if (privlvl == 0xFF) {
346 lprintf(LOG_ERR, "Invalid privilege level: %s",
347 argv[1]);
348 return (-1);
349 }
350 ipmi_intf_session_set_privlvl(intf, privlvl);
351 if (intf->session == NULL) {
352 lprintf(LOG_ERR,
353 "Failed to set session privilege level.");
354 return (-1);
355 }
356 printf("Set session privilege level to %s\n",
340 ipmi_authtype_session_vals));
341 }
342 else if (strncmp(argv[0], "privlvl", 7) == 0) {
343 int privlvl;
344 privlvl = str2val(argv[1], ipmi_privlvl_vals);
345 if (privlvl == 0xFF) {
346 lprintf(LOG_ERR, "Invalid privilege level: %s",
347 argv[1]);
348 return (-1);
349 }
350 ipmi_intf_session_set_privlvl(intf, privlvl);
351 if (intf->session == NULL) {
352 lprintf(LOG_ERR,
353 "Failed to set session privilege level.");
354 return (-1);
355 }
356 printf("Set session privilege level to %s\n",
357 val2str(intf->session->privlvl,
357 val2str(intf->ssn_params.privlvl,
358 ipmi_privlvl_vals));
359 }
360 else if (strncmp(argv[0], "port", 4) == 0) {
361 int port = 0;
362 if (str2int(argv[1], &port) != 0 || port > MAX_PORT) {
363 lprintf(LOG_ERR, "Given port '%s' is invalid.",
364 argv[1]);
365 return (-1);
366 }
367 ipmi_intf_session_set_port(intf, port);
368 if (intf->session == NULL) {
369 lprintf(LOG_ERR, "Failed to set session port.");
370 return (-1);
371 }
358 ipmi_privlvl_vals));
359 }
360 else if (strncmp(argv[0], "port", 4) == 0) {
361 int port = 0;
362 if (str2int(argv[1], &port) != 0 || port > MAX_PORT) {
363 lprintf(LOG_ERR, "Given port '%s' is invalid.",
364 argv[1]);
365 return (-1);
366 }
367 ipmi_intf_session_set_port(intf, port);
368 if (intf->session == NULL) {
369 lprintf(LOG_ERR, "Failed to set session port.");
370 return (-1);
371 }
372 printf("Set session port to %d\n", intf->session->port);
372 printf("Set session port to %d\n", intf->ssn_params.port);
373 }
374 else if (strncmp(argv[0], "localaddr", 9) == 0) {
375 uint8_t my_addr = 0;
376 if (str2uchar(argv[1], &my_addr) != 0) {
377 lprintf(LOG_ERR, "Given localaddr '%s' is invalid.",
378 argv[1]);
379 return (-1);
380 }

--- 134 unchanged lines hidden ---
373 }
374 else if (strncmp(argv[0], "localaddr", 9) == 0) {
375 uint8_t my_addr = 0;
376 if (str2uchar(argv[1], &my_addr) != 0) {
377 lprintf(LOG_ERR, "Given localaddr '%s' is invalid.",
378 argv[1]);
379 return (-1);
380 }

--- 134 unchanged lines hidden ---